Show More
@@ -12,7 +12,6 b' from mercurial import (' | |||||
12 | error, |
|
12 | error, | |
13 | match as matchmod, |
|
13 | match as matchmod, | |
14 | narrowspec, |
|
14 | narrowspec, | |
15 | util as hgutil, |
|
|||
16 | ) |
|
15 | ) | |
17 |
|
16 | |||
18 | def wrapdirstate(repo, dirstate): |
|
17 | def wrapdirstate(repo, dirstate): | |
@@ -79,21 +78,17 b' def wrapdirstate(repo, dirstate):' | |||||
79 | super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles) |
|
78 | super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles) | |
80 |
|
79 | |||
81 | def restorebackup(self, tr, backupname): |
|
80 | def restorebackup(self, tr, backupname): | |
82 | self._opener.rename(_narrowbackupname(backupname), |
|
81 | narrowspec.restorebackup(self._opener, | |
83 |
narrow |
|
82 | _narrowbackupname(backupname)) | |
84 | super(narrowdirstate, self).restorebackup(tr, backupname) |
|
83 | super(narrowdirstate, self).restorebackup(tr, backupname) | |
85 |
|
84 | |||
86 | def savebackup(self, tr, backupname): |
|
85 | def savebackup(self, tr, backupname): | |
87 | super(narrowdirstate, self).savebackup(tr, backupname) |
|
86 | super(narrowdirstate, self).savebackup(tr, backupname) | |
88 |
|
87 | narrowspec.savebackup(self._opener, _narrowbackupname(backupname)) | ||
89 | narrowbackupname = _narrowbackupname(backupname) |
|
|||
90 | self._opener.tryunlink(narrowbackupname) |
|
|||
91 | hgutil.copyfile(self._opener.join(narrowspec.FILENAME), |
|
|||
92 | self._opener.join(narrowbackupname), hardlink=True) |
|
|||
93 |
|
88 | |||
94 | def clearbackup(self, tr, backupname): |
|
89 | def clearbackup(self, tr, backupname): | |
95 | super(narrowdirstate, self).clearbackup(tr, backupname) |
|
90 | super(narrowdirstate, self).clearbackup(tr, backupname) | |
96 |
self._opener |
|
91 | narrowspec.clearbackup(self._opener, _narrowbackupname(backupname)) | |
97 |
|
92 | |||
98 | dirstate.__class__ = narrowdirstate |
|
93 | dirstate.__class__ = narrowdirstate | |
99 | return dirstate |
|
94 | return dirstate |
@@ -145,6 +145,16 b' def save(repo, includepats, excludepats)' | |||||
145 | spec = format(includepats, excludepats) |
|
145 | spec = format(includepats, excludepats) | |
146 | repo.vfs.write(FILENAME, spec) |
|
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 | def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): |
|
158 | def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): | |
149 | r""" Restricts the patterns according to repo settings, |
|
159 | r""" Restricts the patterns according to repo settings, | |
150 | results in a logical AND operation |
|
160 | results in a logical AND operation |
General Comments 0
You need to be logged in to leave comments.
Login now