chiark / gitweb /
Add a --branch option to different commands
authorCatalin Marinas <catalin.marinas@gmail.com>
Tue, 13 Sep 2005 16:11:18 +0000 (17:11 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 13 Sep 2005 16:11:18 +0000 (17:11 +0100)
This command will show the information on a different branch than the
current one.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/applied.py
stgit/commands/export.py
stgit/commands/files.py
stgit/commands/id.py
stgit/commands/mail.py
stgit/commands/rename.py
stgit/commands/series.py
stgit/commands/top.py
stgit/commands/unapplied.py
stgit/main.py

index 8a2a2320e8767333f3881e1b568922b25b50e6bf..d568cd60c5759cfd84d4148f3c3d5bf9f5b85d41 100644 (file)
@@ -31,7 +31,8 @@ List the patches from the series which were already pushed onto the
 stack.  They are listed in the order in which they were pushed, the
 last one being the current (topmost) patch."""
 
-options = []
+options = [make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index ebcc77a2dba0e15b01e0112277f74d9865fd7462..5f43da57c2d079b935a8b75ddc61c2be34f68c5a 100644 (file)
@@ -56,7 +56,9 @@ options = [make_option('-n', '--numbered',
                        help = 'Use FILE as a template'),
            make_option('-r', '--range',
                        metavar = '[PATCH1][:[PATCH2]]',
-                       help = 'export patches between PATCH1 and PATCH2')]
+                       help = 'export patches between PATCH1 and PATCH2'),
+           make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
@@ -67,7 +69,7 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
-    if git.local_changes():
+    if not options.branch and git.local_changes():
         print 'Warning: local changes in the tree. ' \
               'You might want to commit them first'
 
index 9ce926f13a597fb4e81f04d1b002659f71167b7f..d81bc25affa92dbf2c65a98b2a34d384dd17ec60 100644 (file)
@@ -35,7 +35,9 @@ command. Use the 'diff' or 'status' commands for these files."""
 
 options = [make_option('-s', '--stat',
                        help = 'show the diff stat',
-                       action = 'store_true')]
+                       action = 'store_true'),
+           make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index 447eb62f8fb9359b925afd12a743b091bff98a82..4c07c4fa2d04c0c2ed123352541904f0c17f315b 100644 (file)
@@ -30,7 +30,8 @@ Print the hash value of a GIT id (defaulting to HEAD). In addition to
 the standard GIT id's like heads and tags, this command also accepts
 'base' and '[<patch>]/(bottom | top)'."""
 
-options = []
+options = [make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index 6be00fc069b49827d0124d5f5b5e09768c06159e..012e640360e8f23950c04eaab8d1cebad9b5acae 100644 (file)
@@ -97,7 +97,9 @@ options = [make_option('-a', '--all',
            make_option('-u', '--smtp-user', metavar = 'USER',
                        help = 'username for SMTP authentication'),
            make_option('-p', '--smtp-password', metavar = 'PASSWORD',
-                       help = 'username for SMTP authentication')]
+                       help = 'username for SMTP authentication'),
+           make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def __get_maintainer():
index 78a473f14ce8d931ffa8acfbd131dd27a9b5ddf0..ca799c3a96316663b5f5e57ebb4f0a1e0b2f2030 100644 (file)
@@ -28,7 +28,8 @@ usage = """%prog [options] <oldpatch> <newpatch>
 
 Rename <oldpatch> into <newpatch> in a series."""
 
-options = []
+options = [make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index fb8abb7c1a1a4c3b1f0ebec4502d8cd7364c2fe9..263f39341d99cdd22e08722ce35b643e6cc786b3 100644 (file)
@@ -31,7 +31,8 @@ Show all the patches in the series. The applied patches are prefixed
 with a '+' and the unapplied ones with a '-'. The current patch is
 prefixed with a '>'. Empty patches are prefixed with a '0'."""
 
-options = []
+options = [make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index 1d6ab5e827a898e4cb9808a21980845608dfbe2f..f36a0b066317f60aa576f57e90a5df054d5864ee 100644 (file)
@@ -29,7 +29,8 @@ usage = """%prog [options]
 
 Print the name of the current (topmost) patch."""
 
-options = []
+options = [make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index fe6a48557caa9c11e12d9216237422c14532b476..4a144560ec3aa3fbf580272e74c1873af1bdac8b 100644 (file)
@@ -30,7 +30,8 @@ usage = """%prog [options]
 List the patches from the series which are not pushed onto the stack.
 They are listed in the reverse order in which they were popped."""
 
-options = []
+options = [make_option('-b', '--branch',
+                       help = 'use BRANCH instead of the default one')]
 
 
 def func(parser, options, args):
index 99df5a44257418df30bfd793263dd72469b955a8..ed57668b844165dee2a3f8e9de88b46221e230b6 100644 (file)
@@ -128,8 +128,8 @@ def main():
         sys.exit(0)
     if not cmd in commands:
         print >> sys.stderr, 'Unknown command: %s' % cmd
-        print >> sys.stderr, '  Try "%s help" for a list of supported commands' \
-              % prog
+        print >> sys.stderr, '  Try "%s help" for a list of supported ' \
+              'commands' % prog
         sys.exit(1)
 
     # re-build the command line arguments
@@ -144,6 +144,8 @@ def main():
         # 'clone' doesn't expect an already initialised GIT tree
         if cmd == 'clone':
             stgit.commands.common.crt_series = stack.Series('master')
+        elif hasattr(options, 'branch') and options.branch:
+            stgit.commands.common.crt_series = stack.Series(options.branch)
         else:
             stgit.commands.common.crt_series = stack.Series()
         # the line below is a simple way to avoid an exception when