Mercurial > hg
comparison hgext/rebase.py @ 26717:1755e1d9d1c3
rebase: extra default destination in its own function
This makes it much simple to wrap for other extension.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 15 Oct 2015 01:50:31 +0100 |
parents | e9b3d523f2e6 |
children | 806ca3a37858 |
comparison
equal
deleted
inserted
replaced
26716:c027641f8a83 | 26717:1755e1d9d1c3 |
---|---|
61 def extrafn(ctx, extra): | 61 def extrafn(ctx, extra): |
62 for c in copiers: | 62 for c in copiers: |
63 c(ctx, extra) | 63 c(ctx, extra) |
64 return extrafn | 64 return extrafn |
65 | 65 |
66 def _destrebase(repo): | |
67 # Destination defaults to the latest revision in the | |
68 # current branch | |
69 branch = repo[None].branch() | |
70 return repo[branch].rev() | |
71 | |
66 def _rebasedefaultdest(repo, subset, x): | 72 def _rebasedefaultdest(repo, subset, x): |
67 # ``_rebasedefaultdest()`` | 73 # ``_rebasedefaultdest()`` |
68 | 74 |
69 # default destination for rebase. | 75 # default destination for rebase. |
70 # # XXX: Currently private because I expect the signature to change. | 76 # # XXX: Currently private because I expect the signature to change. |
71 # # XXX: - taking rev as arguments, | 77 # # XXX: - taking rev as arguments, |
72 # # XXX: - bailing out in case of ambiguity vs returning all data. | 78 # # XXX: - bailing out in case of ambiguity vs returning all data. |
73 # # XXX: - probably merging with the merge destination. | 79 # # XXX: - probably merging with the merge destination. |
74 # i18n: "_rebasedefaultdest" is a keyword | 80 # i18n: "_rebasedefaultdest" is a keyword |
75 revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments")) | 81 revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments")) |
76 # Destination defaults to the latest revision in the | 82 return subset & revset.baseset([_destrebase(repo)]) |
77 # current branch | |
78 branch = repo[None].branch() | |
79 return subset & revset.baseset([repo[branch].rev()]) | |
80 | 83 |
81 @command('rebase', | 84 @command('rebase', |
82 [('s', 'source', '', | 85 [('s', 'source', '', |
83 _('rebase the specified changeset and descendants'), _('REV')), | 86 _('rebase the specified changeset and descendants'), _('REV')), |
84 ('b', 'base', '', | 87 ('b', 'base', '', |