diff --git a/hgext/rebase.py b/hgext/rebase.py index 181cbb23572ee71f27d4238ab71c60f25a87516b_aGdleHQvcmViYXNlLnB5..c2e1e637d4da013e21bcc836576e21858a887aeb_aGdleHQvcmViYXNlLnB5 100644 --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -440,8 +440,5 @@ branch = repo[None].branch() dest = repo[branch].rev() else: - if 'qtip' in repo.tags() and (repo[dest].hex() in - [s.rev for s in repo.mq.applied]): - raise util.Abort(_('cannot rebase onto an applied mq patch')) dest = repo[dest].rev() @@ -446,5 +443,12 @@ dest = repo[dest].rev() + # This check isn't strictly necessary, since mq detects commits over an + # applied patch. But it prevents messing up the working directory when + # a partially completed rebase is blocked by mq. + if 'qtip' in repo.tags() and (repo[dest].hex() in + [s.rev for s in repo.mq.applied]): + raise util.Abort(_('cannot rebase onto an applied mq patch')) + if src: commonbase = repo[src].ancestor(repo[dest]) if commonbase == repo[src]: diff --git a/tests/test-rebase-mq b/tests/test-rebase-mq index 181cbb23572ee71f27d4238ab71c60f25a87516b_dGVzdHMvdGVzdC1yZWJhc2UtbXE=..c2e1e637d4da013e21bcc836576e21858a887aeb_dGVzdHMvdGVzdC1yZWJhc2UtbXE= 100755 --- a/tests/test-rebase-mq +++ b/tests/test-rebase-mq @@ -45,6 +45,12 @@ hg rebase -s 1 -d 3 echo +echo '% Rebase - same thing, but mq patch is default dest' +hg update -q 1 +hg rebase +hg update -q qtip + +echo echo '% Rebase - generate a conflict' hg rebase -s 2 -d 1 diff --git a/tests/test-rebase-mq.out b/tests/test-rebase-mq.out index 181cbb23572ee71f27d4238ab71c60f25a87516b_dGVzdHMvdGVzdC1yZWJhc2UtbXEub3V0..c2e1e637d4da013e21bcc836576e21858a887aeb_dGVzdHMvdGVzdC1yZWJhc2UtbXEub3V0 100644 --- a/tests/test-rebase-mq.out +++ b/tests/test-rebase-mq.out @@ -11,6 +11,9 @@ % Rebase - try to rebase on an applied mq patch abort: cannot rebase onto an applied mq patch +% Rebase - same thing, but mq patch is default dest +abort: cannot rebase onto an applied mq patch + % Rebase - generate a conflict merging f warning: conflicts during merge.