Show More
@@ -1386,13 +1386,48 b' def verifyactions(actions, state, ctxs):' | |||
|
1386 | 1386 | hint=_('use "drop %s" to discard, see also: ' |
|
1387 | 1387 | '"hg help -e histedit.config"') % missing[0][:12]) |
|
1388 | 1388 | |
|
1389 | def adjustreplacementsfrommarkers(repo, oldreplacements): | |
|
1390 | """Adjust replacements from obsolescense markers | |
|
1391 | ||
|
1392 | Replacements structure is originally generated based on | |
|
1393 | histedit's state and does not account for changes that are | |
|
1394 | not recorded there. This function fixes that by adding | |
|
1395 | data read from obsolescense markers""" | |
|
1396 | if not obsolete.isenabled(repo, obsolete.createmarkersopt): | |
|
1397 | return oldreplacements | |
|
1398 | ||
|
1399 | unfi = repo.unfiltered() | |
|
1400 | newreplacements = list(oldreplacements) | |
|
1401 | oldsuccs = [r[1] for r in oldreplacements] | |
|
1402 | # successors that have already been added to succstocheck once | |
|
1403 | seensuccs = set().union(*oldsuccs) # create a set from an iterable of tuples | |
|
1404 | succstocheck = list(seensuccs) | |
|
1405 | while succstocheck: | |
|
1406 | n = succstocheck.pop() | |
|
1407 | try: | |
|
1408 | ctx = unfi[n] | |
|
1409 | except error.RepoError: | |
|
1410 | # XXX node unknown locally, we should properly follow marker | |
|
1411 | newreplacements.append((n, ())) | |
|
1412 | continue | |
|
1413 | ||
|
1414 | for marker in obsolete.successormarkers(ctx): | |
|
1415 | nsuccs = marker.succnodes() | |
|
1416 | newreplacements.append((n, nsuccs)) | |
|
1417 | for nsucc in nsuccs: | |
|
1418 | if nsucc not in seensuccs: | |
|
1419 | seensuccs.add(nsucc) | |
|
1420 | succstocheck.append(nsucc) | |
|
1421 | ||
|
1422 | return newreplacements | |
|
1423 | ||
|
1389 | 1424 | def processreplacement(state): |
|
1390 | 1425 | """process the list of replacements to return |
|
1391 | 1426 | |
|
1392 | 1427 | 1) the final mapping between original and created nodes |
|
1393 | 1428 | 2) the list of temporary node created by histedit |
|
1394 | 1429 | 3) the list of new commit created by histedit""" |
|
1395 | replacements = state.replacements | |
|
1430 | replacements = adjustreplacementsfrommarkers(state.repo, state.replacements) | |
|
1396 | 1431 | allsuccs = set() |
|
1397 | 1432 | replaced = set() |
|
1398 | 1433 | fullmapping = {} |
@@ -14,6 +14,51 b' Enable obsolete' | |||
|
14 | 14 | > rebase= |
|
15 | 15 | > EOF |
|
16 | 16 | |
|
17 | Test that histedit learns about obsolescence not stored in histedit state | |
|
18 | $ hg init boo | |
|
19 | $ cd boo | |
|
20 | $ echo a > a | |
|
21 | $ hg ci -Am a | |
|
22 | adding a | |
|
23 | $ echo a > b | |
|
24 | $ echo a > c | |
|
25 | $ echo a > c | |
|
26 | $ hg ci -Am b | |
|
27 | adding b | |
|
28 | adding c | |
|
29 | $ echo a > d | |
|
30 | $ hg ci -Am c | |
|
31 | adding d | |
|
32 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan | |
|
33 | $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan | |
|
34 | $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan | |
|
35 | $ hg histedit -r 'all()' --commands plan | |
|
36 | Editing (1b2d564fad96), you may commit or record as needed now. | |
|
37 | (hg histedit --continue to resume) | |
|
38 | [1] | |
|
39 | $ hg st | |
|
40 | A b | |
|
41 | A c | |
|
42 | ? plan | |
|
43 | $ hg commit --amend b | |
|
44 | $ hg histedit --continue | |
|
45 | $ hg log -G | |
|
46 | @ 6:46abc7c4d873 b | |
|
47 | | | |
|
48 | o 5:49d44ab2be1b c | |
|
49 | | | |
|
50 | o 0:cb9a9f314b8b a | |
|
51 | ||
|
52 | $ hg debugobsolete | |
|
53 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob) | |
|
54 | 3e30a45cf2f719e96ab3922dfe039cfd047956ce 0 {e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf} (*) {'user': 'test'} (glob) | |
|
55 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (*) {'user': 'test'} (glob) | |
|
56 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (*) {'user': 'test'} (glob) | |
|
57 | $ cd .. | |
|
58 | ||
|
59 | Base setup for the rest of the testing | |
|
60 | ====================================== | |
|
61 | ||
|
17 | 62 |
$ |
|
18 | 63 | $ cd base |
|
19 | 64 |
General Comments 0
You need to be logged in to leave comments.
Login now