This instance will be upgraded to Heptapod 0.23.2 on 2021-08-05 at 11:00 UTC+2 (a few minutes of down time)

Commit 8f8a28f3 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

rewind: actually track folds using fold-* metadata in obsmarkers

Switching "(%d changesets obsoleted)" to using successorsmap because it's the
source of items in relationships (and the latter variable now can have less
items than before this patch).
parent 0cb1718ed95c
Pipeline #11605 passed with stage
in 4 minutes and 21 seconds
......@@ -8,6 +8,7 @@ Changelog
* metaedit: update bookmark location when applicable
* evolve: fix various issues with --continue when solving content-divergence
* rewind: add a --dry-run flag
* rewind: properly record rewind of splits as folds
* evolve: while resolving conflicts, the evolved node will no longer be a
dirstate parent (won't show up in `hg parents` and not as `@` in `hg log -G`,
but it will show up as `%` with hg >= 5.4)
......
......@@ -10,6 +10,7 @@ from mercurial import (
obsolete,
obsutil,
scmutil,
util,
)
from mercurial.utils import dateutil
......@@ -128,6 +129,17 @@ def rewind(ui, repo, **opts):
relationships.append(rel)
if wctxp.node() == source:
update_target = newdest[-1]
# Use this condition as a proxy since the commit we care about
# (b99903534e06) didn't change any signatures.
if util.safehasattr(scmutil, 'nullrev'):
# hg <= 4.7 (b99903534e06)
destmap = util.sortdict()
for src, dest in relationships:
destmap.setdefault(dest, []).append(src)
relationships = [
(tuple(src), dest)
for dest, src in destmap.items()
]
obsolete.createmarkers(unfi, relationships, operation=b'rewind')
if update_target is not None:
if opts.get('keep'):
......@@ -171,8 +183,8 @@ def rewind(ui, repo, **opts):
compat.update(repo[update_target])
ui.status(_(b'rewound to %d changesets\n') % len(targets))
if relationships:
ui.status(_(b'(%d changesets obsoleted)\n') % len(relationships))
if successorsmap:
ui.status(_(b'(%d changesets obsoleted)\n') % len(successorsmap))
if update_target is not None and not opts.get('keep'):
ui.status(_(b'working directory is now at %s\n') % repo[b'.'])
......
......@@ -596,18 +596,18 @@ actual rewind
$ hg debugobsolete
49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
49fb7d900906b0a3d329e90da4dcb0a7582d3b6e 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 4 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'operation': 'rewind', 'user': 'test'}
a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'operation': 'rewind', 'user': 'test'}
9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'fold-id': 'eeda726b', 'fold-idx': '1', 'fold-size': '2', 'operation': 'rewind', 'user': 'test'}
a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'fold-id': 'eeda726b', 'fold-idx': '2', 'fold-size': '2', 'operation': 'rewind', 'user': 'test'}
$ hg obslog --no-origin
@ 4535d0af405c (6) c_CD0
|\
| \
| |\
| x | 9576e80d6851 (5) c_CD0
|/ / rewritten(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
|/ / folded(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| |
| x a0316c4c5417 (4) c_CD0
|/ rewritten(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
|/ folded(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
|
x 49fb7d900906 (3) c_CD0
meta-changed(meta) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
......@@ -616,8 +616,7 @@ actual rewind
$ hg obslog
@ 4535d0af405c (6) c_CD0
|\ meta-changed(meta) from 49fb7d900906 using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| | rewritten(meta, parent, content) from 9576e80d6851 using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| | rewritten(meta, content) from a0316c4c5417 using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| | folded(meta, parent, content) from 9576e80d6851, a0316c4c5417 using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| |
| \
| |\
......@@ -687,8 +686,8 @@ actual rewind
$ hg debugobsolete
49fb7d900906b0a3d329e90da4dcb0a7582d3b6e a0316c4c54179357e71d068fb8884678ebc7c351 9576e80d6851ce79cd535e2dc5fa01b444d89a39 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '12', 'operation': 'split', 'user': 'test'}
49fb7d900906b0a3d329e90da4dcb0a7582d3b6e 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 4 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'operation': 'rewind', 'user': 'test'}
a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'operation': 'rewind', 'user': 'test'}
9576e80d6851ce79cd535e2dc5fa01b444d89a39 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '14', 'fold-id': 'eeda726b', 'fold-idx': '1', 'fold-size': '2', 'operation': 'rewind', 'user': 'test'}
a0316c4c54179357e71d068fb8884678ebc7c351 4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b 0 (Thu Jan 01 00:00:02 1970 +0000) {'ef1': '10', 'fold-id': 'eeda726b', 'fold-idx': '2', 'fold-size': '2', 'operation': 'rewind', 'user': 'test'}
a0316c4c54179357e71d068fb8884678ebc7c351 e76375de0bfc9c59bdd91067c901f3eed7d6c8fe 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '2', 'operation': 'rewind', 'user': 'test'}
9576e80d6851ce79cd535e2dc5fa01b444d89a39 95d72d892df7fec59107e10914c5729bdf03665f 4 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '6', 'operation': 'rewind', 'user': 'test'}
4535d0af405c1bf35f37b35f26ec6f9acfa6fe0b e76375de0bfc9c59bdd91067c901f3eed7d6c8fe 95d72d892df7fec59107e10914c5729bdf03665f 0 (Thu Jan 01 00:00:03 1970 +0000) {'ef1': '14', 'operation': 'rewind', 'user': 'test'}
......@@ -701,11 +700,11 @@ actual rewind
|\| | split(meta, parent, content) as 95d72d892df7, e76375de0bfc using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
| | |
| x | 9576e80d6851 (5) c_CD0
|/ / rewritten(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
|/ / folded(meta, parent, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| | rewritten(meta, parent) as 95d72d892df7 using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
| |
| x a0316c4c5417 (4) c_CD0
|/ rewritten(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
|/ folded(meta, content) as 4535d0af405c using rewind by test (Thu Jan 01 00:00:02 1970 +0000)
| meta-changed(meta) as e76375de0bfc using rewind by test (Thu Jan 01 00:00:03 1970 +0000)
|
x 49fb7d900906 (3) c_CD0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment