chiark / gitweb /
Don't have a global crt_series in stgit.commans.common
authorKarl Hasselström <kha@treskal.com>
Mon, 8 Oct 2007 08:36:49 +0000 (10:36 +0200)
committerKarl Hasselström <kha@treskal.com>
Mon, 8 Oct 2007 08:36:49 +0000 (10:36 +0200)
Global variables baaad. Instead, pass it as a parameter to the
functions that need it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
27 files changed:
stgit/commands/branch.py
stgit/commands/clean.py
stgit/commands/commit.py
stgit/commands/common.py
stgit/commands/delete.py
stgit/commands/diff.py
stgit/commands/edit.py
stgit/commands/files.py
stgit/commands/float.py
stgit/commands/fold.py
stgit/commands/goto.py
stgit/commands/id.py
stgit/commands/imprt.py
stgit/commands/mail.py
stgit/commands/new.py
stgit/commands/pick.py
stgit/commands/pop.py
stgit/commands/pull.py
stgit/commands/push.py
stgit/commands/rebase.py
stgit/commands/refresh.py
stgit/commands/series.py
stgit/commands/show.py
stgit/commands/sink.py
stgit/commands/sync.py
stgit/commands/uncommit.py
stgit/main.py

index 6e0a6d89ff732f1a8376d2823e2b66f469f00392..cbb97f67a302a30aea71482dcee5bd784f9bafa9 100644 (file)
@@ -112,7 +112,7 @@ def func(parser, options, args):
 
         check_local_changes()
         check_conflicts()
 
         check_local_changes()
         check_conflicts()
-        check_head_top_equal()
+        check_head_top_equal(crt_series)
 
         tree_id = None
         if len(args) >= 2:
 
         tree_id = None
         if len(args) >= 2:
@@ -141,7 +141,7 @@ def func(parser, options, args):
                 # exception in branch = rev_parse() leaves branchpoint unbound
                 branchpoint = None
 
                 # exception in branch = rev_parse() leaves branchpoint unbound
                 branchpoint = None
 
-            tree_id = branchpoint or git_id(args[1])
+            tree_id = branchpoint or git_id(crt_series, args[1])
 
             if parentbranch:
                 out.info('Recording "%s" as parent branch' % parentbranch)
 
             if parentbranch:
                 out.info('Recording "%s" as parent branch' % parentbranch)
@@ -182,7 +182,7 @@ def func(parser, options, args):
 
         check_local_changes()
         check_conflicts()
 
         check_local_changes()
         check_conflicts()
-        check_head_top_equal()
+        check_head_top_equal(crt_series)
 
         out.start('Cloning current branch to "%s"' % clone)
         crt_series.clone(clone)
 
         out.start('Cloning current branch to "%s"' % clone)
         crt_series.clone(clone)
@@ -294,7 +294,7 @@ def func(parser, options, args):
 
         check_local_changes()
         check_conflicts()
 
         check_local_changes()
         check_conflicts()
-        check_head_top_equal()
+        check_head_top_equal(crt_series)
 
         out.start('Switching to branch "%s"' % args[0])
         git.switch_branch(args[0])
 
         out.start('Switching to branch "%s"' % args[0])
         git.switch_branch(args[0])
index d8bbe7171fa5728a59e8a15b942d88a7ee78512d..4484ecd53624c13e9929d601c59a8ed7b49dc04f 100644 (file)
@@ -61,7 +61,7 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if not (options.applied or options.unapplied):
         options.applied = options.unapplied = True
 
     if not (options.applied or options.unapplied):
         options.applied = options.unapplied = True
@@ -74,4 +74,4 @@ def func(parser, options, args):
         unapplied = crt_series.get_unapplied()
         __delete_empty(unapplied, False)
 
         unapplied = crt_series.get_unapplied()
         __delete_empty(unapplied, False)
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index 2b45c0df90ab1d937f7b98b37487e1fea6250fe0..23b4dc11580617e10e1b1539416dc4bc6cbfe22f 100644 (file)
@@ -45,7 +45,7 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     applied = crt_series.get_applied()
     if not applied:
 
     applied = crt_series.get_applied()
     if not applied:
