Mercurial > hg-stable
diff mercurial/narrowspec.py @ 38875:fed6fe856333
narrow: extract part of narrowspec backup to core
Just a little preparation for the next patch.
Differential Revision: https://phab.mercurial-scm.org/D4095
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 03 Aug 2018 10:56:07 -0700 |
parents | d851951b421c |
children | f64ebe7d2259 |
line wrap: on
line diff
--- a/mercurial/narrowspec.py Fri Aug 03 11:02:34 2018 -0700 +++ b/mercurial/narrowspec.py Fri Aug 03 10:56:07 2018 -0700 @@ -145,6 +145,16 @@ spec = format(includepats, excludepats) repo.vfs.write(FILENAME, spec) +def savebackup(vfs, backupname): + vfs.tryunlink(backupname) + util.copyfile(vfs.join(FILENAME), vfs.join(backupname), hardlink=True) + +def restorebackup(vfs, backupname): + vfs.rename(backupname, FILENAME, checkambig=True) + +def clearbackup(vfs, backupname): + vfs.unlink(backupname) + def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): r""" Restricts the patterns according to repo settings, results in a logical AND operation