comparison mercurial/narrowspec.py @ 41229:50ca531f1f24

narrow: copy store narrowspec to working copy immediately We no longer need to delay it until the end of the transaction since we now restore a backup if the transaction aborts. Differential Revision: https://phab.mercurial-scm.org/D5506
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 29 Dec 2018 23:01:12 -0800
parents b74481038438
children 8c366af085f4
comparison
equal deleted inserted replaced
41228:3b35ebdb9f8c 41229:50ca531f1f24
159 validatepatterns(includepats) 159 validatepatterns(includepats)
160 validatepatterns(excludepats) 160 validatepatterns(excludepats)
161 spec = format(includepats, excludepats) 161 spec = format(includepats, excludepats)
162 repo.svfs.write(FILENAME, spec) 162 repo.svfs.write(FILENAME, spec)
163 163
164 def copytoworkingcopy(repo, tr): 164 def copytoworkingcopy(repo):
165 if tr: 165 spec = repo.svfs.read(FILENAME)
166 def write(file): 166 repo.vfs.write(DIRSTATE_FILENAME, spec)
167 spec = repo.svfs.read(FILENAME)
168 file.write(spec)
169 file.close()
170 tr.addfilegenerator('narrowspec', (DIRSTATE_FILENAME,), write,
171 location='plain')
172 else:
173 spec = repo.svfs.read(FILENAME)
174 repo.vfs.write(DIRSTATE_FILENAME, spec)
175 167
176 def savebackup(repo, backupname): 168 def savebackup(repo, backupname):
177 if repository.NARROW_REQUIREMENT not in repo.requirements: 169 if repository.NARROW_REQUIREMENT not in repo.requirements:
178 return 170 return
179 svfs = repo.svfs 171 svfs = repo.svfs