annotate tests/test-import.t @ 6935:954d7ea5cd67 stable tip

stack: when stack base is obsolete, pick any successor, even if at random There are situations when s0 is obsolete and we also cannot pick just one successor for it to use in stack. In such a case, let's pick the "latest" successor from the first set. We're assuming that obsutil.successorssets() returns data in the same order (it should, since it makes sure to sort data internally). Keeping that in mind, while the successor picked for s0 by this code is not based on any sort of sophisticated logic, it should nonetheless be the same every time. This patch is probably not going to completely break anything that was previously working fine, because the previous behavior was to just abort with an exception.
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 16 Nov 2024 17:01:02 +0400
parents 995ed7aac8a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
1 Test creation of obsolescence marker by path import
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
2
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
3 $ hg init auto-obsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
4 $ cd auto-obsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
5 $ echo '[extensions]' >> $HGRCPATH
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1185
diff changeset
6 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
7 $ echo A > a
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
8 $ hg commit -Am A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
9 adding a
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
10 $ echo B > b
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
11 $ hg commit -Am B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
12 adding b
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
13 $ hg up '.^'
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
14 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
15 $ echo C > c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
16 $ hg commit -Am C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
17 adding c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
18 created new head
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
19 $ hg log -G
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
20 @ changeset: 2:eb8dd0f31b51
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
21 | tag: tip
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
22 | parent: 0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
23 | user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
24 | date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
25 | summary: C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
26 |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
27 | o changeset: 1:95b760afef3c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
28 |/ user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
29 | date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
30 | summary: B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
31 |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
32 o changeset: 0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
33 user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
34 date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
35 summary: A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
36
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
37
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
38 (actual test)
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
39
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
40 $ hg export 'desc(B)' | hg import - --obsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
41 applying patch from stdin
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
42 $ hg log -G
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
43 @ changeset: 3:00c49133f17e
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
44 | tag: tip
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
45 | user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
46 | date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
47 | summary: B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
48 |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
49 o changeset: 2:eb8dd0f31b51
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
50 | parent: 0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
51 | user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
52 | date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
53 | summary: C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
54 |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
55 o changeset: 0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
56 user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
57 date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
58 summary: A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
59
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
60 $ hg debugobsolete
1065
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 984
diff changeset
61 95b760afef3c234ffb3f9fd391edcb36e60921a4 00c49133f17e5e5a52b6ef1b6d516c0e90b56d8a 0 (*) {'user': 'test'} (glob)
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
62
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
63 $ hg rollback
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
64 repository tip rolled back to revision 2 (undo import)
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
65 working directory now based on revision 2
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
66 $ hg log -G
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
67 @ changeset: 2:eb8dd0f31b51
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
68 | tag: tip
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
69 | parent: 0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
70 | user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
71 | date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
72 | summary: C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
73 |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
74 | o changeset: 1:95b760afef3c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
75 |/ user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
76 | date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
77 | summary: B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
78 |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
79 o changeset: 0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
80 user: test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
81 date: Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
82 summary: A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
83
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
84 $ hg debugobsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
85