Commit Graph

235 Commits

Author SHA1 Message Date
Matt Mackall
0146d3ccb5 rebase: add help examples 2014-10-08 14:03:07 -05:00
Matt Mackall
22f04735c2 rebase: attempt to clarify --base 2014-10-08 13:40:50 -05:00
Durham Goode
a5a69f0001 dirstate: wrap setparent calls with begin/endparentchange (issue4353)
This wraps all the locations of dirstate.setparent with the appropriate
begin/endparentchange calls. This will prevent exceptions during those calls
from causing incoherent dirstates (issue4353).
2014-09-05 11:36:20 -07:00
Mads Kiilerich
f40198b86f rebase: improve description of --base
No Mercurial DAG has ever (!) been drawn in a way where 'up to' would apply.

Instead, describe deliberatey vague and informal instead of seemingly precise
but not describing the essentials:
  rebase the tree around the specified changeset without ancestors of dest
2014-08-19 01:12:56 +02:00
David Soria Parra
610c9c1bff rebase: add a deprecated -i/--interactive flag
A common mistake can be to type 'hg rebase -i' to discover interactive history
editing. We add a -i/--interactive flag as discussed in the sprint and deprecate
it right away, but hint people using it to use histedit instead.
2014-09-01 11:48:55 +02:00
FUJIWARA Katsunori
7a8c1645ce rebase: change "editform" to distinguish merge commits from others
"editform" argument for "getcommiteditor" is decided according to the
format below:

  EXTENSION[.COMMAND][.ROUTE]

  - EXTENSION: name of extension
  - COMMAND: name of command, if there are two or more commands in EXTENSION
  - ROUTE: name of route, if there are two or more routes in COMMAND

This patch newly adds "merge" as ROUTE, to distinguish merge commits
from other.

This patch passes bool as "ctxorbool" to "mergeeditform", because
working context has always 2 parents at this point. Dropping the
second parent of non-merging commits is executed in "concludenode".

Unlike other patches in this series (e.g. for "hg commit"), this patch
doesn't add "normal.normal"/"normal.merge" style ROUTEs, because there
is no "merge" case in "collapse" ROUTE.
2014-08-16 10:43:59 +09:00
FUJIWARA Katsunori
e51e2fef65 rebase: use "rebase.collapse" as "editform" for "--collapse" always
Before this patch, if both "--message" and "--collapse" are specified
for "hg rebase", "rebaes.normal" is used as "editform" unexpectedly.

Unlike patches before and after in this series for improvement, this
is bug fix patch.
2014-08-15 23:05:53 +09:00
Pierre-Yves David
2268a3034c rebase: do not retract phase boundary by hand
We rely on the internal mechanism to commit the changeset in the right phase.
This similar to what the mq extension is doing.

This is an important change as we plan to includes phase movement within the
transaction. Avoiding phase movement from high-level code will avoid the
burden of transaction handling. It is also important to limit the need for
transaction handling as this limits the odds of people messing up. Most common
expected mess-up is code using a different transaction for changeset creation
and phase adjustment.
2014-08-05 13:22:44 -07:00
FUJIWARA Katsunori
1829ad7be1 rebase: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  EXTENSION[.COMMAND][.ROUTE]

  - EXTENSION: name of extension
  - COMMAND: name of command, if there are two or more commands in EXTENSION
  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch:

  - COMMAND is omitted
  - 'normal' and 'collapse' are used as ROUTE
2014-08-02 21:46:26 +09:00
Matt Mackall
3fd77ddc42 merge with stable 2014-07-02 00:01:13 -05:00
Augie Fackler
401a23725d rebase: fix bug that caused transitive copy records to disappear (issue4192)
The defect was that copies were always duplicated against the target
revision, rather than the first parent of the revision being
rebased. This produced nominally correct results if changes were
rebased one at a time (or with --collapse), but was wrong if we
rebased a sequence of changesets which contained a sequence of copies.
2014-06-07 15:23:12 -04:00
Mads Kiilerich
34f9998bde rebase: empty revset should be a gentle no-op with exit code 1, not an error 2014-05-01 16:47:50 +02:00
Julien Cristau
24f866301b rebase: don't abort if we're asked to rebase an empty revset
The documentation says we exit 1 if we have nothing to do, so avoid
breaking that contract when we're passed an empty revset.

This was changed in http://www.selenic.com/hg/rev/1d4f2abc281b to
improve the error message; keep the improved message, just not the
abort.
2014-04-23 13:51:35 +02:00
Durham Goode
91de13260e rebase: specify custom conflict marker labels for rebase (BC)
Changes rebase conflict markers to say 'source' and 'dest' instead of
'local' and 'other'.  This ends up looking like:

  one
  <<<<<<< dest:   a3e5c7fd master - bob: "A commit to master"
  master
  =======
  mine
  >>>>>>> source: c7fda3e5 - durham: "A commit to my feature branch"
  three
