338 else: |
338 else: |
339 node = _destmergebranch(repo, action=action, sourceset=sourceset, |
339 node = _destmergebranch(repo, action=action, sourceset=sourceset, |
340 onheadcheck=onheadcheck, destspace=destspace) |
340 onheadcheck=onheadcheck, destspace=destspace) |
341 return repo[node].rev() |
341 return repo[node].rev() |
342 |
342 |
343 histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())' |
|
344 |
|
345 def desthistedit(ui, repo): |
343 def desthistedit(ui, repo): |
346 """Default base revision to edit for `hg histedit`.""" |
344 """Default base revision to edit for `hg histedit`.""" |
347 default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) |
345 default = ui.config('histedit', 'defaultrev') |
348 if default: |
346 |
|
347 if default is None: |
|
348 revs = stack.getstack(repo) |
|
349 elif default: |
349 revs = scmutil.revrange(repo, [default]) |
350 revs = scmutil.revrange(repo, [default]) |
350 if revs: |
351 |
351 # The revset supplied by the user may not be in ascending order nor |
352 if revs: |
352 # take the first revision. So do this manually. |
353 # The revset supplied by the user may not be in ascending order nor |
353 revs.sort() |
354 # take the first revision. So do this manually. |
354 return revs.first() |
355 revs.sort() |
|
356 return revs.first() |
355 |
357 |
356 return None |
358 return None |
357 |
359 |
358 def stackbase(ui, repo): |
360 def stackbase(ui, repo): |
359 revs = stack.getstack(repo) |
361 revs = stack.getstack(repo) |