# HG changeset patch # User Pierre-Yves David # Date 2011-12-26 23:11:22 # Node ID 65df60a3f96b673a2fb658bb592c038aad45c104 # Parent 60344b83e442659edf21a9ca07d422681ddd215b phases: prevent rebase to rebase immutable changeset. diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -193,6 +193,11 @@ def rebase(ui, repo, **opts): rebaseset = repo.revs('(children(ancestor(%r, %d)) & ::%r)::', base, dest, base) + if rebaseset: + root = min(rebaseset) + else: + root = None + if not rebaseset: repo.ui.debug('base is ancestor of destination') result = None @@ -202,6 +207,10 @@ def rebase(ui, repo, **opts): _("can't remove original changesets with" " unrebased descendants"), hint=_('use --keep to keep original changesets')) + elif not keepf and not repo[root].mutable(): + raise util.Abort(_("Can't rebase immutable changeset %s") + % repo[root], + hint=_('see hg help phases for details')) else: result = buildstate(repo, dest, rebaseset, detachf) diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -409,8 +409,8 @@ class fncachestore(basicstore): self.fncache.rewrite(existing) def copylist(self): - d = ('data dh fncache' - ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i phaseroots') + d = ('data dh fncache phaseroots' + ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i') return (['requires', '00changelog.i'] + ['store/' + f for f in d.split()]) diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -6,6 +6,8 @@ > purge= > rebase= > transplant= + > [phases] + > publish=False > [largefiles] > minsize=2 > patterns=glob:**.dat diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t --- a/tests/test-rebase-abort.t +++ b/tests/test-rebase-abort.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-bookmarks.t b/tests/test-rebase-bookmarks.t --- a/tests/test-rebase-bookmarks.t +++ b/tests/test-rebase-bookmarks.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' bookmarks: {bookmarks}\n" > EOF diff --git a/tests/test-rebase-cache.t b/tests/test-rebase-cache.t --- a/tests/test-rebase-cache.t +++ b/tests/test-rebase-cache.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > theads = heads --template "{rev}: '{desc}' {branches}\n" diff --git a/tests/test-rebase-check-restore.t b/tests/test-rebase-check-restore.t --- a/tests/test-rebase-check-restore.t +++ b/tests/test-rebase-check-restore.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t --- a/tests/test-rebase-collapse.t +++ b/tests/test-rebase-collapse.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts.t +++ b/tests/test-rebase-conflicts.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-detach.t b/tests/test-rebase-detach.t --- a/tests/test-rebase-detach.t +++ b/tests/test-rebase-detach.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t --- a/tests/test-rebase-interruptions.t +++ b/tests/test-rebase-interruptions.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-issue-noparam-single-rev.t b/tests/test-rebase-issue-noparam-single-rev.t --- a/tests/test-rebase-issue-noparam-single-rev.t +++ b/tests/test-rebase-issue-noparam-single-rev.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-mq-skip.t b/tests/test-rebase-mq-skip.t --- a/tests/test-rebase-mq-skip.t +++ b/tests/test-rebase-mq-skip.t @@ -7,6 +7,9 @@ already has one local mq patch > rebase= > mq= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n" > EOF diff --git a/tests/test-rebase-named-branches.t b/tests/test-rebase-named-branches.t --- a/tests/test-rebase-named-branches.t +++ b/tests/test-rebase-named-branches.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters.t +++ b/tests/test-rebase-parameters.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t --- a/tests/test-rebase-scenario-global.t +++ b/tests/test-rebase-scenario-global.t @@ -3,6 +3,9 @@ > graphlog= > rebase= > + > [phases] + > publish=False + > > [alias] > tglog = log -G --template "{rev}: '{desc}' {branches}\n" > EOF @@ -269,6 +272,16 @@ C onto A - rebase onto an ancestor: |/ o 0: 'A' + +Check rebasing public changeset + + $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6 + $ hg rebase -d 5 -b 6 + abort: Can't rebase immutable changeset e1c4361dd923 + (see hg help phases for details) + [255] + + $ hg rebase -d 5 -b 6 --keep $ cd .. Test for revset