Allow the git-pull command to be configurable
authorCatalin Marinas <catalin.marinas@gmail.com>
Fri, 20 Oct 2006 20:48:32 +0000 (21:48 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 20 Oct 2006 20:48:32 +0000 (21:48 +0100)
This way some people can use cg-pull instead. The patch also does some
clean-up in the example stgitrc file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
TODO
examples/stgitrc
stgit/config.py
stgit/git.py

diff --git a/TODO b/TODO
index a688f9e..63047a4 100644 (file)
--- a/TODO
+++ b/TODO
@@ -2,7 +2,6 @@ The TODO list before 1.0:
 
 - more regression tests
 - stg help should probably pipe through the $PAGER
-- configurable pull command (currently uses git-pull only)
 - fix StGIT to run correctly in subdirectories
 - use a separate index for some commands (refresh, fold etc.) so that
   files already added/removed are not automatically checked in
index 28e1879..2b85c1f 100644 (file)
 
 # Set to 'yes' if you don't want to use the 'resolved' command.
 # 'refresh' will automatically mark the conflicts as resolved
-autoresolved: no
+#autoresolved: no
 
-smtpserver: localhost:25
+#smtpserver: localhost:25
 #smtpuser: username
 #smtppassword: password
 
-# delay between messages in seconds (defaults to 2)
-#smtpdelay: 2
+# delay between messages in seconds (defaults to 5)
+#smtpdelay: 5
 
 # stg will look for this first, then look for the EDITOR environmental
 # variable, then default to using 'vi'
@@ -27,11 +27,14 @@ smtpserver: localhost:25
 # this value overrides the default PAGER environment variable
 #pager: ~/share/stgit/contrib/diffcol.sh
 
+# GIT pull command (should take the same arguments as git-pull)
+#pullcmd: git-pull
+
 # 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
 # output parameter
-merger: diff3 -L current -L ancestor -L patched -m -E \
-       "%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"
+#merger: diff3 -L current -L ancestor -L patched -m -E \
+#      "%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"
 
 # Interactive three-way merge tool. It is executed by the 'resolved
 # --interactive' command
@@ -42,7 +45,7 @@ merger: diff3 -L current -L ancestor -L patched -m -E \
 #      "%(branch1)s" "%(branch2)s" "%(ancestor)s" nil "%(output)s")'
 
 # Leave the original files in the working tree in case of a merge conflict
-keeporig: yes
+#keeporig: yes
 
 # Extensions for the files involved in a three-way merge (ancestor,
 # current, patched)
index c404c64..f9ea074 100644 (file)
@@ -29,7 +29,8 @@ config = ConfigParser.RawConfigParser()
 config.add_section('stgit')
 config.set('stgit', 'autoresolved', 'no')
 config.set('stgit', 'smtpserver', 'localhost:25')
-config.set('stgit', 'smtpdelay', '2')
+config.set('stgit', 'smtpdelay', '5')
+config.set('stgit', 'pullcmd', 'git-pull')
 config.set('stgit', 'merger',
            'diff3 -L current -L ancestor -L patched -m -E ' \
            '"%(branch1)s" "%(ancestor)s" "%(branch2)s" > "%(output)s"')
index 025d15d..43bdc7e 100644 (file)
@@ -22,6 +22,7 @@ import sys, os, popen2, re, gitmergeonefile
 
 from stgit import basedir
 from stgit.utils import *
+from stgit.config import config
 
 # git exception class
 class GitException(Exception):
@@ -691,7 +692,7 @@ def pull(repository = 'origin', refspec = None):
     if refspec:
         args.append(refspec)
 
-    if __run('git-pull', args) != 0:
+    if __run(config.get('stgit', 'pullcmd'), args) != 0:
         raise GitException, 'Failed "git-pull %s"' % repository
 
 def apply_patch(filename = None, base = None):