##// END OF EJS Templates
rebase: always be graft-like, not merge-like, also for merges...
Martin von Zweigbergk -
r44815:77bb38be default
parent child Browse files
Show More
@@ -1678,22 +1678,6 b' def defineparents(repo, rev, destmap, st'
1678 1678 elif p in state and state[p] > 0:
1679 1679 np = state[p]
1680 1680
1681 # "bases" only record "special" merge bases that cannot be
1682 # calculated from changelog DAG (i.e. isancestor(p, np) is False).
1683 # For example:
1684 #
1685 # B' # rebase -s B -d D, when B was rebased to B'. dest for C
1686 # | C # is B', but merge base for C is B, instead of
1687 # D | # changelog.ancestor(C, B') == A. If changelog DAG and
1688 # | B # "state" edges are merged (so there will be an edge from
1689 # |/ # B to B'), the merge base is still ancestor(C, B') in
1690 # A # the merged graph.
1691 #
1692 # Also see https://bz.mercurial-scm.org/show_bug.cgi?id=1950#c8
1693 # which uses "virtual null merge" to explain this situation.
1694 if isancestor(p, np):
1695 bases[i] = nullrev
1696
1697 1681 # If one parent becomes an ancestor of the other, drop the ancestor
1698 1682 for j, x in enumerate(newps[:i]):
1699 1683 if x == nullrev:
@@ -1754,10 +1738,10 b' def defineparents(repo, rev, destmap, st'
1754 1738 # But our merge base candidates (D and E in above case) could still be
1755 1739 # better than the default (ancestor(F, Z) == null). Therefore still
1756 1740 # pick one (so choose p1 above).
1757 if sum(1 for b in set(bases) if b != nullrev) > 1:
1741 if sum(1 for b in set(bases) if b != nullrev and b not in newps) > 1:
1758 1742 unwanted = [None, None] # unwanted[i]: unwanted revs if choose bases[i]
1759 1743 for i, base in enumerate(bases):
1760 if base == nullrev:
1744 if base == nullrev or base in newps:
1761 1745 continue
1762 1746 # Revisions in the side (not chosen as merge base) branch that
1763 1747 # might contain "surprising" contents
@@ -1781,6 +1765,7 b' def defineparents(repo, rev, destmap, st'
1781 1765 )
1782 1766 )
1783 1767
1768 if any(revs is not None for revs in unwanted):
1784 1769 # Choose a merge base that has a minimal number of unwanted revs.
1785 1770 l, i = min(
1786 1771 (len(revs), i)
@@ -1813,10 +1798,7 b' def defineparents(repo, rev, destmap, st'
1813 1798 bases[0], bases[i] = bases[i], bases[0]
1814 1799
1815 1800 # "rebasenode" updates to new p1, use the corresponding merge base.
1816 if bases[0] != nullrev:
1817 1801 base = bases[0]
1818 else:
1819 base = None
1820 1802
1821 1803 repo.ui.debug(b" future parents are %d and %d\n" % tuple(newps))
1822 1804
@@ -256,7 +256,7 b' Different destinations for merge changes'
256 256 > EOS
257 257 rebasing 3:a4256619d830 "B" (B)
258 258 rebasing 6:8e139e245220 "C" (C tip)
259 o 8: 51e2ce92e06a C
259 o 8: d7d1169e9b1c C
260 260 |\
261 261 | o 7: 2ed0c8546285 B
262 262 | |\
@@ -68,11 +68,6 b' interesting conflict resolutions or addi'
68 68 that is mixed up with the actual merge stuff and there is in general no way to
69 69 separate them.
70 70
71 Note: The dev branch contains _no_ changes to f-default. It might be unclear
72 how rebasing of ancestor merges should be handled, but the current behavior
73 with spurious prompts for conflicts in files that didn't change seems very
74 wrong.
75
76 71 $ hg init ancestor-merge
77 72 $ cd ancestor-merge
78 73
@@ -133,16 +128,11 b' Full rebase all the way back from branch'
133 128 note: not rebasing 1:1d1a643d390e "dev: create branch", its destination already has all its changes
134 129 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
135 130 rebasing 4:4b019212aaf6 "dev: merge default"
136 file 'f-default' was deleted in local [dest] but was modified in other [source].
137 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
138 What do you want to do? c
131 note: not rebasing 4:4b019212aaf6 "dev: merge default", its destination already has all its changes
139 132 rebasing 6:010ced67e558 "dev: merge default"
133 note: not rebasing 6:010ced67e558 "dev: merge default", its destination already has all its changes
140 134 saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-4a6f6d17-rebase.hg
141 135 $ hg tglog
142 o 6: de147e4f69cf 'dev: merge default'
143 |
144 o 5: eda7b7f46f5d 'dev: merge default'
145 |
146 136 o 4: 3e075b1c0a40 'dev: f-dev stuff'
147 137 |
148 138 @ 3: e08089805d82 'default: f-other stuff'
@@ -163,28 +153,8 b' Grafty cherry picking rebasing:'
163 153 > EOF
164 154 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
165 155 rebasing 4:4b019212aaf6 "dev: merge default"
166 file 'f-default' was deleted in local [dest] but was modified in other [source].
167 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
168 What do you want to do? c
169 rebasing 6:010ced67e558 "dev: merge default"
170 saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-827d7a44-rebase.hg
171 $ hg tglog
172 o 7: de147e4f69cf 'dev: merge default'
173 |
174 o 6: eda7b7f46f5d 'dev: merge default'
175 |
176 o 5: 3e075b1c0a40 'dev: f-dev stuff'
177 |
178 o 4: e08089805d82 'default: f-other stuff'
179 |
180 o 3: 462860db70a1 'default: remove f-default'
181 |
182 o 2: f157ecfd2b6b 'default: f-default stuff'
183 |
184 | o 1: 1d1a643d390e 'dev: create branch' dev
185 |/
186 o 0: e90e8eb90b6f 'default: create f-default'
187
156 abort: rebasing 4:4b019212aaf6 will include unwanted changes from 1:1d1a643d390e
157 [255]
188 158 $ cd ..
189 159
190 160
@@ -284,18 +254,7 b' rebase of merge of ancestors'
284 254 rebasing 6:4c5f12f25ebe "merge rebase ancestors" (tip)
285 255 resolving manifests
286 256 removing other
287 note: merging f9daf77ffe76+ and 4c5f12f25ebe using bids from ancestors a60552eb93fb and f59da8fc0fcf
288
289 calculating bids for ancestor a60552eb93fb
290 257 resolving manifests
291
292 calculating bids for ancestor f59da8fc0fcf
293 resolving manifests
294
295 auction for merging merge bids
296 other: consensus for g
297 end of auction
298
299 258 getting other
300 259 committing files:
301 260 other
General Comments 0
You need to be logged in to leave comments. Login now