##// END OF EJS Templates
histedit: replace hexshort lambda with node.short
Augie Fackler -
r17129:ead4eb5b default
parent child Browse files
Show More
@@ -396,13 +396,11 b' def histedit(ui, repo, *parent, **opts):'
396 (parentctx, created_, replaced_, tmpnodes_) = actiontable[action](
396 (parentctx, created_, replaced_, tmpnodes_) = actiontable[action](
397 ui, repo, parentctx, ha, opts)
397 ui, repo, parentctx, ha, opts)
398
398
399 hexshort = lambda x: node.hex(x)[:12]
400
401 if replaced_:
399 if replaced_:
402 clen, rlen = len(created_), len(replaced_)
400 clen, rlen = len(created_), len(replaced_)
403 if clen == rlen == 1:
401 if clen == rlen == 1:
404 ui.debug('histedit: exact replacement of %s with %s\n' % (
402 ui.debug('histedit: exact replacement of %s with %s\n' % (
405 hexshort(replaced_[0]), hexshort(created_[0])))
403 node.short(replaced_[0]), node.short(created_[0])))
406
404
407 replacemap[replaced_[0]] = created_[0]
405 replacemap[replaced_[0]] = created_[0]
408 elif clen > rlen:
406 elif clen > rlen:
@@ -412,7 +410,7 b' def histedit(ui, repo, *parent, **opts):'
412 # TODO synthesize patch names for created patches
410 # TODO synthesize patch names for created patches
413 replacemap[replaced_[0]] = created_[-1]
411 replacemap[replaced_[0]] = created_[-1]
414 ui.debug('histedit: created many, assuming %s replaced by %s' %
412 ui.debug('histedit: created many, assuming %s replaced by %s' %
415 (hexshort(replaced_[0]), hexshort(created_[-1])))
413 (node.short(replaced_[0]), node.short(created_[-1])))
416 elif rlen > clen:
414 elif rlen > clen:
417 if not created_:
415 if not created_:
418 # This must be a drop. Try and put our metadata on
416 # This must be a drop. Try and put our metadata on
@@ -420,7 +418,7 b' def histedit(ui, repo, *parent, **opts):'
420 assert rlen == 1
418 assert rlen == 1
421 r = replaced_[0]
419 r = replaced_[0]
422 ui.debug('histedit: %s seems replaced with nothing, '
420 ui.debug('histedit: %s seems replaced with nothing, '
423 'finding a parent\n' % (hexshort(r)))
421 'finding a parent\n' % (node.short(r)))
424 pctx = repo[r].parents()[0]
422 pctx = repo[r].parents()[0]
425 if pctx.node() in replacemap:
423 if pctx.node() in replacemap:
426 ui.debug('histedit: parent is already replaced\n')
424 ui.debug('histedit: parent is already replaced\n')
@@ -428,12 +426,12 b' def histedit(ui, repo, *parent, **opts):'
428 else:
426 else:
429 replacemap[r] = pctx.node()
427 replacemap[r] = pctx.node()
430 ui.debug('histedit: %s best replaced by %s\n' % (
428 ui.debug('histedit: %s best replaced by %s\n' % (
431 hexshort(r), hexshort(replacemap[r])))
429 node.short(r), node.short(replacemap[r])))
432 else:
430 else:
433 assert len(created_) == 1
431 assert len(created_) == 1
434 for r in replaced_:
432 for r in replaced_:
435 ui.debug('histedit: %s replaced by %s\n' % (
433 ui.debug('histedit: %s replaced by %s\n' % (
436 hexshort(r), hexshort(created_[0])))
434 node.short(r), node.short(created_[0])))
437 replacemap[r] = created_[0]
435 replacemap[r] = created_[0]
438 else:
436 else:
439 assert False, (
437 assert False, (
@@ -456,8 +454,8 b' def histedit(ui, repo, *parent, **opts):'
456 return
454 return
457 while new in replacemap:
455 while new in replacemap:
458 new = replacemap[new]
456 new = replacemap[new]
459 ui.note(_('histedit: %s to %s\n') % (hexshort(old),
457 ui.note(_('histedit: %s to %s\n') % (node.short(old),
460 hexshort(new)))
458 node.short(new)))
461 octx = repo[old]
459 octx = repo[old]
462 marks = octx.bookmarks()
460 marks = octx.bookmarks()
463 if marks:
461 if marks:
General Comments 0
You need to be logged in to leave comments. Login now