Patchwork D5509: narrow: move copytonarrowspec() out of setnarrowpats()

login
register
mail settings
Submitter phabricator
Date Jan. 7, 2019, 7:03 p.m.
Message ID <4f5b2a1242efacfffc64e490ef0e6ae8@localhost.localdomain>
Download mbox | patch
Permalink /patch/37542/
State Not Applicable
Headers show

Comments

phabricator - Jan. 7, 2019, 7:03 p.m.
martinvonz updated this revision to Diff 13058.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5509?vs=13037&id=13058

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowcommands.py
  mercurial/hg.py
  mercurial/localrepo.py
  tests/test-narrow-expanddirstate.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-narrow-expanddirstate.t b/tests/test-narrow-expanddirstate.t
--- a/tests/test-narrow-expanddirstate.t
+++ b/tests/test-narrow-expanddirstate.t
@@ -71,6 +71,7 @@ 
   >   if not repo.currenttransaction():
   >     ui.develwarn(b'expandnarrowspec called outside of transaction!')
   >   repo.setnarrowpats(includes, excludes)
+  >   narrowspec.copytoworkingcopy(repo)
   >   newmatcher = narrowspec.match(repo.root, includes, excludes)
   >   added = matchmod.differencematcher(newmatcher, currentmatcher)
   >   for f in repo[b'.'].manifest().walk(added):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1259,7 +1259,6 @@ 
 
     def setnarrowpats(self, newincludes, newexcludes):
         narrowspec.save(self, newincludes, newexcludes)
-        narrowspec.copytoworkingcopy(self)
         self.invalidate(clearfilecache=True)
 
     def __getitem__(self, changeid):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -737,6 +737,7 @@ 
                 if narrow:
                     with local.wlock(), local.lock():
                         local.setnarrowpats(storeincludepats, storeexcludepats)
+                        narrowspec.copytoworkingcopy(local)
 
                 u = util.url(abspath)
                 defaulturl = bytes(u)
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -245,6 +245,7 @@ 
             # Update narrowspec before removing revlogs, so repo won't be
             # corrupt in case of crash
             repo.setnarrowpats(newincludes, newexcludes)
+            narrowspec.copytoworkingcopy(repo)
 
             for f in todelete:
                 ui.status(_('deleting %s\n') % f)
@@ -316,6 +317,7 @@ 
                         transactiongetter=tgetter)
 
         repo.setnewnarrowpats()
+        narrowspec.copytoworkingcopy(repo)
         actions = merge.emptyactions()
         addgaction = actions['g'].append
 
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -151,6 +151,7 @@ 
         op.repo.requirements.add(repository.NARROW_REQUIREMENT)
         op.repo._writerequirements()
     op.repo.setnarrowpats(includepats, excludepats)
+    narrowspec.copytoworkingcopy(op.repo)
 
 @bundle2.parthandler(_CHANGESPECPART)
 def _handlechangespec(op, inpart):