##// END OF EJS Templates
narrow: extract part of narrowspec backup to core...
Martin von Zweigbergk -
r38872:fed6fe85 default
parent child Browse files
Show More
@@ -12,7 +12,6 b' from mercurial import ('
12 12 error,
13 13 match as matchmod,
14 14 narrowspec,
15 util as hgutil,
16 15 )
17 16
18 17 def wrapdirstate(repo, dirstate):
@@ -79,21 +78,17 b' def wrapdirstate(repo, dirstate):'
79 78 super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles)
80 79
81 80 def restorebackup(self, tr, backupname):
82 self._opener.rename(_narrowbackupname(backupname),
83 narrowspec.FILENAME, checkambig=True)
81 narrowspec.restorebackup(self._opener,
82 _narrowbackupname(backupname))
84 83 super(narrowdirstate, self).restorebackup(tr, backupname)
85 84
86 85 def savebackup(self, tr, backupname):
87 86 super(narrowdirstate, self).savebackup(tr, backupname)
88
89 narrowbackupname = _narrowbackupname(backupname)
90 self._opener.tryunlink(narrowbackupname)
91 hgutil.copyfile(self._opener.join(narrowspec.FILENAME),
92 self._opener.join(narrowbackupname), hardlink=True)
87 narrowspec.savebackup(self._opener, _narrowbackupname(backupname))
93 88
94 89 def clearbackup(self, tr, backupname):
95 90 super(narrowdirstate, self).clearbackup(tr, backupname)
96 self._opener.unlink(_narrowbackupname(backupname))
91 narrowspec.clearbackup(self._opener, _narrowbackupname(backupname))
97 92
98 93 dirstate.__class__ = narrowdirstate
99 94 return dirstate
@@ -145,6 +145,16 b' def save(repo, includepats, excludepats)'
145 145 spec = format(includepats, excludepats)
146 146 repo.vfs.write(FILENAME, spec)
147 147
148 def savebackup(vfs, backupname):
149 vfs.tryunlink(backupname)
150 util.copyfile(vfs.join(FILENAME), vfs.join(backupname), hardlink=True)
151
152 def restorebackup(vfs, backupname):
153 vfs.rename(backupname, FILENAME, checkambig=True)
154
155 def clearbackup(vfs, backupname):
156 vfs.unlink(backupname)
157
148 158 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
149 159 r""" Restricts the patterns according to repo settings,
150 160 results in a logical AND operation
General Comments 0
You need to be logged in to leave comments. Login now