2014-05-08 16:55:56 -07:00
Mads Kiilerich
554a61dae5 rebase: tell when reopening a closed branch head
Give same 'reopening closed branch head X' message as commit gives.
2013-11-26 03:18:56 +01:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Matt Mackall
ea6ffc9a80 merge with stable 2014-03-18 14:25:28 -05:00
FUJIWARA Katsunori
3a5dd1f5ac rebase: use "commitforceeditor" instead of "ui.edit()" for "--collapse"
Before this patch, "rebase --collapse --edit" without "--message" and
"--logfile" invokes editor twice unexpectedly:

  1. explicit "ui.edit()" invocation in rebase extension itself

  2. indirect invocation in "localrepository.commit()" with "editor =
     commitforceeditor" assigned by "--edit" option

This patch uses indirect "commitforceeditor" invocation instead of
"ui.edit()" for "--collapse" without "--message" and "--logfile" to:

  - suppress redundant the former invocation
  - ensure editor invocation even when "--edit" is not specified
2014-03-19 01:07:41 +09:00
Yuya Nishihara
c857975766 rebase: do not try to reactivate deleted divergent bookmark
If the currently active bookmark is divergent one, it may be resolved during
rebase.  Trying to activate it will raise "KeyError: 'W@diverge'".
2014-02-15 16:19:19 +09:00
Matt Mackall
c738b36ce1 rebase: abort cleanly when we encounter a damaged rebasestate (issue4155) 2014-01-30 13:56:56 -06:00
Simon Heimberg
7be64b106f rebase: do not raise an UnboundLocalError when called wrong (issue4106)
When the base is not found, we should not raise a traceback about a not defined
variable. This hides the real problem: the function rebasenode was (probably)
called wrong.

An AssertionError is raised to highlight that the caller of the function did
something wrong.

An alternative approach is to only assign None to the variable "base" and let
the merge mechanism raise an abort message. This was the behaviour for this
case before 544133bac670. But the only known case for this problem is when an
extension calls this function wrong. An AssertionError makes this clearer than
an abort message. When a different case is detected, the behaviour can be
improved then.
2014-02-14 00:34:20 +01:00
Mads Kiilerich
289bf1ec23 rebase: show nice list instead of set repr for 'computed skipped revs' debug 2014-02-20 02:39:01 +01:00
Mads Kiilerich
870bf81b74 rebase: fix 'rebase onto %d starting from %s' - show root instead of list repr
The debug statement is already in a 'for root in roots' so it was probably the
intention to show root instead of roots. Do that.
2014-02-15 01:23:12 +01:00
FUJIWARA Katsunori
d59fc43c65 rebase: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-rebase-scenario-global.t", because "hg
rebase" hasn't been explicitly tested around editor invocation and
"--edit" option.

In the other hand, this patch doesn't enhance tests in "hg rebase
--collapse" case, because it is already tested in
"test-rebase-collapse.t".
2014-05-11 00:49:35 +09:00
Simon Heimberg
dd6f92d843 hgext: fix one typo in rebase 2014-01-23 01:21:08 +01:00
Mads Kiilerich
478f3cfdb1 rebase: remove old code for handling empty rebaseset 2013-11-16 15:46:29 -05:00
Mads Kiilerich
3b3d94dbd6 rebase: improve error message for --base being empty or causing emptiness
Before it just said 'nothing to rebase'.

Now 'if "base" is an empty set:
  abort: empty "base" revision set - can't compute rebase set

If the set of changesets to rebase can't be found from "base", it will fail as
before but with more explanation of what the problem was.

The name of the "base" option is not obvious - it is more like "samples
identifying the branch to rebase". The error messages for problems with the
specified "base" value will use that term and might thus also not be obvious,
but at least they are consistent with the option name. The name "base" will not
be used if the base only was specified implicitly as the working directory
parent.
2013-11-17 18:21:58 -05:00
Mads Kiilerich
efec0f77a8 rebase: improve error message for empty --source set
Before, it just said 'nothing to rebase' in this case. Now, it aborts
mentioning the reason: 'empty "source" revision set'.

Specifying revisions that cannot be rebased is a 'soft' error, but specifying
an empty set deserves an abort that explains exactly what the problem is.
2013-11-17 18:21:58 -05:00
Mads Kiilerich
c8d7c5a8c0 rebase: improve error message for empty --rev set
Before, it just said 'nothing to rebase' in this case. Now, it aborts
mentioning the reason: 'empty "rev" revision set'.

Specifying revisions that cannot be rebased is a 'soft' error, but specifying
an empty set deserves an abort that explains exactly what the problem is.
2013-11-16 15:46:29 -05:00
Durham Goode
e692055e06 rebase: fix working copy location after a --collapse (issue4080)
Rebasing with --collapse would leave the working copy on the parent of the
collapsed commit, instead of on the collapsed commit.  This fixes that.  Also
fixes a few tests that already covered this area but had bad data.

This also fixes issue3716 where bookmarks are not kept across rebases with
--collapse. I updated the test to cover that case as well.
2013-11-01 17:08:06 -07:00
Durham Goode
64d690fd9a rebase: fix rebase aborts when 'tip-1' is public (issue4082)
When aborting a rebase where tip-1 is public, rebase would fail to undo the merge
state. This caused unexpected dirstate parents and also caused unshelve to
become unabortable (since it uses rebase under the hood).