index 652039f859830f298c576fab7daf27fcbe7b2c3a..2a80e8cc27d6be6f3d28b45a6151419b69c4f727 100644 (file)
@@ -28,8 +28,6 @@ from stgit.run import *
 from stgit import stack, git, basedir
 from stgit.config import config, file_extensions
 
 from stgit import stack, git, basedir
 from stgit.config import config, file_extensions
 
-crt_series = None
-
 
 # Command exception class
 class CmdException(StgException):
 
 # Command exception class
 class CmdException(StgException):
@@ -74,7 +72,7 @@ def parse_rev(rev):
     # No, we can't parse that.
     raise RevParseException
 
     # No, we can't parse that.
     raise RevParseException
 
-def git_id(rev):
+def git_id(crt_series, rev):
     """Return the GIT id
     """
     if not rev:
     """Return the GIT id
     """
     if not rev:
@@ -112,7 +110,7 @@ def check_local_changes():
         raise CmdException, \
               'local changes in the tree. Use "refresh" or "status --reset"'
 
         raise CmdException, \
               'local changes in the tree. Use "refresh" or "status --reset"'
 
-def check_head_top_equal():
+def check_head_top_equal(crt_series):
     if not crt_series.head_top_equal():
         raise CmdException(
 """HEAD and top are not the same. This can happen if you
     if not crt_series.head_top_equal():
         raise CmdException(
 """HEAD and top are not the same. This can happen if you
@@ -125,7 +123,7 @@ def check_conflicts():
               'Unsolved conflicts. Please resolve them first or\n' \
               '  revert the changes with "status --reset"'
 
               'Unsolved conflicts. Please resolve them first or\n' \
               '  revert the changes with "status --reset"'
 
-def print_crt_patch(branch = None):
+def print_crt_patch(crt_series, branch = None):
     if not branch:
         patch = crt_series.get_current()
     else:
     if not branch:
         patch = crt_series.get_current()
     else:
@@ -158,7 +156,7 @@ def resolved_all(reset = None):
             resolved(filename, reset)
         os.remove(os.path.join(basedir.get(), 'conflicts'))
 
             resolved(filename, reset)
         os.remove(os.path.join(basedir.get(), 'conflicts'))
 
-def push_patches(patches, check_merged = False):
+def push_patches(crt_series, patches, check_merged = False):
     """Push multiple patches onto the stack. This function is shared
     between the push and pull commands
     """
     """Push multiple patches onto the stack. This function is shared
     between the push and pull commands
     """
@@ -197,7 +195,7 @@ def push_patches(patches, check_merged = False):
             else:
                 out.done()
 
             else:
                 out.done()
 
-def pop_patches(patches, keep = False):
+def pop_patches(crt_series, patches, keep = False):
     """Pop the patches in the list from the stack. It is assumed that
     the patches are listed in the stack reverse order.
     """
     """Pop the patches in the list from the stack. It is assumed that
     the patches are listed in the stack reverse order.
     """
@@ -319,7 +317,7 @@ def address_or_alias(addr_str):
                  for addr in addr_str.split(',')]
     return ', '.join([addr for addr in addr_list if addr])
 
                  for addr in addr_str.split(',')]
     return ', '.join([addr for addr in addr_list if addr])
 
-def prepare_rebase():
+def prepare_rebase(crt_series):
     # pop all patches
     applied = crt_series.get_applied()
     if len(applied) > 0:
     # pop all patches
     applied = crt_series.get_applied()
     if len(applied) > 0:
@@ -328,9 +326,9 @@ def prepare_rebase():
         out.done()
     return applied
 
         out.done()
     return applied
 
-def rebase(target):
+def rebase(crt_series, target):
     try:
     try:
-        tree_id = git_id(target)
+        tree_id = git_id(crt_series, target)
     except:
         # it might be that we use a custom rebase command with its own
         # target type
     except:
         # it might be that we use a custom rebase command with its own
         # target type
@@ -345,12 +343,12 @@ def rebase(target):
     git.rebase(tree_id = tree_id)
     out.done()
 
     git.rebase(tree_id = tree_id)
     out.done()
 
-def post_rebase(applied, nopush, merged):
+def post_rebase(crt_series, applied, nopush, merged):
     # memorize that we rebased to here
     crt_series._set_field('orig-base', git.get_head())
     # push the patches back
     if not nopush:
     # memorize that we rebased to here
     crt_series._set_field('orig-base', git.get_head())
     # push the patches back
     if not nopush:
