# HG changeset patch # User Matt Mackall # Date 2010-06-04 22:22:33 # Node ID f118029e534cd54fa2cda440933ba044f8ff0ce6 # Parent 0b5c2e82aeb524cb47deb1d511f2e36d9e3100d3 rebase: use usual util.abort rather than error.ParseError diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -100,18 +100,14 @@ def rebase(ui, repo, **opts): if contf or abortf: if contf and abortf: - raise error.ParseError('rebase', - _('cannot use both abort and continue')) + raise util.Abort(_('cannot use both abort and continue')) if collapsef: - raise error.ParseError( - 'rebase', _('cannot use collapse with continue or abort')) - + raise util.Abort( + _('cannot use collapse with continue or abort')) if detachf: - raise error.ParseError( - 'rebase', _('cannot use detach with continue or abort')) - + raise util.Abort(_('cannot use detach with continue or abort')) if srcf or basef or destf: - raise error.ParseError('rebase', + raise util.Abort( _('abort and continue do not allow specifying revisions')) (originalwd, target, state, collapsef, keepf, @@ -120,15 +116,14 @@ def rebase(ui, repo, **opts): return abort(repo, originalwd, target, state) else: if srcf and basef: - raise error.ParseError('rebase', _('cannot specify both a ' - 'revision and a base')) + raise util.Abort(_('cannot specify both a ' + 'revision and a base')) if detachf: if not srcf: - raise error.ParseError( - 'rebase', _('detach requires a revision to be specified')) + raise util.Abort( + _('detach requires a revision to be specified')) if basef: - raise error.ParseError( - 'rebase', _('cannot specify a base with detach')) + raise util.Abort(_('cannot specify a base with detach')) cmdutil.bail_if_changed(repo) result = buildstate(repo, destf, srcf, basef, detachf) @@ -144,8 +139,7 @@ def rebase(ui, repo, **opts): if keepbranchesf: if extrafn: - raise error.ParseError( - 'rebase', _('cannot use both keepbranches and extrafn')) + raise util.Abort(_('cannot use both keepbranches and extrafn')) def extrafn(ctx, extra): extra['branch'] = ctx.branch() diff --git a/tests/test-rebase-parameters.out b/tests/test-rebase-parameters.out --- a/tests/test-rebase-parameters.out +++ b/tests/test-rebase-parameters.out @@ -1,268 +1,16 @@ % These fail % Use continue and abort -hg rebase: cannot use both abort and continue -hg rebase [-s REV | -b REV] [-d REV] [options] -hg rebase {-a|-c} - -move changeset (and descendants) to a different branch - - Rebase uses repeated merging to graft changesets from one part of history - (the source) onto another (the destination). This can be useful for - linearizing *local* changes relative to a master development tree. - - You should not rebase changesets that have already been shared with - others. Doing so will force everybody else to perform the same rebase or - they will end up with duplicated changesets after pulling in your rebased - changesets. - - If you don't specify a destination changeset ("-d/--dest"), rebase uses - the tipmost head of the current named branch as the destination. (The - destination changeset is not modified by rebasing, but new changesets are - added as its descendants.) - - You can specify which changesets to rebase in two ways: as a "source" - changeset or as a "base" changeset. Both are shorthand for a topologically - related set of changesets (the "source branch"). If you specify source - ("-s/--source"), rebase will rebase that changeset and all of its - descendants onto dest. If you specify base ("-b/--base"), rebase will - select ancestors of base back to but not including the common ancestor - with dest. Thus, "-b" is less precise but more convenient than "-s": you - can specify any changeset in the source branch, and rebase will select the - whole branch. If you specify neither "-s" nor "-b", rebase uses the parent - of the working directory as the base. - - By default, rebase recreates the changesets in the source branch as - descendants of dest and then destroys the originals. Use "--keep" to - preserve the original source changesets. Some changesets in the source - branch (e.g. merges from the destination branch) may be dropped if they no - longer contribute any change. - - One result of the rules for selecting the destination changeset and source - branch is that, unlike "merge", rebase will do nothing if you are at the - latest (tipmost) head of a named branch with two heads. You need to - explicitly specify source and/or destination (or "update" to the other - head, if it's the head of the intended source branch). - - If a rebase is interrupted to manually resolve a merge, it can be - continued with --continue/-c or aborted with --abort/-a. - - Returns 0 on success, 1 if nothing to rebase. - -options: - - -s --source rebase from the specified changeset - -b --base rebase from the base of the specified changeset (up to - greatest common ancestor of base and dest) - -d --dest rebase onto the specified changeset - --collapse collapse the rebased changesets - --keep keep original changesets - --keepbranches keep original branch names - --detach force detaching of source from its original branch - -c --continue continue an interrupted rebase - -a --abort abort an interrupted rebase - --style display using template map file - --template display with template - -use "hg -v help rebase" to show global options +abort: cannot use both abort and continue % Use continue and collapse -hg rebase: cannot use collapse with continue or abort -hg rebase [-s REV | -b REV] [-d REV] [options] -hg rebase {-a|-c} - -move changeset (and descendants) to a different branch - - Rebase uses repeated merging to graft changesets from one part of history - (the source) onto another (the destination). This can be useful for - linearizing *local* changes relative to a master development tree. - - You should not rebase changesets that have already been shared with - others. Doing so will force everybody else to perform the same rebase or - they will end up with duplicated changesets after pulling in your rebased - changesets. - - If you don't specify a destination changeset ("-d/--dest"), rebase uses - the tipmost head of the current named branch as the destination. (The - destination changeset is not modified by rebasing, but new changesets are - added as its descendants.) - - You can specify which changesets to rebase in two ways: as a "source" - changeset or as a "base" changeset. Both are shorthand for a topologically - related set of changesets (the "source branch"). If you specify source - ("-s/--source"), rebase will rebase that changeset and all of its - descendants onto dest. If you specify base ("-b/--base"), rebase will - select ancestors of base back to but not including the common ancestor - with dest. Thus, "-b" is less precise but more convenient than "-s": you - can specify any changeset in the source branch, and rebase will select the - whole branch. If you specify neither "-s" nor "-b", rebase uses the parent - of the working directory as the base. - - By default, rebase recreates the changesets in the source branch as - descendants of dest and then destroys the originals. Use "--keep" to - preserve the original source changesets. Some changesets in the source - branch (e.g. merges from the destination branch) may be dropped if they no - longer contribute any change. - - One result of the rules for selecting the destination changeset and source - branch is that, unlike "merge", rebase will do nothing if you are at the - latest (tipmost) head of a named branch with two heads. You need to - explicitly specify source and/or destination (or "update" to the other - head, if it's the head of the intended source branch). - - If a rebase is interrupted to manually resolve a merge, it can be - continued with --continue/-c or aborted with --abort/-a. - - Returns 0 on success, 1 if nothing to rebase. - -options: - - -s --source rebase from the specified changeset - -b --base rebase from the base of the specified changeset (up to - greatest common ancestor of base and dest) - -d --dest rebase onto the specified changeset - --collapse collapse the rebased changesets - --keep keep original changesets - --keepbranches keep original branch names - --detach force detaching of source from its original branch - -c --continue continue an interrupted rebase - -a --abort abort an interrupted rebase - --style display using template map file - --template display with template - -use "hg -v help rebase" to show global options +abort: cannot use collapse with continue or abort % Use continue/abort and dest/source -hg rebase: abort and continue do not allow specifying revisions -hg rebase [-s REV | -b REV] [-d REV] [options] -hg rebase {-a|-c} - -move changeset (and descendants) to a different branch - - Rebase uses repeated merging to graft changesets from one part of history - (the source) onto another (the destination). This can be useful for - linearizing *local* changes relative to a master development tree. - - You should not rebase changesets that have already been shared with - others. Doing so will force everybody else to perform the same rebase or - they will end up with duplicated changesets after pulling in your rebased - changesets. - - If you don't specify a destination changeset ("-d/--dest"), rebase uses - the tipmost head of the current named branch as the destination. (The - destination changeset is not modified by rebasing, but new changesets are - added as its descendants.) - - You can specify which changesets to rebase in two ways: as a "source" - changeset or as a "base" changeset. Both are shorthand for a topologically - related set of changesets (the "source branch"). If you specify source - ("-s/--source"), rebase will rebase that changeset and all of its - descendants onto dest. If you specify base ("-b/--base"), rebase will - select ancestors of base back to but not including the common ancestor - with dest. Thus, "-b" is less precise but more convenient than "-s": you - can specify any changeset in the source branch, and rebase will select the - whole branch. If you specify neither "-s" nor "-b", rebase uses the parent - of the working directory as the base. - - By default, rebase recreates the changesets in the source branch as - descendants of dest and then destroys the originals. Use "--keep" to - preserve the original source changesets. Some changesets in the source - branch (e.g. merges from the destination branch) may be dropped if they no - longer contribute any change. - - One result of the rules for selecting the destination changeset and source - branch is that, unlike "merge", rebase will do nothing if you are at the - latest (tipmost) head of a named branch with two heads. You need to - explicitly specify source and/or destination (or "update" to the other - head, if it's the head of the intended source branch). - - If a rebase is interrupted to manually resolve a merge, it can be - continued with --continue/-c or aborted with --abort/-a. - - Returns 0 on success, 1 if nothing to rebase. - -options: - - -s --source rebase from the specified changeset - -b --base rebase from the base of the specified changeset (up to - greatest common ancestor of base and dest) - -d --dest rebase onto the specified changeset - --collapse collapse the rebased changesets - --keep keep original changesets - --keepbranches keep original branch names - --detach force detaching of source from its original branch - -c --continue continue an interrupted rebase - -a --abort abort an interrupted rebase - --style display using template map file - --template display with template - -use "hg -v help rebase" to show global options +abort: abort and continue do not allow specifying revisions % Use source and base -hg rebase: cannot specify both a revision and a base -hg rebase [-s REV | -b REV] [-d REV] [options] -hg rebase {-a|-c} - -move changeset (and descendants) to a different branch - - Rebase uses repeated merging to graft changesets from one part of history - (the source) onto another (the destination). This can be useful for - linearizing *local* changes relative to a master development tree. - - You should not rebase changesets that have already been shared with - others. Doing so will force everybody else to perform the same rebase or - they will end up with duplicated changesets after pulling in your rebased - changesets. - - If you don't specify a destination changeset ("-d/--dest"), rebase uses - the tipmost head of the current named branch as the destination. (The - destination changeset is not modified by rebasing, but new changesets are - added as its descendants.) - - You can specify which changesets to rebase in two ways: as a "source" - changeset or as a "base" changeset. Both are shorthand for a topologically - related set of changesets (the "source branch"). If you specify source - ("-s/--source"), rebase will rebase that changeset and all of its - descendants onto dest. If you specify base ("-b/--base"), rebase will - select ancestors of base back to but not including the common ancestor - with dest. Thus, "-b" is less precise but more convenient than "-s": you - can specify any changeset in the source branch, and rebase will select the - whole branch. If you specify neither "-s" nor "-b", rebase uses the parent - of the working directory as the base. - - By default, rebase recreates the changesets in the source branch as - descendants of dest and then destroys the originals. Use "--keep" to - preserve the original source changesets. Some changesets in the source - branch (e.g. merges from the destination branch) may be dropped if they no - longer contribute any change. - - One result of the rules for selecting the destination changeset and source - branch is that, unlike "merge", rebase will do nothing if you are at the - latest (tipmost) head of a named branch with two heads. You need to - explicitly specify source and/or destination (or "update" to the other - head, if it's the head of the intended source branch). - - If a rebase is interrupted to manually resolve a merge, it can be - continued with --continue/-c or aborted with --abort/-a. - - Returns 0 on success, 1 if nothing to rebase. - -options: - - -s --source rebase from the specified changeset - -b --base rebase from the base of the specified changeset (up to - greatest common ancestor of base and dest) - -d --dest rebase onto the specified changeset - --collapse collapse the rebased changesets - --keep keep original changesets - --keepbranches keep original branch names - --detach force detaching of source from its original branch - -c --continue continue an interrupted rebase - -a --abort abort an interrupted rebase - --style display using template map file - --template display with template - -use "hg -v help rebase" to show global options +abort: cannot specify both a revision and a base % Rebase with no arguments - from current nothing to rebase