changeset 38988:35bc4b6e132d

fix: correctly set wdirwritten given that the dict item is deleted Differential Revision: https://phab.mercurial-scm.org/D4146
author Danny Hooper <hooper@google.com>
date Mon, 06 Aug 2018 16:00:00 -0700
parents b0c591950e51
children 6bfd1054d867
files hgext/fix.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fix.py	Mon Aug 06 14:30:27 2018 -0700
+++ b/hgext/fix.py	Mon Aug 06 16:00:00 2018 -0700
@@ -162,6 +162,7 @@
         # it makes the results more easily reproducible.
         filedata = collections.defaultdict(dict)
         replacements = {}
+        wdirwritten = False
         commitorder = sorted(revstofix, reverse=True)
         with ui.makeprogress(topic=_('fixing'), unit=_('files'),
                              total=sum(numitems.values())) as progress:
@@ -179,11 +180,12 @@
                     ctx = repo[rev]
                     if rev == wdirrev:
                         writeworkingdir(repo, ctx, filedata[rev], replacements)
+                        wdirwritten = bool(filedata[rev])
                     else:
                         replacerev(ui, repo, ctx, filedata[rev], replacements)
                     del filedata[rev]
 
-        cleanup(repo, replacements, bool(filedata[wdirrev]))
+        cleanup(repo, replacements, wdirwritten)
 
 def cleanup(repo, replacements, wdirwritten):
     """Calls scmutil.cleanupnodes() with the given replacements.