Mercurial > hg
comparison hgext/rebase.py @ 17615:9e2dc0d292cd
rebase: ensure rebase does not revive extinct revision
Here, we exclude hidden changesets from a rebase operation. If we
don't, a rewritten version of the hidden changesets will be created
by rebase. Those rewritten versions won't be hidden and will likely
conflict with other rewriting or revive pruned changeset. Moreover,
rewriting hidden revisions will surprise the user.
This change would not be necessary if changelog filtering were
already in core. But it's fairly cheap and helps to increase the
test-suite for such filtering.
Once changelog level filtering is added, hidden changes will be
automatically excluded or included according to the global --hidden
flags. Plain ignoring them is good enough for now.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 18 Sep 2012 23:32:42 +0200 |
parents | d417986e5e05 |
children | 7f5dab94e48c 848345a8d6ad |
comparison
equal
deleted
inserted
replaced
17614:d417986e5e05 | 17615:9e2dc0d292cd |
---|---|
182 else: | 182 else: |
183 base = scmutil.revrange(repo, [basef or '.']) | 183 base = scmutil.revrange(repo, [basef or '.']) |
184 rebaseset = repo.revs( | 184 rebaseset = repo.revs( |
185 '(children(ancestor(%ld, %d)) and ::(%ld))::', | 185 '(children(ancestor(%ld, %d)) and ::(%ld))::', |
186 base, dest, base) | 186 base, dest, base) |
187 | 187 # temporary top level filtering of extinct revisions |
188 rebaseset = repo.revs('%ld - hidden()', rebaseset) | |
188 if rebaseset: | 189 if rebaseset: |
189 root = min(rebaseset) | 190 root = min(rebaseset) |
190 else: | 191 else: |
191 root = None | 192 root = None |
192 | 193 |
193 if not rebaseset: | 194 if not rebaseset: |
194 repo.ui.debug('base is ancestor of destination\n') | 195 repo.ui.debug('base is ancestor of destination\n') |
195 result = None | 196 result = None |
196 elif not keepf and repo.revs('first(children(%ld) - %ld)', | 197 elif not keepf and repo.revs('first(children(%ld) - %ld)-hidden()', |
197 rebaseset, rebaseset): | 198 rebaseset, rebaseset): |
198 raise util.Abort( | 199 raise util.Abort( |
199 _("can't remove original changesets with" | 200 _("can't remove original changesets with" |
200 " unrebased descendants"), | 201 " unrebased descendants"), |
201 hint=_('use --keep to keep original changesets')) | 202 hint=_('use --keep to keep original changesets')) |