-        push_patches(applied, merged)
+        push_patches(crt_series, applied, merged)
 
 #
 # Patch description/e-mail/diff parsing
 
 #
 # Patch description/e-mail/diff parsing
index 84628571c21ed4ee2300308af6f4b5bcd1cc830a..fdb254ec18763e9ebcfc000303c8d72a5ac59f25 100644 (file)
@@ -71,7 +71,7 @@ def func(parser, options, args):
     if applied and not options.branch:
         check_local_changes()
         check_conflicts()
     if applied and not options.branch:
         check_local_changes()
         check_conflicts()
-        check_head_top_equal()
+        check_head_top_equal(crt_series)
 
     # delete the patches
     for patch in applied + patches:
 
     # delete the patches
     for patch in applied + patches:
@@ -79,4 +79,4 @@ def func(parser, options, args):
         out.info('Patch "%s" successfully deleted' % patch)
 
     if not options.branch:
         out.info('Patch "%s" successfully deleted' % patch)
 
     if not options.branch:
-        print_crt_patch()
+        print_crt_patch(crt_series)
index f3b0ea29472e2652925510767725746db6ecb1b1..42e836792febc94567650f15d4e3e095b3ed5ddc 100644 (file)
@@ -86,9 +86,10 @@ def func(parser, options, args):
         diff_flags = []
 
     if options.stat:
         diff_flags = []
 
     if options.stat:
-        out.stdout_raw(git.diffstat(args, git_id(rev1), git_id(rev2)) + '\n')
+        out.stdout_raw(git.diffstat(args, git_id(crt_series, rev1),
+                                    git_id(crt_series, rev2)) + '\n')
     else:
     else:
-        diff_str = git.diff(args, git_id(rev1), git_id(rev2),
-                            diff_flags = diff_flags )
+        diff_str = git.diff(args, git_id(crt_series, rev1),
+                            git_id(crt_series, rev2), diff_flags = diff_flags )
         if diff_str:
             pager(diff_str)
         if diff_str:
             pager(diff_str)
index 02970bc8623758e10b454e2af52d58d85f44a4ca..89d534a9971d4ec7a56af53beda41942d983c16a 100644 (file)
@@ -203,13 +203,13 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if pname != crt_pname:
         # Go to the patch to be edited
         applied = crt_series.get_applied()
         between = applied[:applied.index(pname):-1]
 
     if pname != crt_pname:
         # Go to the patch to be edited
         applied = crt_series.get_applied()
         between = applied[:applied.index(pname):-1]
-        pop_patches(between)
+        pop_patches(crt_series, between)
 
     if options.author:
         options.authname, options.authemail = name_email(options.author)
 
     if options.author:
         options.authname, options.authemail = name_email(options.author)
@@ -241,4 +241,4 @@ def func(parser, options, args):
     if pname != crt_pname:
         # Push the patches back
         between.reverse()
     if pname != crt_pname:
         # Push the patches back
         between.reverse()
-        push_patches(between)
+        push_patches(crt_series, between)
index 07cc955f32cad2314098209eeacfc0153e573f94..4550251d471c4ce67cd72a6a8cbd8c24060b7c18 100644 (file)
@@ -57,8 +57,8 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
     else:
         parser.error('incorrect number of arguments')
 
-    rev1 = git_id('%s//bottom' % patch)
-    rev2 = git_id('%s//top' % patch)
+    rev1 = git_id(crt_series, '%s//bottom' % patch)
+    rev2 = git_id(crt_series, '%s//top' % patch)
 
     if options.stat:
         out.stdout_raw(git.diffstat(rev1 = rev1, rev2 = rev2) + '\n')
 
     if options.stat:
         out.stdout_raw(git.diffstat(rev1 = rev1, rev2 = rev2) + '\n')
index d5299fbdc6fcbcb473313feb15383aaf5ce60fc1..6c07136b0fa6aa9f210ee88b7269316d1312bb9d 100644 (file)
@@ -46,7 +46,7 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     unapplied = crt_series.get_unapplied()
     applied = crt_series.get_applied()
 
     unapplied = crt_series.get_unapplied()
     applied = crt_series.get_applied()
