[Bug 5457] New: rebase could be smarter reading obs graph to avoid merge conflict
mercurial-bugs at mercurial-scm.org
mercurial-bugs at mercurial-scm.org
Mon Jan 2 16:27:06 UTC 2017
https://bz.mercurial-scm.org/show_bug.cgi?id=5457
Bug ID: 5457
Summary: rebase could be smarter reading obs graph to avoid
merge conflict
Product: Mercurial
Version: default branch
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: feature
Priority: wish
Component: Mercurial
Assignee: bugzilla at mercurial-scm.org
Reporter: arcppzju+hgbug at gmail.com
CC: mercurial-devel at selenic.com
Given 3 changesets, where the second has a "copy" and "modify" behavior, and
the third changes the same file again:
@ 2:b17cae3eec88 b3
|
| diff --git a/b b/b
| --- a/b
| +++ b/b
| @@ -1,2 +1,3 @@
| 1
| 2
| +3
|
o 1:bf41062b3958 b2
|
| diff --git a/a b/b
| copy from a
| copy to b
| --- a/a
| +++ b/b
| @@ -1,1 +1,2 @@
| 1
| +2
|
o 0:d847f600340d a1
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+1
If the user decides to modify the second changeset to use a new name, using
"hg mv", followed by "hg amend", they will get the following graph:
@ 4:5835b9fd5e6c b2
|
| diff --git a/a b/c
| copy from a
| copy to c
| --- a/a
| +++ b/c
| @@ -1,1 +1,2 @@
| 1
| +2
|
| o 2:35963a930f76 b3
| |
| | diff --git a/b b/b
| | --- a/b
| | +++ b/b
| | @@ -1,2 +1,3 @@
| | 1
| | 2
| | +3
| |
| x 1:7521d3ae89e6 b2
|/
| diff --git a/a b/b
| copy from a
| copy to b
| --- a/a
| +++ b/b
| @@ -1,1 +1,2 @@
| 1
| +2
|
o 0:6ec6f1968549 a1
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+1
And evolve (or rebase) will report merge conflict:
$ hg rebase -s 2 -d 4
rebasing 2:35963a930f76 "b3"
other [source] changed b which local [dest] deleted
use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
If, instead of amending the second changeset, the user creates a new commit
with the rename, the rebase works without merge conflict:
@ 3:a7c7cb534733 new mv
|
| diff --git a/b b/c
| rename from b
| rename to c
|
| o 2:37d2a0dca739 b3
|/
| diff --git a/b b/b
| --- a/b
| +++ b/b
| @@ -1,2 +1,3 @@
| 1
| 2
| +3
|
o 1:8b0747b69e58 b2
|
| diff --git a/a b/b
| copy from a
| copy to b
| --- a/a
| +++ b/b
| @@ -1,1 +1,2 @@
| 1
| +2
|
o 0:c784163efb7c a1
diff --git a/a b/a
new file mode 100644
--- /dev/null
+++ b/a
@@ -0,0 +1,1 @@
+1
$ hg rebase -s 2 -d 3
rebasing 2:37d2a0dca739 "b3"
merging c and b to c
Therefore, during rebase, we may want to travel the obsolete graph to get more
information to resolve merge conflicts. The above example shows how it can be
useful in the file renaming (copy-tracing) case. While it also applies to the
general content-change case without renaming.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list