mq: qrepo.add(mq.added) inside save_dirty inside of doing it manually stable
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Tue, 13 Jul 2010 22:30:01 +0900
branchstable
changeset 11546 134eb1c97e94
parent 11545 db9d16233787
child 11550 14e90cc3a296
child 11552 164eb14a4a7c
mq: qrepo.add(mq.added) inside save_dirty inside of doing it manually This should make the MQ API more transparent: callers only have to call save_dirty, and no mq.added magic or knowledge is required.
hgext/mq.py
hgext/rebase.py
--- a/hgext/mq.py	Tue Jul 06 22:22:18 2010 -0300
+++ b/hgext/mq.py	Tue Jul 13 22:30:01 2010 +0900
@@ -476,6 +476,11 @@
             write_list(self.full_series, self.series_path)
         if self.guards_dirty:
             write_list(self.active_guards, self.guards_path)
+        if self.added:
+            qrepo = self.qrepo()
+            if qrepo:
+                qrepo[None].add(self.added)
+            self.added = []
 
     def removeundo(self, repo):
         undo = repo.sjoin('undo')
@@ -1809,10 +1814,6 @@
               git=opts['git'])
     finally:
         q.save_dirty()
-        qrepo = q.qrepo()
-        if qrepo:
-            qrepo[None].add(q.added)
-        q.added = []
 
     if opts.get('push') and not opts.get('rev'):
         return q.push(repo, None)
--- a/hgext/rebase.py	Tue Jul 06 22:22:18 2010 -0300
+++ b/hgext/rebase.py	Tue Jul 13 22:30:01 2010 +0900
@@ -366,10 +366,6 @@
                 mq.qimport(repo, (), patchname=name, git=isgit,
                                 rev=[str(state[rev])])
         mq.save_dirty()
-        qrepo = mq.qrepo()
-        if qrepo:
-            qrepo[None].add(mq.added)
-        mq.added = []
 
 def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
                                                                 external):