Commit Graph

28 Commits

Author SHA1 Message Date
Mads Kiilerich
ee476759ff merge: delay debug messages for merge actions
Show messages at a point where the actions have been sorted, thus preparing for
backout of 14f4258e3526.

This makes manifestmerge more of a silent operation, just like 'copies' is.

Indent 'preserving' messages to make them subordinate to the action logging so
they fit in the new context. (The 'preserving' messages are quite redundant and
could also be removed completely.)
2013-01-24 23:57:44 +01:00
Mads Kiilerich
bc50dd6c71 merge: process files in sorted order 2013-01-15 02:59:12 +01:00
Siddharth Agarwal
76d4a91eed copies: make debug messages more sensible
The -> in debug messages is currently overloaded to mean both source to dest
and dest to source. To fix this, we add explicit labels and make the arrow
direction consistent.
2012-12-26 15:03:58 -08:00
Matt Harbison
223186cb48 revset: add destination() predicate
This predicate is used to find csets that were created because of a graft,
transplant or rebase --keep.  An optional revset can be supplied, in which case
the result will be limited to those copies which specified one of the revs as
the source for the command.

    hg log -r destination()                 # csets copied from anywhere
    hg log -r destination(branch(default))  # all csets copied from default

    hg log -r origin(x) or destination(origin(x))  # all instances of x

This predicate will follow a cset through different types of copies.  Given a
repo with a cset 'S' that is grafted to create G(S), which itself is
transplanted to become T(G(S)):

    o-S
   /
  o-o-G(S)
   \
    o-T(G(S))

    hg log -r destination( S )    # { G(S), T(G(S)) }
    hg log -r destination( G(S) ) # { T(G(S)) }

The implementation differences between the three different copy commands (see
the origin() predicate) are not intentionally exposed, however if the
transplant was a graft instead:

	hg log -r destination( G(S) )   # {}

because the 'extra' field in G(G(S)) is S, not G(S).  The implementation cannot
correct this by following sources before G(S) and then select the csets that
reference those sources because the cset provided to the predicate would also
end up selected.  If there were more than two copies, sources of the argument
would also get selected.

Note that the convert extension does not currently update the 'extra' map in its
destination csets, and therefore copies made prior to the convert will be
missing from the resulting set.

Instead of the loop over 'subset', the following almost works, but does not
select a transplant of a transplant.  That is, 'destination(S)' will only
select T(S).

    dests = set([r for r in subset if _getrevsource(repo, r) in args])
2012-07-07 00:47:55 -04:00
Matt Harbison
f78efc8aa9 revset: add origin() predicate
This predicate is used to find the original source of csets created by a graft,
transplant or rebase --keep.  If a copied cset is itself copied, only the
source of the original copy is selected.

    hg log -r origin()                # all src csets, anywhere
    hg log -r origin(branch(default)) # all srcs of copies on default

By following through different types of copy commands and only selecting the
original cset, the implementation differences between the copy commands are
hidden.  (A graft of a graft preserves the original source in its 'extra' map,
while transplant and rebase use the immediate source specified for the
command).

Given a repo with a cset S that is grafted to create G(S), which itself is
grafted to become G(G(S))

    o-S
   /
  o-o-G(S)
   \
    o-G(G(S))

    hg log -r origin( G(S) )      # { S }
    hg log -r origin( G(G(S)) )   # { S }, NOT { G(S) }

Even if the last graft were a transplant

    hg log -r origin( T(G(S)) )   # { S }

A rebase without --keep essentially strips the source, so providing the cset
that results to this predicate will yield an empty set.

Note that the convert extension does not currently update the 'extra' map in
its destination csets, and therefore copies made prior to the convert will be
unable to find their source.
2012-07-07 00:47:30 -04:00
Matt Mackall
61aa1f42b8 merge with stable 2012-06-29 00:40:52 -05:00
Yuya Nishihara
7714ac81fa graft: don't drop the second parent on unsuccessful merge (issue3498)
This replicates the strategy of rebase, which postpones setparents and
duplicatecopies after checking the merge stats.

Without the second parent, resolve cannot redo merge.
2012-06-16 17:05:55 +09:00
Thomas Arendsen Hein
ad3dbec4ae graft: allow -r to specify revisions 2012-06-20 17:02:43 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Thomas Arendsen Hein
6c60809dcc merge: show renamed on one and deleted on the other side in debug output 2012-05-23 21:34:29 +02:00
Levi Bard
4d4fd8dd61 graft: implement --log (issue3438) 2012-05-11 18:51:35 +02:00
Matt Mackall
e38c9f282e filectx: handle some other simple cases for finding merge ancestor 2012-05-06 14:20:53 -05:00
Matt Mackall
a7305a2b09 graft: remark on empty graft 2012-05-06 14:15:17 -05:00
Patrick Mezard
3c6f7e9f84 rebase: skip resolved but emptied revisions
When rebasing, if a conflict occurs and is resolved in a way the rebased
revision becomes empty, it is not skipped, unlike revisions being emptied
without conflicts.

The reason is:
- File 'x' is merged and resolved, merge.update() marks it as 'm' in the
  dirstate.
- rebase.concludenode() calls localrepo.commit(), which calls
  localrepo.status() which calls dirstate.status(). 'x' shows up as 'm' and is
  unconditionnally added to the modified files list, instead of being checked
  again.
