changeset 11546:134eb1c97e94 stable

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.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Tue, 13 Jul 2010 22:30:01 +0900
parents db9d16233787
children 14e90cc3a296 164eb14a4a7c
files hgext/mq.py hgext/rebase.py
diffstat 2 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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):