D5506: narrow: copy store narrowspec to working copy immediately
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Jan 10 21:51:18 UTC 2019
martinvonz updated this revision to Diff 13146.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5506?vs=13055&id=13146
REVISION DETAIL
https://phab.mercurial-scm.org/D5506
AFFECTED FILES
hgext/narrow/narrowcommands.py
mercurial/hg.py
mercurial/localrepo.py
mercurial/narrowspec.py
CHANGE DETAILS
diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -161,17 +161,9 @@
spec = format(includepats, excludepats)
repo.svfs.write(FILENAME, spec)
-def copytoworkingcopy(repo, tr):
- if tr:
- def write(file):
- spec = repo.svfs.read(FILENAME)
- file.write(spec)
- file.close()
- tr.addfilegenerator('narrowspec', (DIRSTATE_FILENAME,), write,
- location='plain')
- else:
- spec = repo.svfs.read(FILENAME)
- repo.vfs.write(DIRSTATE_FILENAME, spec)
+def copytoworkingcopy(repo):
+ spec = repo.svfs.read(FILENAME)
+ repo.vfs.write(DIRSTATE_FILENAME, spec)
def savebackup(repo, backupname):
if repository.NARROW_REQUIREMENT not in repo.requirements:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1252,7 +1252,7 @@
def setnarrowpats(self, newincludes, newexcludes):
narrowspec.save(self, newincludes, newexcludes)
- narrowspec.copytoworkingcopy(self, self.currenttransaction())
+ narrowspec.copytoworkingcopy(self)
self.invalidate(clearfilecache=True)
# So the next access won't be considered a conflict
# TODO: It seems like there should be a way of doing this that
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -334,7 +334,7 @@
destrepo.vfs.write('hgrc', util.tonativeeol(template % default))
if repositorymod.NARROW_REQUIREMENT in sourcerepo.requirements:
with destrepo.wlock():
- narrowspec.copytoworkingcopy(destrepo, None)
+ narrowspec.copytoworkingcopy(destrepo)
def _postshareupdate(repo, update, checkout=None):
"""Maybe perform a working directory update after a shared repo is created.
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -432,9 +432,9 @@
return 0
if update_working_copy:
- with repo.wlock(), repo.lock(), repo.transaction('narrow-wc') as tr:
+ with repo.wlock(), repo.lock(), repo.transaction('narrow-wc'):
narrowspec.updateworkingcopy(repo)
- narrowspec.copytoworkingcopy(repo, tr)
+ narrowspec.copytoworkingcopy(repo)
return 0
if not widening and not narrowing:
To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list