annotate tests/test-evolve-obshistory-prune.t @ 6130:cd07d6bd4e2a

cmdrewrite: a new `hg fixup` command This new command can be used to amend specific revisions with working copy changes. Implementation-wise what it basically does is: 1) commit working directory changes 2) relocate the new commit onto the target commit 3) fold them into one. After the run, the working directory parent will be the obsoleted changeset created in step 1 and descendants of the target will become orphans.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 03 Nov 2021 22:59:17 +0530
parents be2008649675
children 36a746dda93a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5291
258c0a99c5b0 tests: update section headers and comments in obslog-related tests
Anton Shestakov <av6@dwimlabs.net>
parents: 5173
diff changeset
1 Testing obslog and other commands accessing obsolete revisions.
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
2
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
3 Global setup
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
4 ============
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
5
3885
3df8b6ecce2a tests: extract obshistory setup in a separate file
Boris Feld <boris.feld@octobus.net>
parents: 3884
diff changeset
6 $ . $TESTDIR/testlib/obshistory_setup.sh
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
7
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
8 Test output with pruned commit
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
9 ==============================
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
10
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
11 Check output on the client side
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
12 -------------------------------
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
13
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
14 $ hg init $TESTTMP/local-prune
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
15 $ hg init $TESTTMP/server
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
16 $ cd $TESTTMP/local-prune
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
17 $ mkcommit ROOT
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
18 $ mkcommit A0 # 0
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
19 $ mkcommit B0 # 1
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
20 $ sync
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
21 $ hg log --hidden -G
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
22 @ changeset: 2:0dec01379d3b
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
23 | tag: tip
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
24 | user: test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
25 | date: Thu Jan 01 00:00:00 1970 +0000
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
26 | summary: B0
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
27 |
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
28 o changeset: 1:471f378eab4c
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
29 | user: test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
30 | date: Thu Jan 01 00:00:00 1970 +0000
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
31 | summary: A0
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
32 |
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
33 o changeset: 0:ea207398892e
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
34 user: test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
35 date: Thu Jan 01 00:00:00 1970 +0000
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
36 summary: ROOT
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
37
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
38 $ hg prune -r 'desc(B0)'
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
4613
30a544904238 messages: standardize on "working copy is now at" including "is"
Martin von Zweigbergk <martinvonz@google.com>
parents: 3895
diff changeset
40 working directory is now at 471f378eab4c
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
41 1 changesets pruned
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
42 $ sync
2336
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
43 $ hg log --hidden -G
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
44 x changeset: 2:0dec01379d3b
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
45 | tag: tip
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
46 | user: test
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
47 | date: Thu Jan 01 00:00:00 1970 +0000
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3564
diff changeset
48 | obsolete: pruned using prune
2336
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
49 | summary: B0
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
50 |
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
51 @ changeset: 1:471f378eab4c
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
52 | user: test
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
53 | date: Thu Jan 01 00:00:00 1970 +0000
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
54 | summary: A0
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
55 |
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
56 o changeset: 0:ea207398892e
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
57 user: test
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
58 date: Thu Jan 01 00:00:00 1970 +0000
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
59 summary: ROOT
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
60
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
61
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
62 Actual test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
63 -----------
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
64
2637
49f2741c4dd7 obslog: add a patch option
Boris Feld <boris.feld@octobus.net>
parents: 2585
diff changeset
65 $ hg obslog 'desc(B0)' --hidden --patch
2407
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
66 x 0dec01379d3b (2) B0
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3564
diff changeset
67 pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
5301
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5291
diff changeset
68 (No patch available, no predecessors)
2407
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
69
5613
87966baf6ea9 tests: use appropriate Python (2 or 3) for json.tool
Anton Shestakov <av6@dwimlabs.net>
parents: 5301
diff changeset
70 $ hg obslog 'desc(B0)' --hidden --no-graph -Tjson | "$PYTHON" -m json.tool
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
71 [
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
72 {
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
73 "markers": [
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
74 {
5171
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
75 "dates": [
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
76 [
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
77 *, (glob)
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
78 0
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
79 ]
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
80 ],
5169
897b371cd0c5 obslog: make operation template property into operations
Anton Shestakov <av6@dwimlabs.net>
parents: 5168
diff changeset
81 "operations": [
897b371cd0c5 obslog: make operation template property into operations
Anton Shestakov <av6@dwimlabs.net>
parents: 5168
diff changeset
82 "prune"
897b371cd0c5 obslog: make operation template property into operations
Anton Shestakov <av6@dwimlabs.net>
parents: 5168
diff changeset
83 ],
5168
c7ca43bba6c5 obslog: make user template property into users
Anton Shestakov <av6@dwimlabs.net>
parents: 5125
diff changeset
84 "users": [
c7ca43bba6c5 obslog: make user template property into users
Anton Shestakov <av6@dwimlabs.net>
parents: 5125
diff changeset
85 "test"
c7ca43bba6c5 obslog: make user template property into users
Anton Shestakov <av6@dwimlabs.net>
parents: 5125
diff changeset
86 ],
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
87 "verb": "pruned"
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
88 }
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
89 ],
4983
6d40e0166522 obslog: make {node} the full node and leave shortening to template
Martin von Zweigbergk <martinvonz@google.com>
parents: 4918
diff changeset
90 "node": "0dec01379d3be6318c470ead31b1fe7ae7cb53d5",
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
91 "shortdescription": "B0"
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
92 }
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
93 ]
2637
49f2741c4dd7 obslog: add a patch option
Boris Feld <boris.feld@octobus.net>
parents: 2585
diff changeset
94 $ hg obslog 'desc(A0)' --patch
2407
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
95 @ 471f378eab4c (1) A0
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
96
5613
87966baf6ea9 tests: use appropriate Python (2 or 3) for json.tool
Anton Shestakov <av6@dwimlabs.net>
parents: 5301
diff changeset
97 $ hg obslog 'desc(A0)' --no-graph -Tjson | "$PYTHON" -m json.tool
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
98 [
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
99 {
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
100 "markers": [],
4983
6d40e0166522 obslog: make {node} the full node and leave shortening to template
Martin von Zweigbergk <martinvonz@google.com>
parents: 4918
diff changeset
101 "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
102 "shortdescription": "A0"
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
103 }
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
104 ]
2290
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
105 $ hg up 1
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
106 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
107 $ hg up 0dec01379d3b
5672
12c53d7122a7 tests: remove trailing "!" from abort messages
Anton Shestakov <av6@dwimlabs.net>
parents: 5613
diff changeset
108 abort: hidden revision '0dec01379d3b' is pruned
3663
54a469cd5b26 test: update output to match upstream
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3567
diff changeset
109 (use --hidden to access hidden revisions)
6053
be2008649675 branching: preserve test changes on stable
Anton Shestakov <av6@dwimlabs.net>
parents: 6052
diff changeset
110 [10]
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
111 $ hg up --hidden -r 'desc(B0)'
3747
1e103c7f7663 test: update to new outputs
Boris Feld <boris.feld@octobus.net>
parents: 3730
diff changeset
112 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1e103c7f7663 test: update to new outputs
Boris Feld <boris.feld@octobus.net>
parents: 3730
diff changeset
113 updated to hidden changeset 0dec01379d3b
3432
f57be161f34b test: update with new 'update' hint about obsfate
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3417
diff changeset
114 (hidden revision '0dec01379d3b' is pruned)
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
115 working directory parent is obsolete! (0dec01379d3b)
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
116 (use 'hg evolve' to update to its parent successor)
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
117
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
118 Check output on the server side
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
119 -------------------------------
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
120
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
121 $ hg obslog -f -R $TESTTMP/server --patch 0dec01379d3b --hidden
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
122 x 0dec01379d3b (2) B0
5173
dbbb48d93f18 obslog: remove the separate "obslog -f" implementation and use the common one
Anton Shestakov <av6@dwimlabs.net>
parents: 5171
diff changeset
123 pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
5301
e8660b28bfee obslog: makes --origin flag the default
Anton Shestakov <av6@dwimlabs.net>
parents: 5291
diff changeset
124 (No patch available, no predecessors)
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
125
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
126 # TODO ADD amend + prune