Mercurial > hg
changeset 41236:44a51c1c8e17
narrow: move copytonarrowspec() out of setnarrowpats()
I think it was a mistake to write the working copy's narrowspec every
time the store narrowspec is written. This starts separating those
actions.
Differential Revision: https://phab.mercurial-scm.org/D5509
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 29 Dec 2018 23:40:18 -0800 |
parents | a2ae27993e16 |
children | ad9ab2523149 |
files | hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py mercurial/hg.py mercurial/localrepo.py tests/test-narrow-expanddirstate.t |
diffstat | 5 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/narrow/narrowbundle2.py Sat Dec 29 23:09:07 2018 -0800 +++ b/hgext/narrow/narrowbundle2.py Sat Dec 29 23:40:18 2018 -0800 @@ -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):
--- a/hgext/narrow/narrowcommands.py Sat Dec 29 23:09:07 2018 -0800 +++ b/hgext/narrow/narrowcommands.py Sat Dec 29 23:40:18 2018 -0800 @@ -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
--- a/mercurial/hg.py Sat Dec 29 23:09:07 2018 -0800 +++ b/mercurial/hg.py Sat Dec 29 23:40:18 2018 -0800 @@ -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)
--- a/mercurial/localrepo.py Sat Dec 29 23:09:07 2018 -0800 +++ b/mercurial/localrepo.py Sat Dec 29 23:40:18 2018 -0800 @@ -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):
--- a/tests/test-narrow-expanddirstate.t Sat Dec 29 23:09:07 2018 -0800 +++ b/tests/test-narrow-expanddirstate.t Sat Dec 29 23:40:18 2018 -0800 @@ -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):