chiark / gitweb /
Make 'stg pull' use git-fetch and not git-pull.
authorYann Dirson <ydirson@altern.org>
Wed, 31 Jan 2007 23:41:11 +0000 (23:41 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 31 Jan 2007 23:41:11 +0000 (23:41 +0000)
We introduce a new pull-does-rebase setting, as companion to pullcmd.
This allows to use both pullcmd's that need a rebase (like git-fetch)
and pullcmd's that do not (like git-pull).

To be able to rebase, we rely on parent information being available
for the stack.

Signed-off-by: Yann Dirson <ydirson@altern.org>
examples/gitconfig
stgit/config.py
stgit/git.py

index ee68d071bdaca63dc17b4250162da8b59a4bd462..60f6e8599c4897dfdbb6efb6c969a05ce751015c 100644 (file)
        #pager = ~/share/stgit/contrib/diffcol.sh
        #pager = filterdiff --annotate | colordiff | less -FRX
 
-       # GIT pull command (should take the same arguments as git-pull)
+       # GIT pull command (should take the same arguments as
+       # git-fetch or git-pull).  By default:
+       #pullcmd = git-fetch
+       #pull-does-rebase = yes
+       # Alternative (old behaviour), less intuitive but maybe useful
+       # for some workflows:
        #pullcmd = git-pull
+       #pull-does-rebase = no
 
        # The three-way merge tool. Note that the 'output' file contains the
        # same data as 'branch1'. This is useful for tools that do not take an
index 901f60092abc715c0ee3b7fabb32660dec444cf7..48b4e2d03aa5bebccf5f1316d1ccd6f2c53d4298 100644 (file)
@@ -29,7 +29,8 @@ class GitConfig:
         'stgit.autoresolved':  'no',
         'stgit.smtpserver':    'localhost:25',
         'stgit.smtpdelay':     '5',
-        'stgit.pullcmd':       'git-pull',
+        'stgit.pullcmd':       'git-fetch',
+        'stgit.pull-does-rebase': 'yes',
         'stgit.merger':                'diff3 -L current -L ancestor -L patched -m -E ' \
                                '"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"',
         'stgit.autoimerge':    'no',
index 038aaac3f0a57d6b56052d001a7abd91a35fd3ce..e30b959e6fcb070fe8a8d4ffd922f676a071e469 100644 (file)
@@ -808,18 +808,23 @@ def reset(files = None, tree_id = None, check_out = True):
         __set_head(tree_id)
 
 def pull(repository = 'origin', refspec = None):
-    """Pull changes from the remote repository. At the moment, just
-    use the 'git-pull' command
+    """Pull changes from the remote repository. Uses 'git-fetch'
+    and moves the stack base.
     """
-    # 'git-pull' updates the HEAD
+    # we update the HEAD
     __clear_head_cache()
 
     args = [repository]
     if refspec:
         args.append(refspec)
 
-    if __run(config.get('stgit.pullcmd'), args) != 0:
-        raise GitException, 'Failed "git-pull %s"' % repository
+    command = config.get('stgit.pullcmd')
+    if __run(command, args) != 0:
+        raise GitException, 'Failed "%s %s"' % (command, repository)
+
+    if (config.get('stgit.pull-does-rebase')):
+        # FIXME!
+        reset(tree_id = rev_parse(repository))
 
 def repack():
     """Repack all objects into a single pack