@@ -85,7 +85,7 @@ def func(parser, options, args):
     # check whether the operation is really needed
     if topop != topush:
         if topop:
     # check whether the operation is really needed
     if topop != topush:
         if topop:
-            pop_patches(topop)
+            pop_patches(crt_series, topop)
         if topush:
             topush.reverse()
         if topush:
             topush.reverse()
-            push_patches(topush)
+            push_patches(crt_series, topush)
index 6e431012f4644a55bec353b7449c8d0e6694f154..3930a1f78f1e887f560aa67abb740817d0e51fe9 100644 (file)
@@ -50,7 +50,7 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if len(args) == 1:
         filename = args[0]
 
     if len(args) == 1:
         filename = args[0]
@@ -74,7 +74,8 @@ def func(parser, options, args):
         bottom = crt_patch.get_bottom()
         git.apply_patch(filename = filename, base = bottom)
     elif options.base:
         bottom = crt_patch.get_bottom()
         git.apply_patch(filename = filename, base = bottom)
     elif options.base:
-        git.apply_patch(filename = filename, base = git_id(options.base))
+        git.apply_patch(filename = filename,
+                        base = git_id(crt_series, options.base))
     else:
         git.apply_patch(filename = filename)
 
     else:
         git.apply_patch(filename = filename)
 
index 9e008a9e1a660e3f7719aca2be10df4d79747179..e7aa588bb1c637e5eb1d322ef16d136dc3ba2473 100644 (file)
@@ -44,7 +44,7 @@ def func(parser, options, args):
         parser.error('incorrect number of arguments')
 
     check_conflicts()
         parser.error('incorrect number of arguments')
 
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if not options.keep:
         check_local_changes()
 
     if not options.keep:
         check_local_changes()
@@ -56,13 +56,13 @@ def func(parser, options, args):
     if patch in applied:
         applied.reverse()
         patches = applied[:applied.index(patch)]
     if patch in applied:
         applied.reverse()
         patches = applied[:applied.index(patch)]
-        pop_patches(patches, options.keep)
+        pop_patches(crt_series, patches, options.keep)
     elif patch in unapplied:
         if options.keep:
             raise CmdException, 'Cannot use --keep with patch pushing'
         patches = unapplied[:unapplied.index(patch)+1]
     elif patch in unapplied:
         if options.keep:
             raise CmdException, 'Cannot use --keep with patch pushing'
         patches = unapplied[:unapplied.index(patch)+1]
-        push_patches(patches)
+        push_patches(crt_series, patches)
     else:
         raise CmdException, 'Patch "%s" does not exist' % patch
 
     else:
         raise CmdException, 'Patch "%s" does not exist' % patch
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index 3e28f2f13effc57695fb5d8a147511f52337c37f..94b0229558b9cb471f0b8cd42442fd1bd1b16cb3 100644 (file)
@@ -48,4 +48,4 @@ def func(parser, options, args):
     else:
         parser.error('incorrect number of arguments')
 
     else:
         parser.error('incorrect number of arguments')
 
