Patchwork D5467: narrow: when narrowing, write new narrowspec before removing revlogs

login
register
mail settings
Submitter phabricator
Date Dec. 20, 2018, 7:01 p.m.
Message ID <cd732fab9a3c14c6b699dba865924a33@localhost.localdomain>
Download mbox | patch
Permalink /patch/37285/
State Not Applicable
Headers show

Comments

phabricator - Dec. 20, 2018, 7:01 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGddedd95b09f1: narrow: when narrowing, write new narrowspec before removing revlogs (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5467?vs=12931&id=12936

REVISION DETAIL
  https://phab.mercurial-scm.org/D5467

AFFECTED FILES
  hgext/narrow/narrowcommands.py

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -242,14 +242,17 @@ 
         repo.destroying()
 
         with repo.transaction("narrowing"):
+            # Update narrowspec before removing revlogs, so repo won't be
+            # corrupt in case of crash
+            repo.setnarrowpats(newincludes, newexcludes)
+
             for f in todelete:
                 ui.status(_('deleting %s\n') % f)
                 util.unlinkpath(repo.svfs.join(f))
                 repo.store.markremoved(f)
 
             _narrowcleanupwdir(repo, oldincludes, oldexcludes, newincludes,
                                newexcludes, oldmatch, newmatch)
-            repo.setnarrowpats(newincludes, newexcludes)
 
         repo.destroyed()