comparison hgext/shelve.py @ 19970:065e6f1c9259 stable

shelve: remove unused variable assignment Fix test-check-pyflakes.t error after 1d7a36ff2615. This patch replaces "readshelvedfiles()" invocation by "shelvedfile().exists()" check and aborting, because it is required only to ensure that shelved changes corresponded to specified name exist after invocation. This patch also remove definition of "readshelvedfiles()" itself, because it is invoked only from the line removed by this patch.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 02 Nov 2013 04:49:42 +0900
parents ff38dfbce4f8
children 99c4b8f79324
comparison
equal deleted inserted replaced
19969:ad9db007656f 19970:065e6f1c9259
347 git=True): 347 git=True):
348 ui.write(chunk, label=label) 348 ui.write(chunk, label=label)
349 finally: 349 finally:
350 fp.close() 350 fp.close()
351 351
352 def readshelvedfiles(repo, basename):
353 """return the list of files touched in a shelve"""
354 fp = shelvedfile(repo, basename, 'files').opener()
355 return fp.read().split('\0')
356
357 def checkparents(repo, state): 352 def checkparents(repo, state):
358 """check parent while resuming an unshelve""" 353 """check parent while resuming an unshelve"""
359 if state.parents != repo.dirstate.parents(): 354 if state.parents != repo.dirstate.parents():
360 raise util.Abort(_('working directory parents do not match unshelve ' 355 raise util.Abort(_('working directory parents do not match unshelve '
361 'state')) 356 'state'))
521 basename = util.split(shelved[0][1])[1] 516 basename = util.split(shelved[0][1])[1]
522 ui.status(_("unshelving change '%s'\n") % basename) 517 ui.status(_("unshelving change '%s'\n") % basename)
523 else: 518 else:
524 basename = shelved[0] 519 basename = shelved[0]
525 520
526 shelvedfiles = readshelvedfiles(repo, basename) 521 if not shelvedfile(repo, basename, 'files').exists():
522 raise util.Abort(_("shelved change '%s' not found") % basename)
527 523
528 wlock = lock = tr = None 524 wlock = lock = tr = None
529 try: 525 try:
530 lock = repo.lock() 526 lock = repo.lock()
531 wlock = repo.wlock() 527 wlock = repo.wlock()