-    out.stdout(git_id(id_str))
+    out.stdout(git_id(crt_series, id_str))
index 045f18513213b4ccc4a7c7e8605fe0b0e4b05470..d6e950cdd53750d5589d0bb00cd29330ef4f4f67 100644 (file)
@@ -165,7 +165,8 @@ def __create_patch(filename, message, author_name, author_email,
     else:
         out.start('Importing patch "%s"' % patch)
         if options.base:
     else:
         out.start('Importing patch "%s"' % patch)
         if options.base:
-            git.apply_patch(diff = diff, base = git_id(options.base))
+            git.apply_patch(diff = diff,
+                            base = git_id(crt_series, options.base))
         else:
             git.apply_patch(diff = diff)
         crt_series.refresh_patch(edit = options.edit,
         else:
             git.apply_patch(diff = diff)
         crt_series.refresh_patch(edit = options.edit,
@@ -270,7 +271,7 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if len(args) == 1:
         filename = args[0]
 
     if len(args) == 1:
         filename = args[0]
@@ -286,4 +287,4 @@ def func(parser, options, args):
     else:
         __import_file(filename, options)
 
     else:
         __import_file(filename, options)
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index 4a4158a32c85300ef97b545e5b2a4a3102ebae82..883a4f3fd5aa897f69be48879e78cfd6bb2ae3bd 100644 (file)
@@ -350,8 +350,8 @@ def __build_cover(tmpl, patches, msg_id, options):
                  'shortlog':     stack.shortlog(crt_series.get_patch(p)
                                                 for p in patches),
                  'diffstat':     git.diffstat(
                  'shortlog':     stack.shortlog(crt_series.get_patch(p)
                                                 for p in patches),
                  'diffstat':     git.diffstat(
-                                     rev1 = git_id('%s//bottom' % patches[0]),
-                                     rev2 = git_id('%s//top' % patches[-1]))}
+                     rev1 = git_id(crt_series, '%s//bottom' % patches[0]),
+                     rev2 = git_id(crt_series, '%s//top' % patches[-1]))}
 
     try:
         msg_string = tmpl % tmpl_dict
 
     try:
         msg_string = tmpl % tmpl_dict
@@ -435,11 +435,13 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
                  'longdescr':    long_descr,
                  # for backward template compatibility
                  'endofheaders': '',
                  'longdescr':    long_descr,
                  # for backward template compatibility
                  'endofheaders': '',
-                 'diff':         git.diff(rev1 = git_id('%s//bottom' % patch),
-                                          rev2 = git_id('%s//top' % patch),
-                                          diff_flags = diff_flags ),
-                 'diffstat':     git.diffstat(rev1 = git_id('%s//bottom'%patch),
-                                              rev2 = git_id('%s//top' % patch)),
+                 'diff':         git.diff(
+                     rev1 = git_id(crt_series, '%s//bottom' % patch),
+                     rev2 = git_id(crt_series, '%s//top' % patch),
+                     diff_flags = diff_flags),
+                 'diffstat':     git.diffstat(
+                     rev1 = git_id(crt_series, '%s//bottom'%patch),
+                     rev2 = git_id(crt_series, '%s//top' % patch)),
                  # for backward template compatibility
                  'date':         '',
                  'version':      version_str,
                  # for backward template compatibility
                  'date':         '',
                  'version':      version_str,
index ccc8141d5419ead7492792ebb6a921107aaf85ea..b0a57d1579557bce6005191db84ad617a4bb5884 100644 (file)
@@ -70,7 +70,7 @@ def func(parser, options, args):
         parser.error('incorrect number of arguments')
 
     check_conflicts()
         parser.error('incorrect number of arguments')
 
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if options.author:
         options.authname, options.authemail = name_email(options.author)
 
     if options.author:
         options.authname, options.authemail = name_email(options.author)
index 3acec32780232c0f17fb1971609da7648fde93e0..1fcc2e226fa55225992112632b037fd531fc9598 100644 (file)
@@ -65,10 +65,10 @@ def func(parser, options, args):
     if not options.unapplied:
         check_local_changes()
         check_conflicts()
     if not options.unapplied:
         check_local_changes()
         check_conflicts()
-        check_head_top_equal()
+        check_head_top_equal(crt_series)
 
     commit_str = args[0]
 
     commit_str = args[0]
-    commit_id = git_id(commit_str)
+    commit_id = git_id(crt_series, commit_str)
     commit = git.Commit(commit_id)
 
     if options.fold or options.update:
     commit = git.Commit(commit_id)
 
     if options.fold or options.update:
@@ -84,7 +84,7 @@ def func(parser, options, args):
             patchname = None
 
     if options.parent:
             patchname = None
 
     if options.parent:
-        parent = git_id(options.parent)
+        parent = git_id(crt_series, options.parent)
     else:
         parent = commit.get_parent()
 
     else:
         parent = commit.get_parent()
 
@@ -104,8 +104,8 @@ def func(parser, options, args):
 
         out.done()
     elif options.update:
 
         out.done()
     elif options.update:
-        rev1 = git_id('//bottom')
-        rev2 = git_id('//top')
+        rev1 = git_id(crt_series, '//bottom')
+        rev2 = git_id(crt_series, '//top')
         files = git.barefiles(rev1, rev2).split('\n')
 
         out.start('Updating with commit %s' % commit_id)
         files = git.barefiles(rev1, rev2).split('\n')
 
         out.start('Updating with commit %s' % commit_id)
@@ -163,4 +163,4 @@ def func(parser, options, args):
         else:
             out.done()
 
         else:
             out.done()
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index a1d73e4b69409906024b89023087431472932937..246cc34b45fc2fac76c06aee6b2eec594a62dd07 100644 (file)
@@ -51,7 +51,7 @@ def func(parser, options, args):
     """Pop the topmost patch from the stack
     """
     check_conflicts()
     """Pop the topmost patch from the stack
     """
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if not options.keep:
         check_local_changes()
 
     if not options.keep:
         check_local_changes()
@@ -83,8 +83,8 @@ def func(parser, options, args):
         raise CmdException, 'Cannot pop arbitrary patches with --keep'
 
     topop.reverse()
         raise CmdException, 'Cannot pop arbitrary patches with --keep'
 
     topop.reverse()
-    pop_patches(topop, options.keep)
+    pop_patches(crt_series, topop, options.keep)
     if topush:
     if topush:
-        push_patches(topush)
+        push_patches(crt_series, topush)
 
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index 5fcf2cc06eef144dfe44ecfb7459f39c07ba8f52..e5ee17dd3231f49fb92543608d0d5897501d80ac 100644 (file)
@@ -74,12 +74,12 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     if policy not in ['pull', 'fetch-rebase', 'rebase']:
         raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
 
 
     if policy not in ['pull', 'fetch-rebase', 'rebase']:
         raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
 
-    applied = prepare_rebase()
+    applied = prepare_rebase(crt_series)
 
     # pull the remote changes
     if policy == 'pull':
 
     # pull the remote changes
     if policy == 'pull':
@@ -92,17 +92,17 @@ def func(parser, options, args):
             target = git.fetch_head()
         except git.GitException:
             out.error('Could not find the remote head to rebase onto, pushing any patches back...')
             target = git.fetch_head()
         except git.GitException:
             out.error('Could not find the remote head to rebase onto, pushing any patches back...')
-            post_rebase(applied, False, False)
+            post_rebase(crt_series, applied, False, False)
             raise CmdException, 'Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name()
 
             raise CmdException, 'Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name()
 
-        rebase(target)
+        rebase(crt_series, target)
     elif policy == 'rebase':
     elif policy == 'rebase':
-        rebase(crt_series.get_parent_branch())
+        rebase(crt_series, crt_series.get_parent_branch())
 
 
-    post_rebase(applied, options.nopush, options.merged)
+    post_rebase(crt_series, applied, options.nopush, options.merged)
 
     # maybe tidy up
     if config.get('stgit.keepoptimized') == 'yes':
         git.repack()
 
 
     # maybe tidy up
     if config.get('stgit.keepoptimized') == 'yes':
         git.repack()
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index 4d5de26feded214bce142cfbad886ad19e087525..979835b0b693f280f9cdbaa1a1b566a2c55c1ccc 100644 (file)
@@ -72,13 +72,13 @@ def func(parser, options, args):
             out.done()
         else:
             out.done('patch unchanged')
             out.done()
         else:
             out.done('patch unchanged')
-        print_crt_patch()
+        print_crt_patch(crt_series)
 
         return
 
     check_local_changes()
     check_conflicts()
 
         return
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     unapplied = crt_series.get_unapplied()
     if not unapplied:
 
     unapplied = crt_series.get_unapplied()
     if not unapplied:
@@ -99,6 +99,6 @@ def func(parser, options, args):
     if options.reverse:
         patches.reverse()
 
     if options.reverse:
         patches.reverse()
 
-    push_patches(patches, options.merged)
+    push_patches(crt_series, patches, options.merged)
 
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index bbb3e1223470ae84911174ab503076e1dee7023a..c4d74b799676e7006aa3a92d78a17d6b763611c4 100644 (file)
@@ -48,14 +48,14 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     # ensure an exception is raised before popping on non-existent target
 
     # ensure an exception is raised before popping on non-existent target
-    if git_id(args[0]) == None:
+    if git_id(crt_series, args[0]) == None:
         raise GitException, 'Unknown revision: %s' % args[0]
         
         raise GitException, 'Unknown revision: %s' % args[0]
         
-    applied = prepare_rebase()
-    rebase(args[0])
-    post_rebase(applied, options.nopush, options.merged)
+    applied = prepare_rebase(crt_series)
+    rebase(crt_series, args[0])
+    post_rebase(crt_series, applied, options.nopush, options.merged)
 
 
-    print_crt_patch()
+    print_crt_patch(crt_series)
index f032375fce6381a891f9695a743bb029fea54eea..7cde3922322ae93fe48306b2e68a36181b5c1482 100644 (file)
@@ -73,7 +73,7 @@ def func(parser, options, args):
             raise CmdException, 'No patches applied'
 
     if not options.force:
             raise CmdException, 'No patches applied'
 
     if not options.force:
-        check_head_top_equal()
+        check_head_top_equal(crt_series)
 
     if options.undo:
         out.start('Undoing the refresh of "%s"' % patch)
 
     if options.undo:
         out.start('Undoing the refresh of "%s"' % patch)
@@ -89,10 +89,10 @@ def func(parser, options, args):
         if options.patch:
             applied = crt_series.get_applied()
             between = applied[:applied.index(patch):-1]
         if options.patch:
             applied = crt_series.get_applied()
             between = applied[:applied.index(patch):-1]
-            pop_patches(between, keep = True)
+            pop_patches(crt_series, between, keep = True)
         elif options.update:
         elif options.update:
-            rev1 = git_id('//bottom')
-            rev2 = git_id('//top')
+            rev1 = git_id(crt_series, '//bottom')
+            rev2 = git_id(crt_series, '//top')
             patch_files = git.barefiles(rev1, rev2).split('\n')
             files = [f for f in files if f in patch_files]
             if not files:
             patch_files = git.barefiles(rev1, rev2).split('\n')
             files = [f for f in files if f in patch_files]
             if not files:
@@ -113,7 +113,7 @@ def func(parser, options, args):
 
         if options.patch:
             between.reverse()
 
         if options.patch:
             between.reverse()
-            push_patches(between)
+            push_patches(crt_series, between)
     elif options.annotate:
         # only annotate the top log entry as there is no need to
         # refresh the patch and generate a full commit
     elif options.annotate:
         # only annotate the top log entry as there is no need to
         # refresh the patch and generate a full commit
index 2c758768b754a5a2a2906571263414d2c0fdc2ed..4c6d07e709ccd3396de2381e1c237ced7f37378e 100644 (file)
@@ -195,12 +195,13 @@ def func(parser, options, args):
             raise CmdException, '--graphical not supported with --missing'
 
         if applied:
             raise CmdException, '--graphical not supported with --missing'
 
         if applied:
-            gitk_args = ' %s^..%s' % (git_id(applied[0]), git_id(applied[-1]))
+            gitk_args = ' %s^..%s' % (git_id(crt_series, applied[0]),
+                                      git_id(crt_series, applied[-1]))
         else:
             gitk_args = ''
 
         for p in unapplied:
         else:
             gitk_args = ''
 
         for p in unapplied:
-            patch_id = git_id(p)
+            patch_id = git_id(crt_series, p)
             gitk_args += ' %s^..%s' % (patch_id, patch_id)
 
         if os.system('gitk%s' % gitk_args) != 0:
             gitk_args += ' %s^..%s' % (patch_id, patch_id)
 
         if os.system('gitk%s' % gitk_args) != 0:
index 7efb4e16ccb7e036e1e57c6a956478ce3d5b2c6e..e4e70a5a50131a8543aa7ef928c1217de182dd35 100644 (file)
@@ -69,7 +69,7 @@ def func(parser, options, args):
     else:
         diff_flags = []
 
     else:
         diff_flags = []
 
-    commit_ids = [git_id(patch) for patch in patches]
+    commit_ids = [git_id(crt_series, patch) for patch in patches]
     commit_str = '\n'.join([git.pretty_commit(commit_id, diff_flags=diff_flags)
                             for commit_id in commit_ids])
     if commit_str:
     commit_str = '\n'.join([git.pretty_commit(commit_id, diff_flags=diff_flags)
                             for commit_id in commit_ids])
     if commit_str:
index 737dde033d4542d9ec6f11a3c809ee5562ec5ae1..b1773376f80e8aeb78fb0824d41e22ad7682f7b8 100644 (file)
@@ -45,7 +45,7 @@ def func(parser, options, args):
 
     check_local_changes()
     check_conflicts()
 
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
     oldapplied = crt_series.get_applied()
     unapplied = crt_series.get_unapplied()
 
     oldapplied = crt_series.get_applied()
     unapplied = crt_series.get_unapplied()
@@ -61,10 +61,10 @@ def func(parser, options, args):
         patches = [ crt_series.get_current() ]
 
     crt_series.pop_patch(options.to or oldapplied[0])
         patches = [ crt_series.get_current() ]
 
     crt_series.pop_patch(options.to or oldapplied[0])
-    push_patches(patches)
+    push_patches(crt_series, patches)
 
     if not options.nopush:
         newapplied = crt_series.get_applied()
         def not_reapplied_yet(p):
             return not p in newapplied
 
     if not options.nopush:
         newapplied = crt_series.get_applied()
         def not_reapplied_yet(p):
             return not p in newapplied
-        push_patches(filter(not_reapplied_yet, oldapplied))
+        push_patches(crt_series, filter(not_reapplied_yet, oldapplied))
index 8a31c29301bf2ee5ed6bf28a6d34c6cffe266603..6066f82a63058d2c7b1259c56e2f70cd33e393a8 100644 (file)
@@ -51,7 +51,7 @@ options = [make_option('-a', '--all',
 def __check_all():
     check_local_changes()
     check_conflicts()
 def __check_all():
     check_local_changes()
     check_conflicts()
-    check_head_top_equal()
+    check_head_top_equal(crt_series)
 
 def __branch_merge_patch(remote_series, pname):
     """Merge a patch from a remote branch into the current tree.
 
 def __branch_merge_patch(remote_series, pname):
     """Merge a patch from a remote branch into the current tree.
@@ -131,13 +131,13 @@ def func(parser, options, args):
     # pop to the one before the first patch to be synchronised
     popped = applied[applied.index(sync_patches[0]) + 1:]
     if popped:
     # pop to the one before the first patch to be synchronised
     popped = applied[applied.index(sync_patches[0]) + 1:]
     if popped:
-        pop_patches(popped[::-1])
+        pop_patches(crt_series, popped[::-1])
 
     for p in sync_patches:
         if p in popped:
             # push to this patch
             idx = popped.index(p) + 1
 
     for p in sync_patches:
         if p in popped:
             # push to this patch
             idx = popped.index(p) + 1
-            push_patches(popped[:idx])
+            push_patches(crt_series, popped[:idx])
             del popped[:idx]
 
         # the actual sync
             del popped[:idx]
 
         # the actual sync
@@ -166,4 +166,4 @@ def func(parser, options, args):
 
     # push the remaining patches
     if popped:
 
     # push the remaining patches
     if popped:
-        push_patches(popped)
+        push_patches(crt_series, popped)
index a23ae20d8bc4c39fc0e60edfe4eed584cdf37950..8e62d23b5c53ddac2f24325ae2bc8a9d9d084501 100644 (file)
@@ -66,7 +66,7 @@ def func(parser, options, args):
         if len(args) != 0:
             parser.error('cannot specify patch name with --to')
         patch_nr = patchnames = None
         if len(args) != 0:
             parser.error('cannot specify patch name with --to')
         patch_nr = patchnames = None
-        to_commit = git_id(options.to)
+        to_commit = git_id(crt_series, options.to)
     elif options.number:
         if options.number <= 0:
             parser.error('invalid value passed to --number')
     elif options.number:
         if options.number <= 0:
             parser.error('invalid value passed to --number')
index db327f19f208409d9be0773d4c89db0ff1270ce2..e8242c2783bddd18122b345512f9e155495538f7 100644 (file)
@@ -277,7 +277,6 @@ def main():
                 command.crt_series = Series(options.branch)
             else:
                 command.crt_series = Series()
                 command.crt_series = Series(options.branch)
             else:
                 command.crt_series = Series()
-            stgit.commands.common.crt_series = command.crt_series
 
         command.func(parser, options, args)
     except (StgException, IOError, ParsingError, NoSectionError), err:
 
         command.func(parser, options, args)
     except (StgException, IOError, ParsingError, NoSectionError), err: