rebase: small cosmetic cleanups stable
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Mon, 12 Jul 2010 19:04:07 +0900
branchstable
changeset 11537 0a044e5ff489
parent 11536 92342fa9fbd8
child 11538 16fe98804fd8
rebase: small cosmetic cleanups
hgext/rebase.py
--- a/hgext/rebase.py	Mon Jul 12 09:19:28 2010 +0300
+++ b/hgext/rebase.py	Mon Jul 12 19:04:07 2010 +0900
@@ -271,9 +271,9 @@
     'Commit the changes and store useful information in extra'
     try:
         repo.dirstate.setparents(repo[p1].node(), repo[p2].node())
+        ctx = repo[rev]
         if commitmsg is None:
-            commitmsg = repo[rev].description()
-        ctx = repo[rev]
+            commitmsg = ctx.description()
         extra = {'rebase_source': ctx.hex()}
         if extrafn:
             extrafn(ctx, extra)
@@ -347,27 +347,29 @@
 def updatemq(repo, state, skipped, **opts):
     'Update rebased mq patches - finalize and then import them'
     mqrebase = {}
-    for p in repo.mq.applied:
-        if repo[p.node].rev() in state:
+    mq = repo.mq
+    for p in mq.applied:
+        rev = repo[p.node].rev()
+        if rev in state:
             repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' %
-                                        (repo[p.node].rev(), p.name))
-            mqrebase[repo[p.node].rev()] = (p.name, isagitpatch(repo, p.name))
+                                        (rev, p.name))
+            mqrebase[rev] = (p.name, isagitpatch(repo, p.name))
 
     if mqrebase:
-        repo.mq.finish(repo, mqrebase.keys())
+        mq.finish(repo, mqrebase.keys())
 
         # We must start import from the newest revision
         for rev in sorted(mqrebase, reverse=True):
             if rev not in skipped:
-                repo.ui.debug('import mq patch %d (%s)\n'
-                              % (state[rev], mqrebase[rev][0]))
-                repo.mq.qimport(repo, (), patchname=mqrebase[rev][0],
-                            git=mqrebase[rev][1],rev=[str(state[rev])])
-        repo.mq.save_dirty()
-        qrepo = repo.mq.qrepo()
+                name, isgit = mqrebase[rev]
+                repo.ui.debug('import mq patch %d (%s)\n' % (state[rev], name))
+                mq.qimport(repo, (), patchname=name, git=isgit,
+                                rev=[str(state[rev])])
+        mq.save_dirty()
+        qrepo = mq.qrepo()
         if qrepo:
-            qrepo[None].add(repo.mq.added)
-        repo.mq.added = []
+            qrepo[None].add(mq.added)
+        mq.added = []
 
 def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
                                                                 external):