narrow: drop explicit dirstate write
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 07 Jan 2019 00:37:46 -0800
changeset 41176 4475322b7533
parent 41175 9bc7ec924234
child 41177 5838afea8213
narrow: drop explicit dirstate write The dirstate is written when the wlock is released, so we don't need to write it explicitly in updateworkingcopy(). I don't know why I put it there in the first place (tests pass without it even in the commit that introduced it). Differential Revision: https://phab.mercurial-scm.org/D5515
hgext/narrow/narrowcommands.py
mercurial/narrowspec.py
--- a/hgext/narrow/narrowcommands.py	Wed Jan 09 18:00:20 2019 -0500
+++ b/hgext/narrow/narrowcommands.py	Mon Jan 07 00:37:46 2019 -0800
@@ -433,7 +433,7 @@
 
     if update_working_copy:
         with repo.wlock(), repo.lock(), repo.transaction('narrow-wc') as tr:
-            narrowspec.updateworkingcopy(repo, tr)
+            narrowspec.updateworkingcopy(repo)
             narrowspec.copytoworkingcopy(repo, tr)
         return 0
 
--- a/mercurial/narrowspec.py	Wed Jan 09 18:00:20 2019 -0500
+++ b/mercurial/narrowspec.py	Mon Jan 07 00:37:46 2019 -0800
@@ -266,7 +266,7 @@
         raise error.Abort(_("working copy's narrowspec is stale"),
                           hint=_("run 'hg tracked --update-working-copy'"))
 
-def updateworkingcopy(repo, tr):
+def updateworkingcopy(repo):
     oldspec = repo.vfs.tryread(DIRSTATE_FILENAME)
     newspec = repo.svfs.tryread(FILENAME)
 
@@ -294,5 +294,3 @@
     for f in newfiles:
         ds.normallookup(f)
     _writeaddedfiles(repo, pctx, newfiles)
-
-    ds.write(tr)