Mercurial > public > mercurial-scm > hg-stable
diff mercurial/narrowspec.py @ 38911:576eef1ab43d
narrow: move .hg/narrowspec to .hg/store/narrowspec (BC)
The narrowspec is more closely related to the store than to the
working copy. For example, if the narrowspec changes, the set of
revlogs also needs to change (the working copy may change, but that
depends on which commit is checked out). Also, when using the share
extension, the narrowspec needs to be shared along with the
store. This patch therefore moves the narrowspec into the store/
directory.
This is clearly a breaking change, but I haven't bothered trying to
fall back to reading the narrowspec from the old location (.hg/),
because there are very few users of narrow out there. (We'll add a
temporary hack to our Google-internal extension to handle the
migration.)
Differential Revision: https://phab.mercurial-scm.org/D4099
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 02 Aug 2018 14:57:20 -0700 |
parents | 204e074c188e |
children | 2675d561f5cb |
line wrap: on
line diff
--- a/mercurial/narrowspec.py Fri Aug 03 13:53:02 2018 -0700 +++ b/mercurial/narrowspec.py Thu Aug 02 14:57:20 2018 -0700 @@ -108,7 +108,7 @@ def load(repo): try: - spec = repo.vfs.read(FILENAME) + spec = repo.svfs.read(FILENAME) except IOError as e: # Treat "narrowspec does not exist" the same as "narrowspec file exists # and is empty". @@ -125,19 +125,19 @@ def save(repo, includepats, excludepats): spec = format(includepats, excludepats) - repo.vfs.write(FILENAME, spec) + repo.svfs.write(FILENAME, spec) def savebackup(repo, backupname): if repository.NARROW_REQUIREMENT not in repo.requirements: return vfs = repo.vfs vfs.tryunlink(backupname) - util.copyfile(vfs.join(FILENAME), vfs.join(backupname), hardlink=True) + util.copyfile(repo.svfs.join(FILENAME), vfs.join(backupname), hardlink=True) def restorebackup(repo, backupname): if repository.NARROW_REQUIREMENT not in repo.requirements: return - repo.vfs.rename(backupname, FILENAME) + util.rename(repo.vfs.join(backupname), repo.svfs.join(FILENAME)) def clearbackup(repo, backupname): if repository.NARROW_REQUIREMENT not in repo.requirements: