qpop/qrefresh: update self.applied before calling strip
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Sun, 03 Feb 2008 21:03:46 -0200
changeset 5987 f2201aee3dc8
parent 5986 a732eebf1958
child 5988 ee317dbfb9d0
qpop/qrefresh: update self.applied before calling strip This will be important for the next patch, which may end up using this variable during an addchangegroup caused by strip.
hgext/mq.py
--- a/hgext/mq.py	Sun Feb 03 21:03:46 2008 -0200
+++ b/hgext/mq.py	Sun Feb 03 21:03:46 2008 -0200
@@ -901,8 +901,8 @@
                     except: pass
                     repo.dirstate.forget(f)
                 repo.dirstate.setparents(qp, revlog.nullid)
+            del self.applied[start:end]
             self.strip(repo, rev, update=False, backup='strip')
-            del self.applied[start:end]
             if len(self.applied):
                 self.ui.write("Now at: %s\n" % self.applied[-1].name)
             else:
@@ -1086,12 +1086,13 @@
                 else:
                     message = msg
 
+                self.applied.pop()
+                self.applied_dirty = 1
                 self.strip(repo, top, update=False,
                            backup='strip')
                 n = repo.commit(filelist, message, changes[1], match=matchfn,
                                 force=1)
-                self.applied[-1] = statusentry(revlog.hex(n), patchfn)
-                self.applied_dirty = 1
+                self.applied.append(statusentry(revlog.hex(n), patchfn))
                 self.removeundo(repo)
             else:
                 self.printdiff(repo, patchparent, fp=patchf)