The problem was that rebase uses -2 as a marker rev, and when it checked for
immutableness during the abort, -2 got resolved to the second to last entry in
the phase cache.

Adds a test for the fix. Add exception to phase code to prevent this in the
future.
2013-11-04 19:59:00 -08:00
FUJIWARA Katsunori
88d39077f8 rebase: add description about exit code when there are unresolved conflicts 2013-10-27 00:24:25 +09:00
Pierre-Yves David
6652b6ffb3 rebase: fix selection of base used when rebasing merge (issue4041)
Prior this changeset, rebasing a merge whose first parent was not in
the rebase lead to wrong and highly conflicting merge. See the in-line
comment for details.

Test have been updated with the data provided by the reported.
2013-10-30 19:45:14 +01:00
Mads Kiilerich
0f5241006f rebase: improve error message for more than one external parent 2013-10-23 23:42:13 +08:00
Mads Kiilerich
bb06a4346f rebase: refactor and rename checkexternal - it is a getter more than a setter 2013-10-24 12:05:22 +08:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Pierre-Yves David
728287dcde rebase: preserve active bookmark when not at head (issue3813)
Now that the working directory parent is preserved, we can preserve the active
bookmark too.
2013-10-14 17:12:59 +02:00
Pierre-Yves David
a9b7960ae6 rebase: preserve working directory parent (BC)
Prior to this changeset, rebase always left the working directory as a parent of
the last rebased changeset. The is dubious when, before the rebase, the working
directory was not a parent of the tip most rebased changeset.

With this changeset, we move the working directory back to its original parent.
If the original parent was rebased, we use it's successors.

This is a step toward solving issue3813 (rebase loses active bookmark if it's
not on a head)
2013-10-14 16:12:29 +02:00
Augie Fackler
fe680e6bea rebase: preserve metadata from grafts of changes (issue4001) 2013-10-01 14:48:53 -04:00
Augie Fackler
7d83107630 rebase: rework extrafn handling to support multiple extrafns
This makes it possible to pass keepbranches and extrafn to rebase at
the same time, although nobody uses that functionality presently. This
is a precursor to keeping graft metadata.
2013-10-01 14:28:18 -04:00
Matt Mackall
7b8a7d221c merge with stable 2013-10-01 17:00:03 -07:00
FUJIWARA Katsunori
e4f428fc17 rebase: catch RepoLookupError at restoring rebase state for summary
Before this patch, "hg summary" may fail, when there is inconsistent
rebase state: for example, the root of rebase destination revisions
recorded in rebase state file is already stripped manually.

Mercurial earlier than 2.7 allows users to do anything other than
starting new rebase, even though current rebase is not finished or
aborted yet. So, such inconsistent rebase states may be left and
forgotten in repositories.

This patch catches RepoLookupError at restoring rebase state for
summary hook, and treat such state as "broken".
2013-10-01 00:35:07 +09:00
FUJIWARA Katsunori
d2e5b13e64 rebase: catch RepoLookupError at restoring rebase state for abort/continue
Before this patch, "rebase --abort"/"--continue" may fail, when rebase
state is inconsistent: for example, the root of rebase destination
revisions recorded in rebase state file is already stripped manually.

Mercurial earlier than 2.7 allows users to do anything other than
starting new rebase, even though current rebase is not finished or
aborted yet. So, such inconsistent rebase states may be left and
forgotten in repositories.

This patch catches RepoLookupError at restoring rebase state for
abort/continue, and treat such state as "broken".
2013-10-01 00:35:07 +09:00
Bryan O'Sullivan
c32bb7d1f6 rebase: handle bookmarks matching revset function names (issue3950)
We handled these correctly with all rev-specifying options except,
somehow, -r/--rev.
2013-09-03 15:12:35 -04:00
Matt Mackall
758ebca217 rebase: allow aborting when descendants detected
With this, all aborts will succeed in removing the state, rather than
leaving the user in 'what do I do now?' limbo.
2013-08-01 17:54:12 -05:00
Matt Mackall
c63eb47329 rebase: continue abort without strip for immutable csets (issue3997)
This causes us to simply discard the rebase state.
2013-08-01 17:45:13 -05:00
Matt Mackall
0cf44a4d14 rebase: don't clobber wd on --abort when we've updated away (issue4009) 2013-08-01 17:33:09 -05:00
Matt Mackall
6d0d30f28a checkunfinished: accommodate histedit quirk
Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
2013-07-25 02:17:52 -05:00
Siddharth Agarwal
139b4eb522 rebase: remove bailifchanged check from pullrebase (BC)
This saves us a relatively superfluous status check for pull --rebase (if
rebase runs, it'll check for a clean working directory anyway), and brings hg
pull --rebase closer to hg pull && hg rebase.

This is a behavior change because pull --rebase with a dirty working directory
will now abort after performing the pull rather than before.
2013-09-20 16:32:05 -07:00
Bryan O'Sullivan
3967183235 rebase: handle bookmarks matching revset function names (issue3950)
We handled these correctly with all rev-specifying options except,
somehow, -r/--rev.
2013-09-03 15:12:35 -04:00