##// END OF EJS Templates
shelve: avoid writing file that is never read from...
Martin von Zweigbergk -
r22581:c5ece02f default
parent child Browse files
Show More
@@ -37,7 +37,7 b" testedwith = 'internal'"
37 37 class shelvedfile(object):
38 38 """Helper for the file storing a single shelve
39 39
40 Handles common functions on shelve files (.hg/.files/.patch) using
40 Handles common functions on shelve files (.hg/.patch) using
41 41 the vfs layer"""
42 42 def __init__(self, repo, name, filetype=None):
43 43 self.repo = repo
@@ -169,12 +169,7 b' def createcmd(ui, repo, pats, opts):'
169 169 for i in xrange(1, 100):
170 170 yield '%s-%02d' % (label, i)
171 171
172 shelvedfiles = []
173
174 172 def commitfunc(ui, repo, message, match, opts):
175 # check modified, added, removed, deleted only
176 for flist in repo.status(match=match)[:4]:
177 shelvedfiles.extend(flist)
178 173 hasmq = util.safehasattr(repo, 'mq')
179 174 if hasmq:
180 175 saved, repo.mq.checkapplied = repo.mq.checkapplied, False
@@ -239,9 +234,6 b' def createcmd(ui, repo, pats, opts):'
239 234 ui.status(_("nothing changed\n"))
240 235 return 1
241 236
242 fp = shelvedfile(repo, name, 'files').opener('wb')
243 fp.write('\0'.join(shelvedfiles))
244
245 237 bases = list(publicancestors(repo[node]))
246 238 cg = changegroup.changegroupsubset(repo, bases, [node], 'shelve')
247 239 shelvedfile(repo, name, 'hg').writebundle(cg)
@@ -271,7 +263,7 b' def cleanupcmd(ui, repo):'
271 263 wlock = repo.wlock()
272 264 for (name, _type) in repo.vfs.readdir('shelved'):
273 265 suffix = name.rsplit('.', 1)[-1]
274 if suffix in ('hg', 'files', 'patch'):
266 if suffix in ('hg', 'patch'):
275 267 shelvedfile(repo, name).unlink()
276 268 finally:
277 269 lockmod.release(wlock)
@@ -285,7 +277,7 b' def deletecmd(ui, repo, pats):'
285 277 wlock = repo.wlock()
286 278 try:
287 279 for name in pats:
288 for suffix in 'hg files patch'.split():
280 for suffix in 'hg patch'.split():
289 281 shelvedfile(repo, name, suffix).unlink()
290 282 except OSError, err:
291 283 if err.errno != errno.ENOENT:
@@ -424,7 +416,7 b' def mergefiles(ui, repo, wctx, shelvectx'
424 416 def unshelvecleanup(ui, repo, name, opts):
425 417 """remove related files after an unshelve"""
426 418 if not opts['keep']:
427 for filetype in 'hg files patch'.split():
419 for filetype in 'hg patch'.split():
428 420 shelvedfile(repo, name, filetype).unlink()
429 421
430 422 def unshelvecontinue(ui, repo, state, opts):
@@ -533,7 +525,7 b' def unshelve(ui, repo, *shelved, **opts)'
533 525 else:
534 526 basename = shelved[0]
535 527
536 if not shelvedfile(repo, basename, 'files').exists():
528 if not shelvedfile(repo, basename, 'patch').exists():
537 529 raise util.Abort(_("shelved change '%s' not found") % basename)
538 530
539 531 oldquiet = ui.quiet
General Comments 0
You need to be logged in to leave comments. Login now