Commit Graph

263 Commits

Author SHA1 Message Date
Pierre-Yves David
3e6abb6494 rebase: ensure rebase revision remains visible (issue4504)
Before this changeset rebase was getting very confused if any revision in the
rebase set became hidden. This was fairly easy to achieve if a rebased revision
was made visible by the working copy location. The rebase process would update
somewhere else and the revision would become hidden.

To work around this issue, we ensure rebased revisions remain visible for the
whole process.

This is a simple change suitable for stable. More subtle usage of unfiltered
repository in rebase may solve this issue more cleanly.
2015-01-27 12:33:56 +00:00
Wagner Bruna
41a26dac7c messages: quote "hg help" hints consistently 2015-01-17 22:01:14 -02:00
Angel Ezquerra
88cbab7845 localrepo: remove all external users of localrepo.opener
This change touches every module in which repository.opener was being used, and
changes it for the equivalent repository.vfs. This is meant to make it easier
to split the repository.vfs into several separate vfs.

It should now be possible to remove localrepo.opener.
2015-01-15 23:17:12 +01:00
Mads Kiilerich
48ca794ffe rebase: clarify comment about merge ancestor when rebasing merges
The code for picking a merge ancestor when rebasing merges had a long and
incorrect comment.

The comment would perhaps have been fine as commit message but does
not make the code more readable or maintainable and is a bad
substitute for correct and readable code.

The correct essense of the comment is quite trivial: a merge of an ancestor of
the rebase destination and an 'outside' revision can be rebased as if it was a
linear change, using 'destination ancestor parent' as base and pretty much
ignoring the 'outside' revision.

The code path where the comment is placed is however also used for other kinds
of merge rebases. The comment is thus not really correct and not helpful. I
think it would be better to drop the comment and rewrite the code.
2015-01-04 01:29:07 +01:00
Mads Kiilerich
85d8c3201b rebase: show a note for updated mq patches
It deserves more than a debug message. Show a note like:

  updating mq patch p0.patch to 5:9ecc820b1737

The message could also refer to "qrefresh" instead. Same same.
2012-10-11 23:22:02 +02:00
Mads Kiilerich
344f01d255 rebase: improve debug messages while processing the list of rebases 2014-12-10 06:20:35 +01:00
Mads Kiilerich
046399e6dc rebase: show warning when rebase creates no changes to commit
Similar to graft:
  note: rebase of 6:eea13746799a created no changes to commit
2014-12-10 06:20:35 +01:00
Mads Kiilerich
0419ad5c23 rebase: show more useful status information while rebasing
Show status messages while rebasing, similar to what graft do:
  rebasing 12:2647734878ef "fork" (tip)

This gives more context for the user when resolving conflicts.
2014-12-09 03:45:26 +01:00
Pierre-Yves David
91ffdd8fd9 rebase: handle revtodo as a special value when storing/restoring state
Revtodo happens to share its value with nullrev, but this is an implementation
details, so we move away from it.

After this changeset one can successfully change the values for all
the constants and the tests still pass, but doing so would require more
refactoring if we want to avoid breaking backward compatibility on the
state file.
2014-12-02 12:23:12 -08:00
Pierre-Yves David
1563d11102 rebase: add a 'revtodo' constant
The state mapping is using '-1' to mark revisions that have not been
rebased yet. We introduce and use a constant for that purpose. This
will help emphasize the fact the value means something other than
nullrev.
2014-12-02 09:46:20 -08:00
Pierre-Yves David
63e45da38d rebase: use '>= 0' to know is a revision was rebased
The fact that the state for "not yet rebased" is -1 is an implementation
details. So we change the comparisons to some semantically more correct.
2014-12-04 07:03:02 -08:00
Mads Kiilerich
71cd977276 rebase: move base calculation from rebasenode() to defineparents()
We want to collect all calculation in one place.
2014-11-19 03:38:51 +01:00
Mads Kiilerich
32ab3ad47a rebase: avoid redundant repo[rev].rev() - just keep working in rev space 2014-12-02 05:12:59 +01:00
Mads Kiilerich
1b7641d285 rebase: always store rev in state, also when collapsing 2014-12-02 05:12:59 +01:00
Mads Kiilerich
e768b7844a rebase: clarify naming of variables holding node hashes - don't call them rev 2014-12-02 05:12:53 +01:00
Matt Mackall
30e416b9be merge with stable 2014-12-02 17:19:20 -06:00
Pierre-Yves David
8c62cbc185 rebase: ignore negative state when updating back to original wc parent
The state mapping also contains some magic negative values (detached
parent, ignored revision). Blindly reading the state thus lead to
unfortunate usage of the negative value as an update destination. We
now filter them out.

We do a minor alteration of the test to catch this.
2014-12-02 11:06:38 -08:00
Durham Goode
847e63a880 rebase: fix rebase with no common ancestors (issue4446)
The new rebase revset didn't check for the case when there are no common
ancestors. Now it does. The new behavior should be the same as the pre-3.2
behavior. Added a test.
2014-11-10 10:44:42 -08:00
Matt Mackall
9620de068c merge with stable 2014-11-11 18:43:19 -06:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
Durham Goode
aea70fa3a4 rebase: improve base revset performance
The old revset had pretty terrible performance on large repositories (12+
seconds). This new revset achieves the same result in only 0.7s. As we improve
the underlying revset APIs we can probably get this revset down to 'only(base,
dest)::', but at the moment that version still takes 2s.
2014-10-20 18:50:09 -07:00
Durham Goode
faa1c33f8b obsolete: add allowunstable option
This option allows the creation of unstable commits. This allows things like
amending in the middle of a stack of commits, etc.
2014-10-14 13:25:13 -07:00
Durham Goode
18f3737f3a obsolete: add createmarkers option
The basic obsolete option is allowing the creation of obsolete markers. This
does not enable other features, such as allowing unstable commits or exchanging
obsolete markers.
2014-10-14 13:23:52 -07:00
Matt Mackall
7872571fea rebase: fix some weird mixed-case naming 2014-10-13 18:00:39 -05:00
Matt Mackall
f3ce636a9c rebase: move duplicatecopies next to merge
This is preparation for removing open-coded rebase/graft operations.

As a side-effect, this exposes proper renames in the working copy when
there are conflicts, which shows up in test-shelve.t.
2014-10-13 17:55:45 -05:00
Matt Mackall
f663e5fc01 duplicatecopies: move from cmdutil to copies
This is in preparation for moving its primary caller into merge.py,
which would be a layering violation in the current location.
2014-10-13 14:33:13 -05:00
Pierre-Yves David
24a85b292d rebase: transform the smartset to a list before comparing with a list
This is highly suboptimal but smartsets are not comparable to lists yet.
2014-10-07 00:31:53 -07:00
Pierre-Yves David
f0eddcafaf rebase: use last instead of direct indexing
This makes it compatible with all smartset classes.
2014-10-07 00:16:59 -07:00
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