Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 25709:c87373179ff3
amend: move createmarkers evaluation earlier
The value is used at multiple points in the function. Retrieving the
value in the middle of the transaction scope gives the false
impression that it has a single user. We move it at the start of the
function to clarify this.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 30 Jun 2015 22:28:40 -0700 |
parents | 5ede49f4383a |
children | 68c83b8d407a |
comparison
equal
deleted
inserted
replaced
25708:d3d32643c060 | 25709:c87373179ff3 |
---|---|
2452 if obsolete.isenabled(repo, obsolete.createmarkersopt): | 2452 if obsolete.isenabled(repo, obsolete.createmarkersopt): |
2453 ui.username() # raise exception if username not set | 2453 ui.username() # raise exception if username not set |
2454 | 2454 |
2455 ui.note(_('amending changeset %s\n') % old) | 2455 ui.note(_('amending changeset %s\n') % old) |
2456 base = old.p1() | 2456 base = old.p1() |
2457 createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) | |
2457 | 2458 |
2458 wlock = dsguard = lock = newid = None | 2459 wlock = dsguard = lock = newid = None |
2459 try: | 2460 try: |
2460 wlock = repo.wlock() | 2461 wlock = repo.wlock() |
2461 dsguard = dirstateguard(repo, 'amend') | 2462 dsguard = dirstateguard(repo, 'amend') |
2617 ui.debug('moving bookmarks %r from %s to %s\n' % | 2618 ui.debug('moving bookmarks %r from %s to %s\n' % |
2618 (marks, old.hex(), hex(newid))) | 2619 (marks, old.hex(), hex(newid))) |
2619 marks[bm] = newid | 2620 marks[bm] = newid |
2620 marks.recordchange(tr) | 2621 marks.recordchange(tr) |
2621 #commit the whole amend process | 2622 #commit the whole amend process |
2622 createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) | |
2623 if createmarkers and newid != old.node(): | 2623 if createmarkers and newid != old.node(): |
2624 # mark the new changeset as successor of the rewritten one | 2624 # mark the new changeset as successor of the rewritten one |
2625 new = repo[newid] | 2625 new = repo[newid] |
2626 obs = [(old, (new,))] | 2626 obs = [(old, (new,))] |
2627 if node: | 2627 if node: |