- localrepo.commit() detects 'x' as changed an create a new revision where only
  the manifest parents and linkrev differ.

Marking 'x' as modified without checking it makes sense for regular merges. But
in rebase case, the merge looks normal but the second parent is usually
discarded. When this happens, 'm' files in dirstate are a bit irrelevant and
should be considered 'n' possibly dirty instead. That is what the current patch
does.

Another approach, maybe more efficient, would be to pass another flag to
merge.update() saying the 'branchmerge' is a bit of a lie and recordupdate()
should call dirstate.normallookup() instead of merge().

It is also tempting to add this logic to dirstate.setparents(), moving from two
to one parent is what invalidates the 'm' markers. But this is a far bigger
change to make.

v2: succumb to the temptation and move the logic in dirstate.setparents(). mpm
suggested trying _filecommit() first but it is called by commitctx() which
knows nothing about the dirstate and comes too late into the game. A second
approach was to rewrite the 'm' state into 'n' on the fly in dirstate.status()
which failed for graft in the following case:

  $ hg init repo
  $ cd repo
  $ echo a > a
  $ hg ci -qAm0
  $ echo a >> a
  $ hg ci -m1
  $ hg up 0
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg mv a b
  $ echo c > b
  $ hg ci -m2
  created new head
  $ hg graft 1 --tool internal:local
  grafting revision 1
  $ hg --config extensions.graphlog= glog --template '{rev} {desc|firstline}\n'
  @  3 1
  |
  o  2 2
  |
  | o  1 1
  |/
  o  0 0

  $ hg log -r 3 --debug --patch --git --copies
  changeset:   3:19cd7d1417952af13161b94c32e901769104560c
  tag:         tip
  phase:       draft
  parent:      2:b5c505595c9e9a12d5dd457919c143e05fc16fb8
  parent:      -1:0000000000000000000000000000000000000000
  manifest:    3:3d27ce8d02241aa59b60804805edf103c5c0cda4
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  extra:       branch=default
  extra:       source=a03df74c41413a75c0a42997fc36c2de97b26658
  description:
  1

Here, revision 3 is created because there is a copy record for 'b' in the
dirstate and thus 'b' is considered modified. But this information is discarded
at commit time since 'b' content is unchanged. I do not know if discarding this
information is correct or not, but at this time we cannot represent it anyway.

This patch therefore implements the last solution of moving the logic into
dirstate.setparents(). It does not sound crazy as 'm' files makes no sense with
only one parent. It also makes dirstate.merge() calls .lookupnormal() if there
is one parent, to preserve the invariant.

I am a bit concerned about introducing this kind of stateful behaviour to
existing code which historically treated setparents() as a basic setter without
side-effects. And doing that during the code freeze.
2012-04-22 20:06:36 +02:00
Patrick Mezard
9906519ee5 test-rebase: exhibit revisions which should have been skipped
This will be fixed in the next commit.

v2:
- Display emptied grafted revisions
- Use --git flag
2012-04-22 18:27:50 +02:00
Idan Kamara
a5b84a16ff commands: add missing wlock to graft 2012-04-19 18:11:48 +03:00
Matt Mackall
424daf7479 graft: add --dry-run support (issue3362) 2012-04-10 12:49:12 -05:00
Matt Mackall
e3a172f2f0 merge: don't use unknown()
This removes use of unknown files for building the synthetic working
directory manifest used by manifestmerge. Instead, we adopt the
strategy used by _checkunknown.

Side-effect: unknown files are no longer moved by remote directory
renames, and now are left alone like ignored files.
2012-02-09 17:04:17 -06:00
Alain Leufroy
eddef4ddbd graft: add test to check the phase of new changesets
Graft actually do not keep the phase of the source
changesets: no need to change the graft code and add
test to check this behaviour.
2012-01-17 11:08:23 +01:00
Pierre-Yves David
1b001a85f3 changeset_printer: display changeset phase on debug level
Backward compatibility make it hard to display it on higher level
2012-01-17 20:23:23 +01:00
Matt Mackall
dea868ff61 cmdutil: simplify duplicatecopies 2012-01-05 20:35:10 -06:00
Martin Geisler
ae8ca6aff5 merge: make debug output easier to read
I always found it hard to figure out what the debug code meant without
the separators.
2011-12-09 17:34:53 +01:00
Matt Mackall
75db0d196a merge with stable 2011-11-17 16:53:17 -06:00
Stefano Tortarolo
f195f71994 graft: disallow grafting grafted csets in specific situations (issue3091)
In particular, we do not allow:
- grafting an already grafted cset onto its original branch
- grafting already grafted csets with the same origin onto each other
2011-11-12 14:00:25 +01:00
Stefano Tortarolo
2dbc061389 graft: use revs to make tests more readable 2011-11-12 11:23:52 +01:00
Stefano Tortarolo
dfee711e26 graft: preserve original source in subsequent grafts 2011-11-12 13:15:40 +01:00
Matt Mackall
66de5cde16 merge: give a special message for internal:merge failure (issue3105) 2011-11-16 18:04:19 -06:00
Matt Mackall
3c5a04f076 graft: add a test 2011-10-24 17:01:49 -05:00