[Kde-scm-interest] [PATCH] scripty

Thiago Macieira thiago at kde.org
Mon Jun 1 09:18:55 CEST 2009


Chani wrote:
>+      if test "$vcs" = "git"; then
>+        git fetch
>+        branch=`get_git_branch $modname`
>+        if ! git branch | cut -c3- | grep -q "^$branch$"; then

Use git symbolic-ref HEAD to get the current branch name. The result will 
be refs/heads/$branch.

Alternatively, just run the command below anyway, which will fail if the 
branch already exists.

>+          git branch --track $branch origin/$branch

>+        git)
>+          git clean -dfx $SVNQUIETFLAG
>+          git reset --hard $SVNQUIETFLAG origin

Doesn't this require origin/$branch here?

>+          ;;
>+        *)
>+          echo "ERROR: unexpected VCS type?!"

Add: exit 1
Or continue or whatever will skip this module.

>+          if ! git checkout $SVNQUIETFLAG $branch; then
>+            echo "ERROR: failed to switch to branch $branch for module
> $modname." +            exit 1 #FIXME I'd rather gracefully skip this
> module. but how? +           #perhaps I could filter $releases.
> findfiles could be trouble though. +          fi
>+          git pull $SVNQUIETFLAG || echo "ERROR: module $i was not
> correctly updated" +          ;;

Ok, sorry my ignorance but why do the NO_INITIAL_CLEANUP and NOUPDATE flags 
exist in the first place?

Under what conditions should they be used?

Also, we've already done fetch & reset. There's no need to pull again here 
(it'll hit the network and will do little good).

But it doesn't hurt. (Except being slow)

>+          git)
>+            git commit -a $SVNQUIETFLAG -m "SVN_SILENT made messages
> (.desktop file)" +            if ! git push > /dev/null; then
>+              echo "Need to update $i"
>+              git pull $SVNQUIETFLAG
>+              if ! git push; then
>+                echo "ERROR: commiting .desktop files failed for module
> $i!" +                git reset --hard $SVNQUIETFLAG origin
>+              fi
>+            fi
>+            ;;

I recommend pull before commit, since that will not create merge commits. 
If pull fails, it's because the update would touch one of the modified 
files. Note you have a commit above, which breaks this logic: I recommend 
you do the same thing in both:
	git pull && git commit -a -m "......" || error out

And again $branch missing in the reset.

>+               git-test)
>+                       echo
> "git at gitorious.org:scripty-with-git/git-test.git"
> +                       ;;

Hint: add kde-qt.git too, along with qt.git branches master and 4.5. 
You'll see branch the mistakes when doing that.

Scripty doesn't commit to qt-copy, so it's not a problem.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-scm-interest/attachments/20090601/6127a03b/attachment.sig 


More information about the Kde-scm-interest mailing list