diff hgext/mq.py @ 15880:02b135558756

mq: make qsave implementation more explicit It wasn't obvious from the code how qsave mocked around with .hg/patches and .hg/patches.? and what was going on. This makes it more explicit so it will survive future refactorings.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 11 Jan 2012 02:29:55 +0100
parents 710e6bf15538
children 3862369cf9b9
line wrap: on
line diff
--- a/hgext/mq.py	Wed Jan 11 02:28:36 2012 +0100
+++ b/hgext/mq.py	Wed Jan 11 02:29:55 2012 +0100
@@ -2652,7 +2652,7 @@
     ret = q.save(repo, msg=message)
     if ret:
         return ret
-    q.savedirty()
+    q.savedirty() # save to .hg/patches before copying
     if opts.get('copy'):
         path = q.path
         if opts.get('name'):
@@ -2669,10 +2669,9 @@
         ui.warn(_("copy %s to %s\n") % (path, newpath))
         util.copyfiles(path, newpath)
     if opts.get('empty'):
-        try:
-            os.unlink(q.join(q.statuspath))
-        except:
-            pass
+        del q.applied[:]
+        q.applieddirty = True
+        q.savedirty()
     return 0
 
 @command("strip",