Show More
@@ -1,146 +1,146 b'' | |||||
1 | # rewriteutil.py - utility functions for rewriting changesets |
|
1 | # rewriteutil.py - utility functions for rewriting changesets | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Octobus <contact@octobus.net> |
|
3 | # Copyright 2017 Octobus <contact@octobus.net> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import re |
|
10 | import re | |
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
13 | from .node import ( |
|
13 | from .node import ( | |
14 | hex, |
|
14 | hex, | |
15 | nullrev, |
|
15 | nullrev, | |
16 | ) |
|
16 | ) | |
17 |
|
17 | |||
18 | from . import ( |
|
18 | from . import ( | |
19 | error, |
|
19 | error, | |
20 | obsolete, |
|
20 | obsolete, | |
21 | obsutil, |
|
21 | obsutil, | |
22 | revset, |
|
22 | revset, | |
23 | scmutil, |
|
23 | scmutil, | |
24 | util, |
|
24 | util, | |
25 | ) |
|
25 | ) | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') |
|
28 | NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | def precheck(repo, revs, action=b'rewrite'): |
|
31 | def precheck(repo, revs, action=b'rewrite'): | |
32 | """check if revs can be rewritten |
|
32 | """check if revs can be rewritten | |
33 | action is used to control the error message. |
|
33 | action is used to control the error message. | |
34 |
|
34 | |||
35 | Make sure this function is called after taking the lock. |
|
35 | Make sure this function is called after taking the lock. | |
36 | """ |
|
36 | """ | |
37 | if nullrev in revs: |
|
37 | if nullrev in revs: | |
38 | msg = _(b"cannot %s the null revision") % action |
|
38 | msg = _(b"cannot %s the null revision") % action | |
39 | hint = _(b"no changeset checked out") |
|
39 | hint = _(b"no changeset checked out") | |
40 | raise error.InputError(msg, hint=hint) |
|
40 | raise error.InputError(msg, hint=hint) | |
41 |
|
41 | |||
42 | if any(util.safehasattr(r, 'rev') for r in revs): |
|
42 | if any(util.safehasattr(r, 'rev') for r in revs): | |
43 | repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs") |
|
43 | repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs") | |
44 | revs = (r.rev() for r in revs) |
|
44 | revs = (r.rev() for r in revs) | |
45 |
|
45 | |||
46 | if len(repo[None].parents()) > 1: |
|
46 | if len(repo[None].parents()) > 1: | |
47 | raise error.StateError(_(b"cannot %s while merging") % action) |
|
47 | raise error.StateError(_(b"cannot %s changesets while merging") % action) | |
48 |
|
48 | |||
49 | publicrevs = repo.revs(b'%ld and public()', revs) |
|
49 | publicrevs = repo.revs(b'%ld and public()', revs) | |
50 | if publicrevs: |
|
50 | if publicrevs: | |
51 | msg = _(b"cannot %s public changesets") % action |
|
51 | msg = _(b"cannot %s public changesets") % action | |
52 | hint = _(b"see 'hg help phases' for details") |
|
52 | hint = _(b"see 'hg help phases' for details") | |
53 | raise error.InputError(msg, hint=hint) |
|
53 | raise error.InputError(msg, hint=hint) | |
54 |
|
54 | |||
55 | newunstable = disallowednewunstable(repo, revs) |
|
55 | newunstable = disallowednewunstable(repo, revs) | |
56 | if newunstable: |
|
56 | if newunstable: | |
57 | hint = _(b"see 'hg help evolution.instability'") |
|
57 | hint = _(b"see 'hg help evolution.instability'") | |
58 | raise error.InputError( |
|
58 | raise error.InputError( | |
59 | _(b"cannot %s changeset with children") % action, hint=hint |
|
59 | _(b"cannot %s changeset with children") % action, hint=hint | |
60 | ) |
|
60 | ) | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | def disallowednewunstable(repo, revs): |
|
63 | def disallowednewunstable(repo, revs): | |
64 | """Checks whether editing the revs will create new unstable changesets and |
|
64 | """Checks whether editing the revs will create new unstable changesets and | |
65 | are we allowed to create them. |
|
65 | are we allowed to create them. | |
66 |
|
66 | |||
67 | To allow new unstable changesets, set the config: |
|
67 | To allow new unstable changesets, set the config: | |
68 | `experimental.evolution.allowunstable=True` |
|
68 | `experimental.evolution.allowunstable=True` | |
69 | """ |
|
69 | """ | |
70 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) |
|
70 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) | |
71 | if allowunstable: |
|
71 | if allowunstable: | |
72 | return revset.baseset() |
|
72 | return revset.baseset() | |
73 | return repo.revs(b"(%ld::) - %ld", revs, revs) |
|
73 | return repo.revs(b"(%ld::) - %ld", revs, revs) | |
74 |
|
74 | |||
75 |
|
75 | |||
76 | def skip_empty_successor(ui, command): |
|
76 | def skip_empty_successor(ui, command): | |
77 | empty_successor = ui.config(b'rewrite', b'empty-successor') |
|
77 | empty_successor = ui.config(b'rewrite', b'empty-successor') | |
78 | if empty_successor == b'skip': |
|
78 | if empty_successor == b'skip': | |
79 | return True |
|
79 | return True | |
80 | elif empty_successor == b'keep': |
|
80 | elif empty_successor == b'keep': | |
81 | return False |
|
81 | return False | |
82 | else: |
|
82 | else: | |
83 | raise error.ConfigError( |
|
83 | raise error.ConfigError( | |
84 | _( |
|
84 | _( | |
85 | b"%s doesn't know how to handle config " |
|
85 | b"%s doesn't know how to handle config " | |
86 | b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " |
|
86 | b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " | |
87 | b"supported)" |
|
87 | b"supported)" | |
88 | ) |
|
88 | ) | |
89 | % (command, empty_successor) |
|
89 | % (command, empty_successor) | |
90 | ) |
|
90 | ) | |
91 |
|
91 | |||
92 |
|
92 | |||
93 | def update_hash_refs(repo, commitmsg, pending=None): |
|
93 | def update_hash_refs(repo, commitmsg, pending=None): | |
94 | """Replace all obsolete commit hashes in the message with the current hash. |
|
94 | """Replace all obsolete commit hashes in the message with the current hash. | |
95 |
|
95 | |||
96 | If the obsolete commit was split or is divergent, the hash is not replaced |
|
96 | If the obsolete commit was split or is divergent, the hash is not replaced | |
97 | as there's no way to know which successor to choose. |
|
97 | as there's no way to know which successor to choose. | |
98 |
|
98 | |||
99 | For commands that update a series of commits in the current transaction, the |
|
99 | For commands that update a series of commits in the current transaction, the | |
100 | new obsolete markers can be considered by setting ``pending`` to a mapping |
|
100 | new obsolete markers can be considered by setting ``pending`` to a mapping | |
101 | of ``pending[oldnode] = [successor_node1, successor_node2,..]``. |
|
101 | of ``pending[oldnode] = [successor_node1, successor_node2,..]``. | |
102 | """ |
|
102 | """ | |
103 | if not pending: |
|
103 | if not pending: | |
104 | pending = {} |
|
104 | pending = {} | |
105 | cache = {} |
|
105 | cache = {} | |
106 | hashes = re.findall(NODE_RE, commitmsg) |
|
106 | hashes = re.findall(NODE_RE, commitmsg) | |
107 | unfi = repo.unfiltered() |
|
107 | unfi = repo.unfiltered() | |
108 | for h in hashes: |
|
108 | for h in hashes: | |
109 | fullnode = scmutil.resolvehexnodeidprefix(unfi, h) |
|
109 | fullnode = scmutil.resolvehexnodeidprefix(unfi, h) | |
110 | if fullnode is None: |
|
110 | if fullnode is None: | |
111 | continue |
|
111 | continue | |
112 | ctx = unfi[fullnode] |
|
112 | ctx = unfi[fullnode] | |
113 | if not ctx.obsolete(): |
|
113 | if not ctx.obsolete(): | |
114 | successors = pending.get(fullnode) |
|
114 | successors = pending.get(fullnode) | |
115 | if successors is None: |
|
115 | if successors is None: | |
116 | continue |
|
116 | continue | |
117 | # obsutil.successorssets() returns a list of list of nodes |
|
117 | # obsutil.successorssets() returns a list of list of nodes | |
118 | successors = [successors] |
|
118 | successors = [successors] | |
119 | else: |
|
119 | else: | |
120 | successors = obsutil.successorssets(repo, ctx.node(), cache=cache) |
|
120 | successors = obsutil.successorssets(repo, ctx.node(), cache=cache) | |
121 |
|
121 | |||
122 | # We can't make any assumptions about how to update the hash if the |
|
122 | # We can't make any assumptions about how to update the hash if the | |
123 | # cset in question was split or diverged. |
|
123 | # cset in question was split or diverged. | |
124 | if len(successors) == 1 and len(successors[0]) == 1: |
|
124 | if len(successors) == 1 and len(successors[0]) == 1: | |
125 | successor = successors[0][0] |
|
125 | successor = successors[0][0] | |
126 | if successor is not None: |
|
126 | if successor is not None: | |
127 | newhash = hex(successor) |
|
127 | newhash = hex(successor) | |
128 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) |
|
128 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) | |
129 | else: |
|
129 | else: | |
130 | repo.ui.note( |
|
130 | repo.ui.note( | |
131 | _( |
|
131 | _( | |
132 | b'The stale commit message reference to %s could ' |
|
132 | b'The stale commit message reference to %s could ' | |
133 | b'not be updated\n(The referenced commit was dropped)\n' |
|
133 | b'not be updated\n(The referenced commit was dropped)\n' | |
134 | ) |
|
134 | ) | |
135 | % h |
|
135 | % h | |
136 | ) |
|
136 | ) | |
137 | else: |
|
137 | else: | |
138 | repo.ui.note( |
|
138 | repo.ui.note( | |
139 | _( |
|
139 | _( | |
140 | b'The stale commit message reference to %s could ' |
|
140 | b'The stale commit message reference to %s could ' | |
141 | b'not be updated\n' |
|
141 | b'not be updated\n' | |
142 | ) |
|
142 | ) | |
143 | % h |
|
143 | % h | |
144 | ) |
|
144 | ) | |
145 |
|
145 | |||
146 | return commitmsg |
|
146 | return commitmsg |
@@ -1,1319 +1,1319 b'' | |||||
1 | $ hg init |
|
1 | $ hg init | |
2 |
|
2 | |||
3 | Setup: |
|
3 | Setup: | |
4 |
|
4 | |||
5 | $ echo a >> a |
|
5 | $ echo a >> a | |
6 | $ hg ci -Am 'base' |
|
6 | $ hg ci -Am 'base' | |
7 | adding a |
|
7 | adding a | |
8 |
|
8 | |||
9 | Refuse to amend public csets: |
|
9 | Refuse to amend public csets: | |
10 |
|
10 | |||
11 | $ hg phase -r . -p |
|
11 | $ hg phase -r . -p | |
12 | $ hg ci --amend |
|
12 | $ hg ci --amend | |
13 | abort: cannot amend public changesets |
|
13 | abort: cannot amend public changesets | |
14 | (see 'hg help phases' for details) |
|
14 | (see 'hg help phases' for details) | |
15 | [10] |
|
15 | [10] | |
16 | $ hg phase -r . -f -d |
|
16 | $ hg phase -r . -f -d | |
17 |
|
17 | |||
18 | $ echo a >> a |
|
18 | $ echo a >> a | |
19 | $ hg ci -Am 'base1' |
|
19 | $ hg ci -Am 'base1' | |
20 |
|
20 | |||
21 | Nothing to amend: |
|
21 | Nothing to amend: | |
22 |
|
22 | |||
23 | $ hg ci --amend -m 'base1' |
|
23 | $ hg ci --amend -m 'base1' | |
24 | nothing changed |
|
24 | nothing changed | |
25 | [1] |
|
25 | [1] | |
26 |
|
26 | |||
27 | $ cat >> $HGRCPATH <<EOF |
|
27 | $ cat >> $HGRCPATH <<EOF | |
28 | > [hooks] |
|
28 | > [hooks] | |
29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" | |
30 | > EOF |
|
30 | > EOF | |
31 |
|
31 | |||
32 | Amending changeset with changes in working dir: |
|
32 | Amending changeset with changes in working dir: | |
33 | (and check that --message does not trigger an editor) |
|
33 | (and check that --message does not trigger an editor) | |
34 |
|
34 | |||
35 | $ echo a >> a |
|
35 | $ echo a >> a | |
36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' | |
37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 | |
38 | 43f1ba15f28a tip |
|
38 | 43f1ba15f28a tip | |
39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg |
|
39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg | |
40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH | |
41 | $ hg diff -c . |
|
41 | $ hg diff -c . | |
42 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
42 | diff -r ad120869acf0 -r 43f1ba15f28a a | |
43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
45 | @@ -1,1 +1,3 @@ |
|
45 | @@ -1,1 +1,3 @@ | |
46 | a |
|
46 | a | |
47 | +a |
|
47 | +a | |
48 | +a |
|
48 | +a | |
49 | $ hg log |
|
49 | $ hg log | |
50 | changeset: 1:43f1ba15f28a |
|
50 | changeset: 1:43f1ba15f28a | |
51 | tag: tip |
|
51 | tag: tip | |
52 | user: test |
|
52 | user: test | |
53 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | date: Thu Jan 01 00:00:00 1970 +0000 | |
54 | summary: amend base1 |
|
54 | summary: amend base1 | |
55 |
|
55 | |||
56 | changeset: 0:ad120869acf0 |
|
56 | changeset: 0:ad120869acf0 | |
57 | user: test |
|
57 | user: test | |
58 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
58 | date: Thu Jan 01 00:00:00 1970 +0000 | |
59 | summary: base |
|
59 | summary: base | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | Check proper abort for empty message |
|
62 | Check proper abort for empty message | |
63 |
|
63 | |||
64 | $ cat > editor.sh << '__EOF__' |
|
64 | $ cat > editor.sh << '__EOF__' | |
65 | > #!/bin/sh |
|
65 | > #!/bin/sh | |
66 | > echo "" > "$1" |
|
66 | > echo "" > "$1" | |
67 | > __EOF__ |
|
67 | > __EOF__ | |
68 |
|
68 | |||
69 | Update the existing file to ensure that the dirstate is not in pending state |
|
69 | Update the existing file to ensure that the dirstate is not in pending state | |
70 | (where the status of some files in the working copy is not known yet). This in |
|
70 | (where the status of some files in the working copy is not known yet). This in | |
71 | turn ensures that when the transaction is aborted due to an empty message during |
|
71 | turn ensures that when the transaction is aborted due to an empty message during | |
72 | the amend, there should be no rollback. |
|
72 | the amend, there should be no rollback. | |
73 | $ echo a >> a |
|
73 | $ echo a >> a | |
74 |
|
74 | |||
75 | $ echo b > b |
|
75 | $ echo b > b | |
76 | $ hg add b |
|
76 | $ hg add b | |
77 | $ hg summary |
|
77 | $ hg summary | |
78 | parent: 1:43f1ba15f28a tip |
|
78 | parent: 1:43f1ba15f28a tip | |
79 | amend base1 |
|
79 | amend base1 | |
80 | branch: default |
|
80 | branch: default | |
81 | commit: 1 modified, 1 added, 1 unknown |
|
81 | commit: 1 modified, 1 added, 1 unknown | |
82 | update: (current) |
|
82 | update: (current) | |
83 | phases: 2 draft |
|
83 | phases: 2 draft | |
84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
85 | abort: empty commit message |
|
85 | abort: empty commit message | |
86 | [10] |
|
86 | [10] | |
87 | $ hg summary |
|
87 | $ hg summary | |
88 | parent: 1:43f1ba15f28a tip |
|
88 | parent: 1:43f1ba15f28a tip | |
89 | amend base1 |
|
89 | amend base1 | |
90 | branch: default |
|
90 | branch: default | |
91 | commit: 1 modified, 1 added, 1 unknown |
|
91 | commit: 1 modified, 1 added, 1 unknown | |
92 | update: (current) |
|
92 | update: (current) | |
93 | phases: 2 draft |
|
93 | phases: 2 draft | |
94 |
|
94 | |||
95 | Add new file along with modified existing file: |
|
95 | Add new file along with modified existing file: | |
96 | $ hg ci --amend -m 'amend base1 new file' |
|
96 | $ hg ci --amend -m 'amend base1 new file' | |
97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg |
|
97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg | |
98 |
|
98 | |||
99 | Remove file that was added in amended commit: |
|
99 | Remove file that was added in amended commit: | |
100 | (and test logfile option) |
|
100 | (and test logfile option) | |
101 | (and test that logfile option do not trigger an editor) |
|
101 | (and test that logfile option do not trigger an editor) | |
102 |
|
102 | |||
103 | $ hg rm b |
|
103 | $ hg rm b | |
104 | $ echo 'amend base1 remove new file' > ../logfile |
|
104 | $ echo 'amend base1 remove new file' > ../logfile | |
105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile | |
106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg |
|
106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg | |
107 |
|
107 | |||
108 | $ hg cat b |
|
108 | $ hg cat b | |
109 | b: no such file in rev 47343646fa3d |
|
109 | b: no such file in rev 47343646fa3d | |
110 | [1] |
|
110 | [1] | |
111 |
|
111 | |||
112 | No changes, just a different message: |
|
112 | No changes, just a different message: | |
113 |
|
113 | |||
114 | $ hg ci -v --amend -m 'no changes, new message' |
|
114 | $ hg ci -v --amend -m 'no changes, new message' | |
115 | amending changeset 47343646fa3d |
|
115 | amending changeset 47343646fa3d | |
116 | copying changeset 47343646fa3d to ad120869acf0 |
|
116 | copying changeset 47343646fa3d to ad120869acf0 | |
117 | committing files: |
|
117 | committing files: | |
118 | a |
|
118 | a | |
119 | committing manifest |
|
119 | committing manifest | |
120 | committing changelog |
|
120 | committing changelog | |
121 | 1 changesets found |
|
121 | 1 changesets found | |
122 | uncompressed size of bundle content: |
|
122 | uncompressed size of bundle content: | |
123 | 254 (changelog) |
|
123 | 254 (changelog) | |
124 | 163 (manifests) |
|
124 | 163 (manifests) | |
125 | 131 a |
|
125 | 131 a | |
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg |
|
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg | |
127 | 1 changesets found |
|
127 | 1 changesets found | |
128 | uncompressed size of bundle content: |
|
128 | uncompressed size of bundle content: | |
129 | 250 (changelog) |
|
129 | 250 (changelog) | |
130 | 163 (manifests) |
|
130 | 163 (manifests) | |
131 | 131 a |
|
131 | 131 a | |
132 | adding branch |
|
132 | adding branch | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
135 | adding file changes |
|
135 | adding file changes | |
136 | added 1 changesets with 1 changes to 1 files |
|
136 | added 1 changesets with 1 changes to 1 files | |
137 | committed changeset 1:401431e913a1 |
|
137 | committed changeset 1:401431e913a1 | |
138 | $ hg diff -c . |
|
138 | $ hg diff -c . | |
139 | diff -r ad120869acf0 -r 401431e913a1 a |
|
139 | diff -r ad120869acf0 -r 401431e913a1 a | |
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
142 | @@ -1,1 +1,4 @@ |
|
142 | @@ -1,1 +1,4 @@ | |
143 | a |
|
143 | a | |
144 | +a |
|
144 | +a | |
145 | +a |
|
145 | +a | |
146 | +a |
|
146 | +a | |
147 | $ hg log |
|
147 | $ hg log | |
148 | changeset: 1:401431e913a1 |
|
148 | changeset: 1:401431e913a1 | |
149 | tag: tip |
|
149 | tag: tip | |
150 | user: test |
|
150 | user: test | |
151 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
151 | date: Thu Jan 01 00:00:00 1970 +0000 | |
152 | summary: no changes, new message |
|
152 | summary: no changes, new message | |
153 |
|
153 | |||
154 | changeset: 0:ad120869acf0 |
|
154 | changeset: 0:ad120869acf0 | |
155 | user: test |
|
155 | user: test | |
156 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
156 | date: Thu Jan 01 00:00:00 1970 +0000 | |
157 | summary: base |
|
157 | summary: base | |
158 |
|
158 | |||
159 |
|
159 | |||
160 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
160 | Disable default date on commit so when -d isn't given, the old date is preserved: | |
161 |
|
161 | |||
162 | $ echo '[defaults]' >> $HGRCPATH |
|
162 | $ echo '[defaults]' >> $HGRCPATH | |
163 | $ echo 'commit=' >> $HGRCPATH |
|
163 | $ echo 'commit=' >> $HGRCPATH | |
164 |
|
164 | |||
165 | Test -u/-d: |
|
165 | Test -u/-d: | |
166 |
|
166 | |||
167 | $ cat > .hg/checkeditform.sh <<EOF |
|
167 | $ cat > .hg/checkeditform.sh <<EOF | |
168 | > env | grep HGEDITFORM |
|
168 | > env | grep HGEDITFORM | |
169 | > true |
|
169 | > true | |
170 | > EOF |
|
170 | > EOF | |
171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' |
|
171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' | |
172 | HGEDITFORM=commit.amend.normal |
|
172 | HGEDITFORM=commit.amend.normal | |
173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg |
|
173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg | |
174 | $ echo a >> a |
|
174 | $ echo a >> a | |
175 | $ hg ci --amend -u foo -d '1 0' |
|
175 | $ hg ci --amend -u foo -d '1 0' | |
176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg |
|
176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg | |
177 | $ hg log -r . |
|
177 | $ hg log -r . | |
178 | changeset: 1:a9a13940fc03 |
|
178 | changeset: 1:a9a13940fc03 | |
179 | tag: tip |
|
179 | tag: tip | |
180 | user: foo |
|
180 | user: foo | |
181 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
181 | date: Thu Jan 01 00:00:01 1970 +0000 | |
182 | summary: no changes, new message |
|
182 | summary: no changes, new message | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | Open editor with old commit message if a message isn't given otherwise: |
|
185 | Open editor with old commit message if a message isn't given otherwise: | |
186 |
|
186 | |||
187 | $ cat > editor.sh << '__EOF__' |
|
187 | $ cat > editor.sh << '__EOF__' | |
188 | > #!/bin/sh |
|
188 | > #!/bin/sh | |
189 | > cat $1 |
|
189 | > cat $1 | |
190 | > echo "another precious commit message" > "$1" |
|
190 | > echo "another precious commit message" > "$1" | |
191 | > __EOF__ |
|
191 | > __EOF__ | |
192 |
|
192 | |||
193 | at first, test saving last-message.txt |
|
193 | at first, test saving last-message.txt | |
194 |
|
194 | |||
195 | $ cat > .hg/hgrc << '__EOF__' |
|
195 | $ cat > .hg/hgrc << '__EOF__' | |
196 | > [hooks] |
|
196 | > [hooks] | |
197 | > pretxncommit.test-saving-last-message = false |
|
197 | > pretxncommit.test-saving-last-message = false | |
198 | > __EOF__ |
|
198 | > __EOF__ | |
199 |
|
199 | |||
200 | $ rm -f .hg/last-message.txt |
|
200 | $ rm -f .hg/last-message.txt | |
201 | $ hg commit --amend -v -m "message given from command line" |
|
201 | $ hg commit --amend -v -m "message given from command line" | |
202 | amending changeset a9a13940fc03 |
|
202 | amending changeset a9a13940fc03 | |
203 | copying changeset a9a13940fc03 to ad120869acf0 |
|
203 | copying changeset a9a13940fc03 to ad120869acf0 | |
204 | committing files: |
|
204 | committing files: | |
205 | a |
|
205 | a | |
206 | committing manifest |
|
206 | committing manifest | |
207 | committing changelog |
|
207 | committing changelog | |
208 | running hook pretxncommit.test-saving-last-message: false |
|
208 | running hook pretxncommit.test-saving-last-message: false | |
209 | transaction abort! |
|
209 | transaction abort! | |
210 | rollback completed |
|
210 | rollback completed | |
211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
212 | [40] |
|
212 | [40] | |
213 | $ cat .hg/last-message.txt |
|
213 | $ cat .hg/last-message.txt | |
214 | message given from command line (no-eol) |
|
214 | message given from command line (no-eol) | |
215 |
|
215 | |||
216 | $ rm -f .hg/last-message.txt |
|
216 | $ rm -f .hg/last-message.txt | |
217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
218 | amending changeset a9a13940fc03 |
|
218 | amending changeset a9a13940fc03 | |
219 | copying changeset a9a13940fc03 to ad120869acf0 |
|
219 | copying changeset a9a13940fc03 to ad120869acf0 | |
220 | no changes, new message |
|
220 | no changes, new message | |
221 |
|
221 | |||
222 |
|
222 | |||
223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
224 | HG: Leave message empty to abort commit. |
|
224 | HG: Leave message empty to abort commit. | |
225 | HG: -- |
|
225 | HG: -- | |
226 | HG: user: foo |
|
226 | HG: user: foo | |
227 | HG: branch 'default' |
|
227 | HG: branch 'default' | |
228 | HG: changed a |
|
228 | HG: changed a | |
229 | committing files: |
|
229 | committing files: | |
230 | a |
|
230 | a | |
231 | committing manifest |
|
231 | committing manifest | |
232 | committing changelog |
|
232 | committing changelog | |
233 | running hook pretxncommit.test-saving-last-message: false |
|
233 | running hook pretxncommit.test-saving-last-message: false | |
234 | transaction abort! |
|
234 | transaction abort! | |
235 | rollback completed |
|
235 | rollback completed | |
236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
237 | [40] |
|
237 | [40] | |
238 |
|
238 | |||
239 | $ cat .hg/last-message.txt |
|
239 | $ cat .hg/last-message.txt | |
240 | another precious commit message |
|
240 | another precious commit message | |
241 |
|
241 | |||
242 | $ cat > .hg/hgrc << '__EOF__' |
|
242 | $ cat > .hg/hgrc << '__EOF__' | |
243 | > [hooks] |
|
243 | > [hooks] | |
244 | > pretxncommit.test-saving-last-message = |
|
244 | > pretxncommit.test-saving-last-message = | |
245 | > __EOF__ |
|
245 | > __EOF__ | |
246 |
|
246 | |||
247 | then, test editing custom commit message |
|
247 | then, test editing custom commit message | |
248 |
|
248 | |||
249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
250 | amending changeset a9a13940fc03 |
|
250 | amending changeset a9a13940fc03 | |
251 | copying changeset a9a13940fc03 to ad120869acf0 |
|
251 | copying changeset a9a13940fc03 to ad120869acf0 | |
252 | no changes, new message |
|
252 | no changes, new message | |
253 |
|
253 | |||
254 |
|
254 | |||
255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
256 | HG: Leave message empty to abort commit. |
|
256 | HG: Leave message empty to abort commit. | |
257 | HG: -- |
|
257 | HG: -- | |
258 | HG: user: foo |
|
258 | HG: user: foo | |
259 | HG: branch 'default' |
|
259 | HG: branch 'default' | |
260 | HG: changed a |
|
260 | HG: changed a | |
261 | committing files: |
|
261 | committing files: | |
262 | a |
|
262 | a | |
263 | committing manifest |
|
263 | committing manifest | |
264 | committing changelog |
|
264 | committing changelog | |
265 | 1 changesets found |
|
265 | 1 changesets found | |
266 | uncompressed size of bundle content: |
|
266 | uncompressed size of bundle content: | |
267 | 249 (changelog) |
|
267 | 249 (changelog) | |
268 | 163 (manifests) |
|
268 | 163 (manifests) | |
269 | 133 a |
|
269 | 133 a | |
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg |
|
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg | |
271 | 1 changesets found |
|
271 | 1 changesets found | |
272 | uncompressed size of bundle content: |
|
272 | uncompressed size of bundle content: | |
273 | 257 (changelog) |
|
273 | 257 (changelog) | |
274 | 163 (manifests) |
|
274 | 163 (manifests) | |
275 | 133 a |
|
275 | 133 a | |
276 | adding branch |
|
276 | adding branch | |
277 | adding changesets |
|
277 | adding changesets | |
278 | adding manifests |
|
278 | adding manifests | |
279 | adding file changes |
|
279 | adding file changes | |
280 | added 1 changesets with 1 changes to 1 files |
|
280 | added 1 changesets with 1 changes to 1 files | |
281 | committed changeset 1:64a124ba1b44 |
|
281 | committed changeset 1:64a124ba1b44 | |
282 |
|
282 | |||
283 | Same, but with changes in working dir (different code path): |
|
283 | Same, but with changes in working dir (different code path): | |
284 |
|
284 | |||
285 | $ echo a >> a |
|
285 | $ echo a >> a | |
286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
287 | amending changeset 64a124ba1b44 |
|
287 | amending changeset 64a124ba1b44 | |
288 | another precious commit message |
|
288 | another precious commit message | |
289 |
|
289 | |||
290 |
|
290 | |||
291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
292 | HG: Leave message empty to abort commit. |
|
292 | HG: Leave message empty to abort commit. | |
293 | HG: -- |
|
293 | HG: -- | |
294 | HG: user: foo |
|
294 | HG: user: foo | |
295 | HG: branch 'default' |
|
295 | HG: branch 'default' | |
296 | HG: changed a |
|
296 | HG: changed a | |
297 | committing files: |
|
297 | committing files: | |
298 | a |
|
298 | a | |
299 | committing manifest |
|
299 | committing manifest | |
300 | committing changelog |
|
300 | committing changelog | |
301 | 1 changesets found |
|
301 | 1 changesets found | |
302 | uncompressed size of bundle content: |
|
302 | uncompressed size of bundle content: | |
303 | 257 (changelog) |
|
303 | 257 (changelog) | |
304 | 163 (manifests) |
|
304 | 163 (manifests) | |
305 | 133 a |
|
305 | 133 a | |
306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg |
|
306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg | |
307 | 1 changesets found |
|
307 | 1 changesets found | |
308 | uncompressed size of bundle content: |
|
308 | uncompressed size of bundle content: | |
309 | 257 (changelog) |
|
309 | 257 (changelog) | |
310 | 163 (manifests) |
|
310 | 163 (manifests) | |
311 | 135 a |
|
311 | 135 a | |
312 | adding branch |
|
312 | adding branch | |
313 | adding changesets |
|
313 | adding changesets | |
314 | adding manifests |
|
314 | adding manifests | |
315 | adding file changes |
|
315 | adding file changes | |
316 | added 1 changesets with 1 changes to 1 files |
|
316 | added 1 changesets with 1 changes to 1 files | |
317 | committed changeset 1:7892795b8e38 |
|
317 | committed changeset 1:7892795b8e38 | |
318 |
|
318 | |||
319 | $ rm editor.sh |
|
319 | $ rm editor.sh | |
320 | $ hg log -r . |
|
320 | $ hg log -r . | |
321 | changeset: 1:7892795b8e38 |
|
321 | changeset: 1:7892795b8e38 | |
322 | tag: tip |
|
322 | tag: tip | |
323 | user: foo |
|
323 | user: foo | |
324 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
324 | date: Thu Jan 01 00:00:01 1970 +0000 | |
325 | summary: another precious commit message |
|
325 | summary: another precious commit message | |
326 |
|
326 | |||
327 |
|
327 | |||
328 | Moving bookmarks, preserve active bookmark: |
|
328 | Moving bookmarks, preserve active bookmark: | |
329 |
|
329 | |||
330 | $ hg book book1 |
|
330 | $ hg book book1 | |
331 | $ hg book book2 |
|
331 | $ hg book book2 | |
332 | $ hg ci --amend -m 'move bookmarks' |
|
332 | $ hg ci --amend -m 'move bookmarks' | |
333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg |
|
333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg | |
334 | $ hg book |
|
334 | $ hg book | |
335 | book1 1:8311f17e2616 |
|
335 | book1 1:8311f17e2616 | |
336 | * book2 1:8311f17e2616 |
|
336 | * book2 1:8311f17e2616 | |
337 | $ echo a >> a |
|
337 | $ echo a >> a | |
338 | $ hg ci --amend -m 'move bookmarks' |
|
338 | $ hg ci --amend -m 'move bookmarks' | |
339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg |
|
339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg | |
340 | $ hg book |
|
340 | $ hg book | |
341 | book1 1:a3b65065808c |
|
341 | book1 1:a3b65065808c | |
342 | * book2 1:a3b65065808c |
|
342 | * book2 1:a3b65065808c | |
343 |
|
343 | |||
344 | abort does not loose bookmarks |
|
344 | abort does not loose bookmarks | |
345 |
|
345 | |||
346 | $ cat > editor.sh << '__EOF__' |
|
346 | $ cat > editor.sh << '__EOF__' | |
347 | > #!/bin/sh |
|
347 | > #!/bin/sh | |
348 | > echo "" > "$1" |
|
348 | > echo "" > "$1" | |
349 | > __EOF__ |
|
349 | > __EOF__ | |
350 | $ echo a >> a |
|
350 | $ echo a >> a | |
351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
352 | abort: empty commit message |
|
352 | abort: empty commit message | |
353 | [10] |
|
353 | [10] | |
354 | $ hg book |
|
354 | $ hg book | |
355 | book1 1:a3b65065808c |
|
355 | book1 1:a3b65065808c | |
356 | * book2 1:a3b65065808c |
|
356 | * book2 1:a3b65065808c | |
357 | $ hg revert -Caq |
|
357 | $ hg revert -Caq | |
358 | $ rm editor.sh |
|
358 | $ rm editor.sh | |
359 |
|
359 | |||
360 | $ echo '[defaults]' >> $HGRCPATH |
|
360 | $ echo '[defaults]' >> $HGRCPATH | |
361 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
361 | $ echo "commit=-d '0 0'" >> $HGRCPATH | |
362 |
|
362 | |||
363 | Moving branches: |
|
363 | Moving branches: | |
364 |
|
364 | |||
365 | $ hg branch foo |
|
365 | $ hg branch foo | |
366 | marked working directory as branch foo |
|
366 | marked working directory as branch foo | |
367 | (branches are permanent and global, did you want a bookmark?) |
|
367 | (branches are permanent and global, did you want a bookmark?) | |
368 | $ echo a >> a |
|
368 | $ echo a >> a | |
369 | $ hg ci -m 'branch foo' |
|
369 | $ hg ci -m 'branch foo' | |
370 | $ hg branch default -f |
|
370 | $ hg branch default -f | |
371 | marked working directory as branch default |
|
371 | marked working directory as branch default | |
372 | $ hg ci --amend -m 'back to default' |
|
372 | $ hg ci --amend -m 'back to default' | |
373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg |
|
373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg | |
374 | $ hg branches |
|
374 | $ hg branches | |
375 | default 2:9c07515f2650 |
|
375 | default 2:9c07515f2650 | |
376 |
|
376 | |||
377 | Close branch: |
|
377 | Close branch: | |
378 |
|
378 | |||
379 | $ hg up -q 0 |
|
379 | $ hg up -q 0 | |
380 | $ echo b >> b |
|
380 | $ echo b >> b | |
381 | $ hg branch foo |
|
381 | $ hg branch foo | |
382 | marked working directory as branch foo |
|
382 | marked working directory as branch foo | |
383 | (branches are permanent and global, did you want a bookmark?) |
|
383 | (branches are permanent and global, did you want a bookmark?) | |
384 | $ hg ci -Am 'fork' |
|
384 | $ hg ci -Am 'fork' | |
385 | adding b |
|
385 | adding b | |
386 | $ echo b >> b |
|
386 | $ echo b >> b | |
387 | $ hg ci -mb |
|
387 | $ hg ci -mb | |
388 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
388 | $ hg ci --amend --close-branch -m 'closing branch foo' | |
389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg |
|
389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg | |
390 |
|
390 | |||
391 | Same thing, different code path: |
|
391 | Same thing, different code path: | |
392 |
|
392 | |||
393 | $ echo b >> b |
|
393 | $ echo b >> b | |
394 | $ hg ci -m 'reopen branch' |
|
394 | $ hg ci -m 'reopen branch' | |
395 | reopening closed branch head 4 |
|
395 | reopening closed branch head 4 | |
396 | $ echo b >> b |
|
396 | $ echo b >> b | |
397 | $ hg ci --amend --close-branch |
|
397 | $ hg ci --amend --close-branch | |
398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg |
|
398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg | |
399 | $ hg branches |
|
399 | $ hg branches | |
400 | default 2:9c07515f2650 |
|
400 | default 2:9c07515f2650 | |
401 |
|
401 | |||
402 | Refuse to amend during a merge: |
|
402 | Refuse to amend during a merge: | |
403 |
|
403 | |||
404 | $ hg up -q default |
|
404 | $ hg up -q default | |
405 | $ hg merge foo |
|
405 | $ hg merge foo | |
406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
407 | (branch merge, don't forget to commit) |
|
407 | (branch merge, don't forget to commit) | |
408 | $ hg ci --amend |
|
408 | $ hg ci --amend | |
409 | abort: cannot amend while merging |
|
409 | abort: cannot amend changesets while merging | |
410 | [20] |
|
410 | [20] | |
411 | $ hg ci -m 'merge' |
|
411 | $ hg ci -m 'merge' | |
412 |
|
412 | |||
413 | Refuse to amend if there is a merge conflict (issue5805): |
|
413 | Refuse to amend if there is a merge conflict (issue5805): | |
414 |
|
414 | |||
415 | $ hg up -q foo |
|
415 | $ hg up -q foo | |
416 | $ echo c > a |
|
416 | $ echo c > a | |
417 | $ hg up default -t :fail |
|
417 | $ hg up default -t :fail | |
418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
419 | use 'hg resolve' to retry unresolved file merges |
|
419 | use 'hg resolve' to retry unresolved file merges | |
420 | [1] |
|
420 | [1] | |
421 | $ hg resolve -l |
|
421 | $ hg resolve -l | |
422 | U a |
|
422 | U a | |
423 |
|
423 | |||
424 | $ hg ci --amend |
|
424 | $ hg ci --amend | |
425 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
425 | abort: unresolved merge conflicts (see 'hg help resolve') | |
426 | [20] |
|
426 | [20] | |
427 |
|
427 | |||
428 | $ hg up -qC . |
|
428 | $ hg up -qC . | |
429 |
|
429 | |||
430 | Follow copies/renames: |
|
430 | Follow copies/renames: | |
431 |
|
431 | |||
432 | $ hg mv b c |
|
432 | $ hg mv b c | |
433 | $ hg ci -m 'b -> c' |
|
433 | $ hg ci -m 'b -> c' | |
434 | $ hg mv c d |
|
434 | $ hg mv c d | |
435 | $ hg ci --amend -m 'b -> d' |
|
435 | $ hg ci --amend -m 'b -> d' | |
436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg |
|
436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg | |
437 | $ hg st --rev '.^' --copies d |
|
437 | $ hg st --rev '.^' --copies d | |
438 | A d |
|
438 | A d | |
439 | b |
|
439 | b | |
440 | $ hg cp d e |
|
440 | $ hg cp d e | |
441 | $ hg ci -m 'e = d' |
|
441 | $ hg ci -m 'e = d' | |
442 | $ hg cp e f |
|
442 | $ hg cp e f | |
443 | $ hg ci --amend -m 'f = d' |
|
443 | $ hg ci --amend -m 'f = d' | |
444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg |
|
444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg | |
445 | $ hg st --rev '.^' --copies f |
|
445 | $ hg st --rev '.^' --copies f | |
446 | A f |
|
446 | A f | |
447 | d |
|
447 | d | |
448 |
|
448 | |||
449 | $ mv f f.orig |
|
449 | $ mv f f.orig | |
450 | $ hg rm -A f |
|
450 | $ hg rm -A f | |
451 | $ hg ci -m removef |
|
451 | $ hg ci -m removef | |
452 | $ hg cp a f |
|
452 | $ hg cp a f | |
453 | $ mv f.orig f |
|
453 | $ mv f.orig f | |
454 | $ hg ci --amend -m replacef |
|
454 | $ hg ci --amend -m replacef | |
455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg |
|
455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg | |
456 | $ hg st --change . --copies |
|
456 | $ hg st --change . --copies | |
457 | $ hg log -r . --template "{file_copies}\n" |
|
457 | $ hg log -r . --template "{file_copies}\n" | |
458 |
|
458 | |||
459 |
|
459 | |||
460 | Move added file (issue3410): |
|
460 | Move added file (issue3410): | |
461 |
|
461 | |||
462 | $ echo g >> g |
|
462 | $ echo g >> g | |
463 | $ hg ci -Am g |
|
463 | $ hg ci -Am g | |
464 | adding g |
|
464 | adding g | |
465 | $ hg mv g h |
|
465 | $ hg mv g h | |
466 | $ hg ci --amend |
|
466 | $ hg ci --amend | |
467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg |
|
467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg | |
468 | $ hg st --change . --copies h |
|
468 | $ hg st --change . --copies h | |
469 | A h |
|
469 | A h | |
470 | $ hg log -r . --template "{file_copies}\n" |
|
470 | $ hg log -r . --template "{file_copies}\n" | |
471 |
|
471 | |||
472 |
|
472 | |||
473 | Can't rollback an amend: |
|
473 | Can't rollback an amend: | |
474 |
|
474 | |||
475 | $ hg rollback |
|
475 | $ hg rollback | |
476 | no rollback information available |
|
476 | no rollback information available | |
477 | [1] |
|
477 | [1] | |
478 |
|
478 | |||
479 | Preserve extra dict (issue3430): |
|
479 | Preserve extra dict (issue3430): | |
480 |
|
480 | |||
481 | $ hg branch a |
|
481 | $ hg branch a | |
482 | marked working directory as branch a |
|
482 | marked working directory as branch a | |
483 | (branches are permanent and global, did you want a bookmark?) |
|
483 | (branches are permanent and global, did you want a bookmark?) | |
484 | $ echo a >> a |
|
484 | $ echo a >> a | |
485 | $ hg ci -ma |
|
485 | $ hg ci -ma | |
486 | $ hg ci --amend -m "a'" |
|
486 | $ hg ci --amend -m "a'" | |
487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg |
|
487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg | |
488 | $ hg log -r . --template "{branch}\n" |
|
488 | $ hg log -r . --template "{branch}\n" | |
489 | a |
|
489 | a | |
490 | $ hg ci --amend -m "a''" |
|
490 | $ hg ci --amend -m "a''" | |
491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg |
|
491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg | |
492 | $ hg log -r . --template "{branch}\n" |
|
492 | $ hg log -r . --template "{branch}\n" | |
493 | a |
|
493 | a | |
494 |
|
494 | |||
495 | Also preserve other entries in the dict that are in the old commit, |
|
495 | Also preserve other entries in the dict that are in the old commit, | |
496 | first graft something so there's an additional entry: |
|
496 | first graft something so there's an additional entry: | |
497 |
|
497 | |||
498 | $ hg up 0 -q |
|
498 | $ hg up 0 -q | |
499 | $ echo z > z |
|
499 | $ echo z > z | |
500 | $ hg ci -Am 'fork' |
|
500 | $ hg ci -Am 'fork' | |
501 | adding z |
|
501 | adding z | |
502 | created new head |
|
502 | created new head | |
503 | $ hg up 11 |
|
503 | $ hg up 11 | |
504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
505 | $ hg graft 12 |
|
505 | $ hg graft 12 | |
506 | grafting 12:2647734878ef "fork" (tip) |
|
506 | grafting 12:2647734878ef "fork" (tip) | |
507 | $ hg ci --amend -m 'graft amend' |
|
507 | $ hg ci --amend -m 'graft amend' | |
508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg |
|
508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg | |
509 | $ hg log -r . --debug | grep extra |
|
509 | $ hg log -r . --debug | grep extra | |
510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 |
|
510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 | |
511 | extra: branch=a |
|
511 | extra: branch=a | |
512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a | |
513 |
|
513 | |||
514 | Preserve phase |
|
514 | Preserve phase | |
515 |
|
515 | |||
516 | $ hg phase '.^::.' |
|
516 | $ hg phase '.^::.' | |
517 | 11: draft |
|
517 | 11: draft | |
518 | 13: draft |
|
518 | 13: draft | |
519 | $ hg phase --secret --force . |
|
519 | $ hg phase --secret --force . | |
520 | $ hg phase '.^::.' |
|
520 | $ hg phase '.^::.' | |
521 | 11: draft |
|
521 | 11: draft | |
522 | 13: secret |
|
522 | 13: secret | |
523 | $ hg commit --amend -m 'amend for phase' -q |
|
523 | $ hg commit --amend -m 'amend for phase' -q | |
524 | $ hg phase '.^::.' |
|
524 | $ hg phase '.^::.' | |
525 | 11: draft |
|
525 | 11: draft | |
526 | 13: secret |
|
526 | 13: secret | |
527 |
|
527 | |||
528 | Test amend with obsolete |
|
528 | Test amend with obsolete | |
529 | --------------------------- |
|
529 | --------------------------- | |
530 |
|
530 | |||
531 | Enable obsolete |
|
531 | Enable obsolete | |
532 |
|
532 | |||
533 | $ cat >> $HGRCPATH << EOF |
|
533 | $ cat >> $HGRCPATH << EOF | |
534 | > [experimental] |
|
534 | > [experimental] | |
535 | > evolution.createmarkers=True |
|
535 | > evolution.createmarkers=True | |
536 | > evolution.allowunstable=True |
|
536 | > evolution.allowunstable=True | |
537 | > EOF |
|
537 | > EOF | |
538 |
|
538 | |||
539 | Amend with no files changes |
|
539 | Amend with no files changes | |
540 |
|
540 | |||
541 | $ hg id -n |
|
541 | $ hg id -n | |
542 | 13 |
|
542 | 13 | |
543 | $ hg ci --amend -m 'babar' |
|
543 | $ hg ci --amend -m 'babar' | |
544 | $ hg id -n |
|
544 | $ hg id -n | |
545 | 14 |
|
545 | 14 | |
546 | $ hg log -Gl 3 --style=compact |
|
546 | $ hg log -Gl 3 --style=compact | |
547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | |
548 | | babar |
|
548 | | babar | |
549 | | |
|
549 | | | |
550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
551 | | | fork |
|
551 | | | fork | |
552 | | ~ |
|
552 | | ~ | |
553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
554 | | a'' |
|
554 | | a'' | |
555 | ~ |
|
555 | ~ | |
556 | $ hg log -Gl 4 --hidden --style=compact |
|
556 | $ hg log -Gl 4 --hidden --style=compact | |
557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | |
558 | | babar |
|
558 | | babar | |
559 | | |
|
559 | | | |
560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test | |
561 | |/ amend for phase |
|
561 | |/ amend for phase | |
562 | | |
|
562 | | | |
563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
564 | | | fork |
|
564 | | | fork | |
565 | | ~ |
|
565 | | ~ | |
566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
567 | | a'' |
|
567 | | a'' | |
568 | ~ |
|
568 | ~ | |
569 |
|
569 | |||
570 | Amend with files changes |
|
570 | Amend with files changes | |
571 |
|
571 | |||
572 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
572 | (note: the extra commit over 15 is a temporary junk I would be happy to get | |
573 | ride of) |
|
573 | ride of) | |
574 |
|
574 | |||
575 | $ echo 'babar' >> a |
|
575 | $ echo 'babar' >> a | |
576 | $ hg commit --amend |
|
576 | $ hg commit --amend | |
577 | $ hg log -Gl 6 --hidden --style=compact |
|
577 | $ hg log -Gl 6 --hidden --style=compact | |
578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test |
|
578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test | |
579 | | babar |
|
579 | | babar | |
580 | | |
|
580 | | | |
581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test |
|
581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test | |
582 | |/ babar |
|
582 | |/ babar | |
583 | | |
|
583 | | | |
584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test | |
585 | |/ amend for phase |
|
585 | |/ amend for phase | |
586 | | |
|
586 | | | |
587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
588 | | | fork |
|
588 | | | fork | |
589 | | ~ |
|
589 | | ~ | |
590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
591 | | a'' |
|
591 | | a'' | |
592 | | |
|
592 | | | |
593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test |
|
593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test | |
594 | | g |
|
594 | | g | |
595 | ~ |
|
595 | ~ | |
596 |
|
596 | |||
597 |
|
597 | |||
598 | Test that amend does not make it easy to create obsolescence cycle |
|
598 | Test that amend does not make it easy to create obsolescence cycle | |
599 | --------------------------------------------------------------------- |
|
599 | --------------------------------------------------------------------- | |
600 |
|
600 | |||
601 | $ hg id -r 14 --hidden |
|
601 | $ hg id -r 14 --hidden | |
602 | 682950e85999 (a) |
|
602 | 682950e85999 (a) | |
603 | $ hg revert -ar 14 --hidden |
|
603 | $ hg revert -ar 14 --hidden | |
604 | reverting a |
|
604 | reverting a | |
605 | $ hg commit --amend |
|
605 | $ hg commit --amend | |
606 | $ hg id |
|
606 | $ hg id | |
607 | 37973c7e0b61 (a) tip |
|
607 | 37973c7e0b61 (a) tip | |
608 |
|
608 | |||
609 | Test that rewriting leaving instability behind is allowed |
|
609 | Test that rewriting leaving instability behind is allowed | |
610 | --------------------------------------------------------------------- |
|
610 | --------------------------------------------------------------------- | |
611 |
|
611 | |||
612 | $ hg up '.^' |
|
612 | $ hg up '.^' | |
613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
614 | $ echo 'b' >> a |
|
614 | $ echo 'b' >> a | |
615 | $ hg log --style compact -r 'children(.)' |
|
615 | $ hg log --style compact -r 'children(.)' | |
616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test |
|
616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test | |
617 | babar |
|
617 | babar | |
618 |
|
618 | |||
619 | $ hg commit --amend |
|
619 | $ hg commit --amend | |
620 | 1 new orphan changesets |
|
620 | 1 new orphan changesets | |
621 | $ hg log -r 'orphan()' |
|
621 | $ hg log -r 'orphan()' | |
622 | changeset: 16:37973c7e0b61 |
|
622 | changeset: 16:37973c7e0b61 | |
623 | branch: a |
|
623 | branch: a | |
624 | parent: 11:0ddb275cfad1 |
|
624 | parent: 11:0ddb275cfad1 | |
625 | user: test |
|
625 | user: test | |
626 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
626 | date: Thu Jan 01 00:00:00 1970 +0000 | |
627 | instability: orphan |
|
627 | instability: orphan | |
628 | summary: babar |
|
628 | summary: babar | |
629 |
|
629 | |||
630 |
|
630 | |||
631 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
631 | Amend a merge changeset (with renames and conflicts from the second parent): | |
632 |
|
632 | |||
633 | $ hg up -q default |
|
633 | $ hg up -q default | |
634 | $ hg branch -q bar |
|
634 | $ hg branch -q bar | |
635 | $ hg cp a aa |
|
635 | $ hg cp a aa | |
636 | $ hg mv z zz |
|
636 | $ hg mv z zz | |
637 | $ echo cc > cc |
|
637 | $ echo cc > cc | |
638 | $ hg add cc |
|
638 | $ hg add cc | |
639 | $ hg ci -m aazzcc |
|
639 | $ hg ci -m aazzcc | |
640 | $ hg up -q default |
|
640 | $ hg up -q default | |
641 | $ echo a >> a |
|
641 | $ echo a >> a | |
642 | $ echo dd > cc |
|
642 | $ echo dd > cc | |
643 | $ hg add cc |
|
643 | $ hg add cc | |
644 | $ hg ci -m aa |
|
644 | $ hg ci -m aa | |
645 | $ hg merge -q bar |
|
645 | $ hg merge -q bar | |
646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') |
|
646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') | |
647 | [1] |
|
647 | [1] | |
648 | $ hg resolve -m cc |
|
648 | $ hg resolve -m cc | |
649 | (no more unresolved files) |
|
649 | (no more unresolved files) | |
650 | $ hg ci -m 'merge bar' |
|
650 | $ hg ci -m 'merge bar' | |
651 | $ hg log --config diff.git=1 -pr . |
|
651 | $ hg log --config diff.git=1 -pr . | |
652 | changeset: 20:5aba7f3726e6 |
|
652 | changeset: 20:5aba7f3726e6 | |
653 | tag: tip |
|
653 | tag: tip | |
654 | parent: 19:30d96aeaf27b |
|
654 | parent: 19:30d96aeaf27b | |
655 | parent: 18:1aa437659d19 |
|
655 | parent: 18:1aa437659d19 | |
656 | user: test |
|
656 | user: test | |
657 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
657 | date: Thu Jan 01 00:00:00 1970 +0000 | |
658 | summary: merge bar |
|
658 | summary: merge bar | |
659 |
|
659 | |||
660 | diff --git a/a b/aa |
|
660 | diff --git a/a b/aa | |
661 | copy from a |
|
661 | copy from a | |
662 | copy to aa |
|
662 | copy to aa | |
663 | diff --git a/cc b/cc |
|
663 | diff --git a/cc b/cc | |
664 | --- a/cc |
|
664 | --- a/cc | |
665 | +++ b/cc |
|
665 | +++ b/cc | |
666 | @@ -1,1 +1,5 @@ |
|
666 | @@ -1,1 +1,5 @@ | |
667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
668 | dd |
|
668 | dd | |
669 | +======= |
|
669 | +======= | |
670 | +cc |
|
670 | +cc | |
671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
672 | diff --git a/z b/zz |
|
672 | diff --git a/z b/zz | |
673 | rename from z |
|
673 | rename from z | |
674 | rename to zz |
|
674 | rename to zz | |
675 |
|
675 | |||
676 | $ hg debugrename aa |
|
676 | $ hg debugrename aa | |
677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
678 | $ hg debugrename zz |
|
678 | $ hg debugrename zz | |
679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
680 | $ hg debugrename cc |
|
680 | $ hg debugrename cc | |
681 | cc not renamed |
|
681 | cc not renamed | |
682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit |
|
682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit | |
683 | HGEDITFORM=commit.amend.merge |
|
683 | HGEDITFORM=commit.amend.merge | |
684 | $ hg log --config diff.git=1 -pr . |
|
684 | $ hg log --config diff.git=1 -pr . | |
685 | changeset: 21:4b0631ef043e |
|
685 | changeset: 21:4b0631ef043e | |
686 | tag: tip |
|
686 | tag: tip | |
687 | parent: 19:30d96aeaf27b |
|
687 | parent: 19:30d96aeaf27b | |
688 | parent: 18:1aa437659d19 |
|
688 | parent: 18:1aa437659d19 | |
689 | user: test |
|
689 | user: test | |
690 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
690 | date: Thu Jan 01 00:00:00 1970 +0000 | |
691 | summary: merge bar (amend message) |
|
691 | summary: merge bar (amend message) | |
692 |
|
692 | |||
693 | diff --git a/a b/aa |
|
693 | diff --git a/a b/aa | |
694 | copy from a |
|
694 | copy from a | |
695 | copy to aa |
|
695 | copy to aa | |
696 | diff --git a/cc b/cc |
|
696 | diff --git a/cc b/cc | |
697 | --- a/cc |
|
697 | --- a/cc | |
698 | +++ b/cc |
|
698 | +++ b/cc | |
699 | @@ -1,1 +1,5 @@ |
|
699 | @@ -1,1 +1,5 @@ | |
700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
701 | dd |
|
701 | dd | |
702 | +======= |
|
702 | +======= | |
703 | +cc |
|
703 | +cc | |
704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
705 | diff --git a/z b/zz |
|
705 | diff --git a/z b/zz | |
706 | rename from z |
|
706 | rename from z | |
707 | rename to zz |
|
707 | rename to zz | |
708 |
|
708 | |||
709 | $ hg debugrename aa |
|
709 | $ hg debugrename aa | |
710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
711 | $ hg debugrename zz |
|
711 | $ hg debugrename zz | |
712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
713 | $ hg debugrename cc |
|
713 | $ hg debugrename cc | |
714 | cc not renamed |
|
714 | cc not renamed | |
715 | $ hg mv zz z |
|
715 | $ hg mv zz z | |
716 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
716 | $ hg ci --amend -m 'merge bar (undo rename)' | |
717 | $ hg log --config diff.git=1 -pr . |
|
717 | $ hg log --config diff.git=1 -pr . | |
718 | changeset: 22:06423be42d60 |
|
718 | changeset: 22:06423be42d60 | |
719 | tag: tip |
|
719 | tag: tip | |
720 | parent: 19:30d96aeaf27b |
|
720 | parent: 19:30d96aeaf27b | |
721 | parent: 18:1aa437659d19 |
|
721 | parent: 18:1aa437659d19 | |
722 | user: test |
|
722 | user: test | |
723 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
723 | date: Thu Jan 01 00:00:00 1970 +0000 | |
724 | summary: merge bar (undo rename) |
|
724 | summary: merge bar (undo rename) | |
725 |
|
725 | |||
726 | diff --git a/a b/aa |
|
726 | diff --git a/a b/aa | |
727 | copy from a |
|
727 | copy from a | |
728 | copy to aa |
|
728 | copy to aa | |
729 | diff --git a/cc b/cc |
|
729 | diff --git a/cc b/cc | |
730 | --- a/cc |
|
730 | --- a/cc | |
731 | +++ b/cc |
|
731 | +++ b/cc | |
732 | @@ -1,1 +1,5 @@ |
|
732 | @@ -1,1 +1,5 @@ | |
733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
734 | dd |
|
734 | dd | |
735 | +======= |
|
735 | +======= | |
736 | +cc |
|
736 | +cc | |
737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
738 |
|
738 | |||
739 | $ hg debugrename z |
|
739 | $ hg debugrename z | |
740 | z not renamed |
|
740 | z not renamed | |
741 |
|
741 | |||
742 | Amend a merge changeset (with renames during the merge): |
|
742 | Amend a merge changeset (with renames during the merge): | |
743 |
|
743 | |||
744 | $ hg up -q bar |
|
744 | $ hg up -q bar | |
745 | $ echo x > x |
|
745 | $ echo x > x | |
746 | $ hg add x |
|
746 | $ hg add x | |
747 | $ hg ci -m x |
|
747 | $ hg ci -m x | |
748 | $ hg up -q default |
|
748 | $ hg up -q default | |
749 | $ hg merge -q bar |
|
749 | $ hg merge -q bar | |
750 | $ hg mv aa aaa |
|
750 | $ hg mv aa aaa | |
751 | $ echo aa >> aaa |
|
751 | $ echo aa >> aaa | |
752 | $ hg ci -m 'merge bar again' |
|
752 | $ hg ci -m 'merge bar again' | |
753 | $ hg log --config diff.git=1 -pr . |
|
753 | $ hg log --config diff.git=1 -pr . | |
754 | changeset: 24:a89974a20457 |
|
754 | changeset: 24:a89974a20457 | |
755 | tag: tip |
|
755 | tag: tip | |
756 | parent: 22:06423be42d60 |
|
756 | parent: 22:06423be42d60 | |
757 | parent: 23:4c94d5bc65f5 |
|
757 | parent: 23:4c94d5bc65f5 | |
758 | user: test |
|
758 | user: test | |
759 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
759 | date: Thu Jan 01 00:00:00 1970 +0000 | |
760 | summary: merge bar again |
|
760 | summary: merge bar again | |
761 |
|
761 | |||
762 | diff --git a/aa b/aa |
|
762 | diff --git a/aa b/aa | |
763 | deleted file mode 100644 |
|
763 | deleted file mode 100644 | |
764 | --- a/aa |
|
764 | --- a/aa | |
765 | +++ /dev/null |
|
765 | +++ /dev/null | |
766 | @@ -1,2 +0,0 @@ |
|
766 | @@ -1,2 +0,0 @@ | |
767 | -a |
|
767 | -a | |
768 | -a |
|
768 | -a | |
769 | diff --git a/aaa b/aaa |
|
769 | diff --git a/aaa b/aaa | |
770 | new file mode 100644 |
|
770 | new file mode 100644 | |
771 | --- /dev/null |
|
771 | --- /dev/null | |
772 | +++ b/aaa |
|
772 | +++ b/aaa | |
773 | @@ -0,0 +1,3 @@ |
|
773 | @@ -0,0 +1,3 @@ | |
774 | +a |
|
774 | +a | |
775 | +a |
|
775 | +a | |
776 | +aa |
|
776 | +aa | |
777 | diff --git a/x b/x |
|
777 | diff --git a/x b/x | |
778 | new file mode 100644 |
|
778 | new file mode 100644 | |
779 | --- /dev/null |
|
779 | --- /dev/null | |
780 | +++ b/x |
|
780 | +++ b/x | |
781 | @@ -0,0 +1,1 @@ |
|
781 | @@ -0,0 +1,1 @@ | |
782 | +x |
|
782 | +x | |
783 |
|
783 | |||
784 | $ hg debugrename aaa |
|
784 | $ hg debugrename aaa | |
785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 | |
786 |
|
786 | |||
787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists |
|
787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists | |
788 | in p1 too, but it was recorded as copied from p2. |
|
788 | in p1 too, but it was recorded as copied from p2. | |
789 | $ echo modified >> aaa |
|
789 | $ echo modified >> aaa | |
790 | $ hg co -m '.^' -t :merge3 |
|
790 | $ hg co -m '.^' -t :merge3 | |
791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. |
|
791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. | |
792 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
|
792 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. | |
793 | What do you want to do? u |
|
793 | What do you want to do? u | |
794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved |
|
794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved | |
795 | use 'hg resolve' to retry unresolved file merges |
|
795 | use 'hg resolve' to retry unresolved file merges | |
796 | [1] |
|
796 | [1] | |
797 | $ hg co -C tip |
|
797 | $ hg co -C tip | |
798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
799 |
|
799 | |||
800 | $ hg mv aaa aa |
|
800 | $ hg mv aaa aa | |
801 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
801 | $ hg ci --amend -m 'merge bar again (undo rename)' | |
802 | $ hg log --config diff.git=1 -pr . |
|
802 | $ hg log --config diff.git=1 -pr . | |
803 | changeset: 25:282080768800 |
|
803 | changeset: 25:282080768800 | |
804 | tag: tip |
|
804 | tag: tip | |
805 | parent: 22:06423be42d60 |
|
805 | parent: 22:06423be42d60 | |
806 | parent: 23:4c94d5bc65f5 |
|
806 | parent: 23:4c94d5bc65f5 | |
807 | user: test |
|
807 | user: test | |
808 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
808 | date: Thu Jan 01 00:00:00 1970 +0000 | |
809 | summary: merge bar again (undo rename) |
|
809 | summary: merge bar again (undo rename) | |
810 |
|
810 | |||
811 | diff --git a/aa b/aa |
|
811 | diff --git a/aa b/aa | |
812 | --- a/aa |
|
812 | --- a/aa | |
813 | +++ b/aa |
|
813 | +++ b/aa | |
814 | @@ -1,2 +1,3 @@ |
|
814 | @@ -1,2 +1,3 @@ | |
815 | a |
|
815 | a | |
816 | a |
|
816 | a | |
817 | +aa |
|
817 | +aa | |
818 | diff --git a/x b/x |
|
818 | diff --git a/x b/x | |
819 | new file mode 100644 |
|
819 | new file mode 100644 | |
820 | --- /dev/null |
|
820 | --- /dev/null | |
821 | +++ b/x |
|
821 | +++ b/x | |
822 | @@ -0,0 +1,1 @@ |
|
822 | @@ -0,0 +1,1 @@ | |
823 | +x |
|
823 | +x | |
824 |
|
824 | |||
825 | $ hg debugrename aa |
|
825 | $ hg debugrename aa | |
826 | aa not renamed |
|
826 | aa not renamed | |
827 | $ hg debugrename -r '.^' aa |
|
827 | $ hg debugrename -r '.^' aa | |
828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
829 |
|
829 | |||
830 | Amend a merge changeset (with manifest-level conflicts): |
|
830 | Amend a merge changeset (with manifest-level conflicts): | |
831 |
|
831 | |||
832 | $ hg up -q bar |
|
832 | $ hg up -q bar | |
833 | $ hg rm aa |
|
833 | $ hg rm aa | |
834 | $ hg ci -m 'rm aa' |
|
834 | $ hg ci -m 'rm aa' | |
835 | $ hg up -q default |
|
835 | $ hg up -q default | |
836 | $ echo aa >> aa |
|
836 | $ echo aa >> aa | |
837 | $ hg ci -m aa |
|
837 | $ hg ci -m aa | |
838 | $ hg merge -q bar --config ui.interactive=True << EOF |
|
838 | $ hg merge -q bar --config ui.interactive=True << EOF | |
839 | > c |
|
839 | > c | |
840 | > EOF |
|
840 | > EOF | |
841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. |
|
841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. | |
842 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
|
842 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. | |
843 | What do you want to do? c |
|
843 | What do you want to do? c | |
844 | $ hg ci -m 'merge bar (with conflicts)' |
|
844 | $ hg ci -m 'merge bar (with conflicts)' | |
845 | $ hg log --config diff.git=1 -pr . |
|
845 | $ hg log --config diff.git=1 -pr . | |
846 | changeset: 28:ed15db12298d |
|
846 | changeset: 28:ed15db12298d | |
847 | tag: tip |
|
847 | tag: tip | |
848 | parent: 27:eb5adec0b43b |
|
848 | parent: 27:eb5adec0b43b | |
849 | parent: 26:67db8847a540 |
|
849 | parent: 26:67db8847a540 | |
850 | user: test |
|
850 | user: test | |
851 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
851 | date: Thu Jan 01 00:00:00 1970 +0000 | |
852 | summary: merge bar (with conflicts) |
|
852 | summary: merge bar (with conflicts) | |
853 |
|
853 | |||
854 |
|
854 | |||
855 | $ hg rm aa |
|
855 | $ hg rm aa | |
856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' | |
857 | $ hg log --config diff.git=1 -pr . |
|
857 | $ hg log --config diff.git=1 -pr . | |
858 | changeset: 29:0eeafd043f63 |
|
858 | changeset: 29:0eeafd043f63 | |
859 | tag: tip |
|
859 | tag: tip | |
860 | parent: 27:eb5adec0b43b |
|
860 | parent: 27:eb5adec0b43b | |
861 | parent: 26:67db8847a540 |
|
861 | parent: 26:67db8847a540 | |
862 | user: test |
|
862 | user: test | |
863 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
863 | date: Thu Jan 01 00:00:00 1970 +0000 | |
864 | summary: merge bar (with conflicts, amended) |
|
864 | summary: merge bar (with conflicts, amended) | |
865 |
|
865 | |||
866 | diff --git a/aa b/aa |
|
866 | diff --git a/aa b/aa | |
867 | deleted file mode 100644 |
|
867 | deleted file mode 100644 | |
868 | --- a/aa |
|
868 | --- a/aa | |
869 | +++ /dev/null |
|
869 | +++ /dev/null | |
870 | @@ -1,4 +0,0 @@ |
|
870 | @@ -1,4 +0,0 @@ | |
871 | -a |
|
871 | -a | |
872 | -a |
|
872 | -a | |
873 | -aa |
|
873 | -aa | |
874 | -aa |
|
874 | -aa | |
875 |
|
875 | |||
876 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
876 | Issue 3445: amending with --close-branch a commit that created a new head should fail | |
877 | This shouldn't be possible: |
|
877 | This shouldn't be possible: | |
878 |
|
878 | |||
879 | $ hg up -q default |
|
879 | $ hg up -q default | |
880 | $ hg branch closewithamend |
|
880 | $ hg branch closewithamend | |
881 | marked working directory as branch closewithamend |
|
881 | marked working directory as branch closewithamend | |
882 | $ echo foo > foo |
|
882 | $ echo foo > foo | |
883 | $ hg add foo |
|
883 | $ hg add foo | |
884 | $ hg ci -m.. |
|
884 | $ hg ci -m.. | |
885 | $ hg ci --amend --close-branch -m 'closing' |
|
885 | $ hg ci --amend --close-branch -m 'closing' | |
886 | abort: can only close branch heads |
|
886 | abort: can only close branch heads | |
887 | [10] |
|
887 | [10] | |
888 |
|
888 | |||
889 | This silliness fails: |
|
889 | This silliness fails: | |
890 |
|
890 | |||
891 | $ hg branch silliness |
|
891 | $ hg branch silliness | |
892 | marked working directory as branch silliness |
|
892 | marked working directory as branch silliness | |
893 | $ echo b >> b |
|
893 | $ echo b >> b | |
894 | $ hg ci --close-branch -m'open and close' |
|
894 | $ hg ci --close-branch -m'open and close' | |
895 | abort: branch "silliness" has no heads to close |
|
895 | abort: branch "silliness" has no heads to close | |
896 | [10] |
|
896 | [10] | |
897 |
|
897 | |||
898 | Test that amend with --secret creates new secret changeset forcibly |
|
898 | Test that amend with --secret creates new secret changeset forcibly | |
899 | --------------------------------------------------------------------- |
|
899 | --------------------------------------------------------------------- | |
900 |
|
900 | |||
901 | $ hg phase '.^::.' |
|
901 | $ hg phase '.^::.' | |
902 | 29: draft |
|
902 | 29: draft | |
903 | 30: draft |
|
903 | 30: draft | |
904 | $ hg commit --amend --secret -m 'amend as secret' -q |
|
904 | $ hg commit --amend --secret -m 'amend as secret' -q | |
905 | $ hg phase '.^::.' |
|
905 | $ hg phase '.^::.' | |
906 | 29: draft |
|
906 | 29: draft | |
907 | 31: secret |
|
907 | 31: secret | |
908 |
|
908 | |||
909 | Test that amend with --edit invokes editor forcibly |
|
909 | Test that amend with --edit invokes editor forcibly | |
910 | --------------------------------------------------- |
|
910 | --------------------------------------------------- | |
911 |
|
911 | |||
912 | $ hg parents --template "{desc}\n" |
|
912 | $ hg parents --template "{desc}\n" | |
913 | amend as secret |
|
913 | amend as secret | |
914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" |
|
914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" | |
915 | $ hg parents --template "{desc}\n" |
|
915 | $ hg parents --template "{desc}\n" | |
916 | editor should be suppressed |
|
916 | editor should be suppressed | |
917 |
|
917 | |||
918 | $ hg status --rev '.^1::.' |
|
918 | $ hg status --rev '.^1::.' | |
919 | A foo |
|
919 | A foo | |
920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit | |
921 | editor should be invoked |
|
921 | editor should be invoked | |
922 |
|
922 | |||
923 |
|
923 | |||
924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
925 | HG: Leave message empty to abort commit. |
|
925 | HG: Leave message empty to abort commit. | |
926 | HG: -- |
|
926 | HG: -- | |
927 | HG: user: test |
|
927 | HG: user: test | |
928 | HG: branch 'silliness' |
|
928 | HG: branch 'silliness' | |
929 | HG: added foo |
|
929 | HG: added foo | |
930 | $ hg parents --template "{desc}\n" |
|
930 | $ hg parents --template "{desc}\n" | |
931 | editor should be invoked |
|
931 | editor should be invoked | |
932 |
|
932 | |||
933 | Test that amend with --no-edit avoids the editor |
|
933 | Test that amend with --no-edit avoids the editor | |
934 | ------------------------------------------------ |
|
934 | ------------------------------------------------ | |
935 |
|
935 | |||
936 | $ hg commit --amend -m "before anything happens" |
|
936 | $ hg commit --amend -m "before anything happens" | |
937 | $ hg parents --template "{desc}\n" |
|
937 | $ hg parents --template "{desc}\n" | |
938 | before anything happens |
|
938 | before anything happens | |
939 | $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed" |
|
939 | $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed" | |
940 | $ hg parents --template "{desc}\n" |
|
940 | $ hg parents --template "{desc}\n" | |
941 | editor should be suppressed |
|
941 | editor should be suppressed | |
942 |
|
942 | |||
943 | (We need a file change here since we won't have a message change) |
|
943 | (We need a file change here since we won't have a message change) | |
944 | $ cp foo foo.orig |
|
944 | $ cp foo foo.orig | |
945 | $ echo hi >> foo |
|
945 | $ echo hi >> foo | |
946 | $ HGEDITOR=cat hg commit --amend --no-edit |
|
946 | $ HGEDITOR=cat hg commit --amend --no-edit | |
947 | $ hg parents --template "{desc}\n" |
|
947 | $ hg parents --template "{desc}\n" | |
948 | editor should be suppressed |
|
948 | editor should be suppressed | |
949 | $ hg status -mar |
|
949 | $ hg status -mar | |
950 | (Let's undo adding that "hi" so later tests don't need to be adjusted) |
|
950 | (Let's undo adding that "hi" so later tests don't need to be adjusted) | |
951 | $ mv foo.orig foo |
|
951 | $ mv foo.orig foo | |
952 | $ hg commit --amend --no-edit |
|
952 | $ hg commit --amend --no-edit | |
953 |
|
953 | |||
954 | Test that "diff()" in committemplate works correctly for amending |
|
954 | Test that "diff()" in committemplate works correctly for amending | |
955 | ----------------------------------------------------------------- |
|
955 | ----------------------------------------------------------------- | |
956 |
|
956 | |||
957 | $ cat >> .hg/hgrc <<EOF |
|
957 | $ cat >> .hg/hgrc <<EOF | |
958 | > [committemplate] |
|
958 | > [committemplate] | |
959 | > changeset.commit.amend = {desc}\n |
|
959 | > changeset.commit.amend = {desc}\n | |
960 | > HG: M: {file_mods} |
|
960 | > HG: M: {file_mods} | |
961 | > HG: A: {file_adds} |
|
961 | > HG: A: {file_adds} | |
962 | > HG: R: {file_dels} |
|
962 | > HG: R: {file_dels} | |
963 | > {splitlines(diff()) % 'HG: {line}\n'} |
|
963 | > {splitlines(diff()) % 'HG: {line}\n'} | |
964 | > EOF |
|
964 | > EOF | |
965 |
|
965 | |||
966 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" |
|
966 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" | |
967 | M: |
|
967 | M: | |
968 | A: foo |
|
968 | A: foo | |
969 | R: |
|
969 | R: | |
970 | $ hg status -amr |
|
970 | $ hg status -amr | |
971 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" |
|
971 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" | |
972 | expecting diff of foo |
|
972 | expecting diff of foo | |
973 |
|
973 | |||
974 | HG: M: |
|
974 | HG: M: | |
975 | HG: A: foo |
|
975 | HG: A: foo | |
976 | HG: R: |
|
976 | HG: R: | |
977 | HG: diff -r 0eeafd043f63 foo |
|
977 | HG: diff -r 0eeafd043f63 foo | |
978 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
978 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
979 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
979 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
980 | HG: @@ -0,0 +1,1 @@ |
|
980 | HG: @@ -0,0 +1,1 @@ | |
981 | HG: +foo |
|
981 | HG: +foo | |
982 |
|
982 | |||
983 | $ echo y > y |
|
983 | $ echo y > y | |
984 | $ hg add y |
|
984 | $ hg add y | |
985 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" |
|
985 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" | |
986 | expecting diff of foo and y |
|
986 | expecting diff of foo and y | |
987 |
|
987 | |||
988 | HG: M: |
|
988 | HG: M: | |
989 | HG: A: foo y |
|
989 | HG: A: foo y | |
990 | HG: R: |
|
990 | HG: R: | |
991 | HG: diff -r 0eeafd043f63 foo |
|
991 | HG: diff -r 0eeafd043f63 foo | |
992 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
992 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
993 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
993 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
994 | HG: @@ -0,0 +1,1 @@ |
|
994 | HG: @@ -0,0 +1,1 @@ | |
995 | HG: +foo |
|
995 | HG: +foo | |
996 | HG: diff -r 0eeafd043f63 y |
|
996 | HG: diff -r 0eeafd043f63 y | |
997 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
997 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
998 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
998 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
999 | HG: @@ -0,0 +1,1 @@ |
|
999 | HG: @@ -0,0 +1,1 @@ | |
1000 | HG: +y |
|
1000 | HG: +y | |
1001 |
|
1001 | |||
1002 | $ hg rm a |
|
1002 | $ hg rm a | |
1003 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" |
|
1003 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" | |
1004 | expecting diff of a, foo and y |
|
1004 | expecting diff of a, foo and y | |
1005 |
|
1005 | |||
1006 | HG: M: |
|
1006 | HG: M: | |
1007 | HG: A: foo y |
|
1007 | HG: A: foo y | |
1008 | HG: R: a |
|
1008 | HG: R: a | |
1009 | HG: diff -r 0eeafd043f63 a |
|
1009 | HG: diff -r 0eeafd043f63 a | |
1010 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1010 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1011 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1011 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1012 | HG: @@ -1,2 +0,0 @@ |
|
1012 | HG: @@ -1,2 +0,0 @@ | |
1013 | HG: -a |
|
1013 | HG: -a | |
1014 | HG: -a |
|
1014 | HG: -a | |
1015 | HG: diff -r 0eeafd043f63 foo |
|
1015 | HG: diff -r 0eeafd043f63 foo | |
1016 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1016 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1017 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1017 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1018 | HG: @@ -0,0 +1,1 @@ |
|
1018 | HG: @@ -0,0 +1,1 @@ | |
1019 | HG: +foo |
|
1019 | HG: +foo | |
1020 | HG: diff -r 0eeafd043f63 y |
|
1020 | HG: diff -r 0eeafd043f63 y | |
1021 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1021 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1022 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1022 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1023 | HG: @@ -0,0 +1,1 @@ |
|
1023 | HG: @@ -0,0 +1,1 @@ | |
1024 | HG: +y |
|
1024 | HG: +y | |
1025 |
|
1025 | |||
1026 | $ hg rm x |
|
1026 | $ hg rm x | |
1027 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" |
|
1027 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" | |
1028 | expecting diff of a, foo, x and y |
|
1028 | expecting diff of a, foo, x and y | |
1029 |
|
1029 | |||
1030 | HG: M: |
|
1030 | HG: M: | |
1031 | HG: A: foo y |
|
1031 | HG: A: foo y | |
1032 | HG: R: a x |
|
1032 | HG: R: a x | |
1033 | HG: diff -r 0eeafd043f63 a |
|
1033 | HG: diff -r 0eeafd043f63 a | |
1034 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1034 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1035 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1035 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1036 | HG: @@ -1,2 +0,0 @@ |
|
1036 | HG: @@ -1,2 +0,0 @@ | |
1037 | HG: -a |
|
1037 | HG: -a | |
1038 | HG: -a |
|
1038 | HG: -a | |
1039 | HG: diff -r 0eeafd043f63 foo |
|
1039 | HG: diff -r 0eeafd043f63 foo | |
1040 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1040 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1041 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1041 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1042 | HG: @@ -0,0 +1,1 @@ |
|
1042 | HG: @@ -0,0 +1,1 @@ | |
1043 | HG: +foo |
|
1043 | HG: +foo | |
1044 | HG: diff -r 0eeafd043f63 x |
|
1044 | HG: diff -r 0eeafd043f63 x | |
1045 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1045 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 | |
1046 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1046 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1047 | HG: @@ -1,1 +0,0 @@ |
|
1047 | HG: @@ -1,1 +0,0 @@ | |
1048 | HG: -x |
|
1048 | HG: -x | |
1049 | HG: diff -r 0eeafd043f63 y |
|
1049 | HG: diff -r 0eeafd043f63 y | |
1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1051 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1051 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1052 | HG: @@ -0,0 +1,1 @@ |
|
1052 | HG: @@ -0,0 +1,1 @@ | |
1053 | HG: +y |
|
1053 | HG: +y | |
1054 |
|
1054 | |||
1055 | $ echo cccc >> cc |
|
1055 | $ echo cccc >> cc | |
1056 | $ hg status -amr |
|
1056 | $ hg status -amr | |
1057 | M cc |
|
1057 | M cc | |
1058 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc |
|
1058 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc | |
1059 | cc should be excluded |
|
1059 | cc should be excluded | |
1060 |
|
1060 | |||
1061 | HG: M: |
|
1061 | HG: M: | |
1062 | HG: A: foo y |
|
1062 | HG: A: foo y | |
1063 | HG: R: a x |
|
1063 | HG: R: a x | |
1064 | HG: diff -r 0eeafd043f63 a |
|
1064 | HG: diff -r 0eeafd043f63 a | |
1065 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1065 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1066 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1066 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1067 | HG: @@ -1,2 +0,0 @@ |
|
1067 | HG: @@ -1,2 +0,0 @@ | |
1068 | HG: -a |
|
1068 | HG: -a | |
1069 | HG: -a |
|
1069 | HG: -a | |
1070 | HG: diff -r 0eeafd043f63 foo |
|
1070 | HG: diff -r 0eeafd043f63 foo | |
1071 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1071 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1072 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1072 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1073 | HG: @@ -0,0 +1,1 @@ |
|
1073 | HG: @@ -0,0 +1,1 @@ | |
1074 | HG: +foo |
|
1074 | HG: +foo | |
1075 | HG: diff -r 0eeafd043f63 x |
|
1075 | HG: diff -r 0eeafd043f63 x | |
1076 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1076 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 | |
1077 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1077 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1078 | HG: @@ -1,1 +0,0 @@ |
|
1078 | HG: @@ -1,1 +0,0 @@ | |
1079 | HG: -x |
|
1079 | HG: -x | |
1080 | HG: diff -r 0eeafd043f63 y |
|
1080 | HG: diff -r 0eeafd043f63 y | |
1081 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1081 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1082 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1082 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1083 | HG: @@ -0,0 +1,1 @@ |
|
1083 | HG: @@ -0,0 +1,1 @@ | |
1084 | HG: +y |
|
1084 | HG: +y | |
1085 |
|
1085 | |||
1086 | Check for issue4405 |
|
1086 | Check for issue4405 | |
1087 | ------------------- |
|
1087 | ------------------- | |
1088 |
|
1088 | |||
1089 | Setup the repo with a file that gets moved in a second commit. |
|
1089 | Setup the repo with a file that gets moved in a second commit. | |
1090 | $ hg init repo |
|
1090 | $ hg init repo | |
1091 | $ cd repo |
|
1091 | $ cd repo | |
1092 | $ touch a0 |
|
1092 | $ touch a0 | |
1093 | $ hg add a0 |
|
1093 | $ hg add a0 | |
1094 | $ hg commit -m a0 |
|
1094 | $ hg commit -m a0 | |
1095 | $ hg mv a0 a1 |
|
1095 | $ hg mv a0 a1 | |
1096 | $ hg commit -m a1 |
|
1096 | $ hg commit -m a1 | |
1097 | $ hg up -q 0 |
|
1097 | $ hg up -q 0 | |
1098 | $ hg log -G --template '{rev} {desc}' |
|
1098 | $ hg log -G --template '{rev} {desc}' | |
1099 | o 1 a1 |
|
1099 | o 1 a1 | |
1100 | | |
|
1100 | | | |
1101 | @ 0 a0 |
|
1101 | @ 0 a0 | |
1102 |
|
1102 | |||
1103 |
|
1103 | |||
1104 | Now we branch the repro, but re-use the file contents, so we have a divergence |
|
1104 | Now we branch the repro, but re-use the file contents, so we have a divergence | |
1105 | in the file revlog topology and the changelog topology. |
|
1105 | in the file revlog topology and the changelog topology. | |
1106 | $ hg revert --rev 1 --all |
|
1106 | $ hg revert --rev 1 --all | |
1107 | removing a0 |
|
1107 | removing a0 | |
1108 | adding a1 |
|
1108 | adding a1 | |
1109 | $ hg ci -qm 'a1-amend' |
|
1109 | $ hg ci -qm 'a1-amend' | |
1110 | $ hg log -G --template '{rev} {desc}' |
|
1110 | $ hg log -G --template '{rev} {desc}' | |
1111 | @ 2 a1-amend |
|
1111 | @ 2 a1-amend | |
1112 | | |
|
1112 | | | |
1113 | | o 1 a1 |
|
1113 | | o 1 a1 | |
1114 | |/ |
|
1114 | |/ | |
1115 | o 0 a0 |
|
1115 | o 0 a0 | |
1116 |
|
1116 | |||
1117 |
|
1117 | |||
1118 | The way mercurial does amends is by folding the working copy and old commit |
|
1118 | The way mercurial does amends is by folding the working copy and old commit | |
1119 | together into another commit (rev 3). During this process, _findlimit is called |
|
1119 | together into another commit (rev 3). During this process, _findlimit is called | |
1120 | to check how far back to look for the transitive closure of file copy |
|
1120 | to check how far back to look for the transitive closure of file copy | |
1121 | information, but due to the divergence of the filelog and changelog graph |
|
1121 | information, but due to the divergence of the filelog and changelog graph | |
1122 | topologies, before _findlimit was fixed, it returned a rev which was not far |
|
1122 | topologies, before _findlimit was fixed, it returned a rev which was not far | |
1123 | enough back in this case. |
|
1123 | enough back in this case. | |
1124 | $ hg mv a1 a2 |
|
1124 | $ hg mv a1 a2 | |
1125 | $ hg status --copies --rev 0 |
|
1125 | $ hg status --copies --rev 0 | |
1126 | A a2 |
|
1126 | A a2 | |
1127 | a0 |
|
1127 | a0 | |
1128 | R a0 |
|
1128 | R a0 | |
1129 | $ hg ci --amend -q |
|
1129 | $ hg ci --amend -q | |
1130 | $ hg log -G --template '{rev} {desc}' |
|
1130 | $ hg log -G --template '{rev} {desc}' | |
1131 | @ 3 a1-amend |
|
1131 | @ 3 a1-amend | |
1132 | | |
|
1132 | | | |
1133 | | o 1 a1 |
|
1133 | | o 1 a1 | |
1134 | |/ |
|
1134 | |/ | |
1135 | o 0 a0 |
|
1135 | o 0 a0 | |
1136 |
|
1136 | |||
1137 |
|
1137 | |||
1138 | Before the fix, the copy information was lost. |
|
1138 | Before the fix, the copy information was lost. | |
1139 | $ hg status --copies --rev 0 |
|
1139 | $ hg status --copies --rev 0 | |
1140 | A a2 |
|
1140 | A a2 | |
1141 | a0 |
|
1141 | a0 | |
1142 | R a0 |
|
1142 | R a0 | |
1143 | $ cd .. |
|
1143 | $ cd .. | |
1144 |
|
1144 | |||
1145 | Check that amend properly preserve rename from directory rename (issue-4516) |
|
1145 | Check that amend properly preserve rename from directory rename (issue-4516) | |
1146 |
|
1146 | |||
1147 | If a parent of the merge renames a full directory, any files added to the old |
|
1147 | If a parent of the merge renames a full directory, any files added to the old | |
1148 | directory in the other parent will be renamed to the new directory. For some |
|
1148 | directory in the other parent will be renamed to the new directory. For some | |
1149 | reason, the rename metadata was when amending such merge. This test ensure we |
|
1149 | reason, the rename metadata was when amending such merge. This test ensure we | |
1150 | do not regress. We have a dedicated repo because it needs a setup with renamed |
|
1150 | do not regress. We have a dedicated repo because it needs a setup with renamed | |
1151 | directory) |
|
1151 | directory) | |
1152 |
|
1152 | |||
1153 | $ hg init issue4516 |
|
1153 | $ hg init issue4516 | |
1154 | $ cd issue4516 |
|
1154 | $ cd issue4516 | |
1155 | $ mkdir olddirname |
|
1155 | $ mkdir olddirname | |
1156 | $ echo line1 > olddirname/commonfile.py |
|
1156 | $ echo line1 > olddirname/commonfile.py | |
1157 | $ hg add olddirname/commonfile.py |
|
1157 | $ hg add olddirname/commonfile.py | |
1158 | $ hg ci -m first |
|
1158 | $ hg ci -m first | |
1159 |
|
1159 | |||
1160 | $ hg branch newdirname |
|
1160 | $ hg branch newdirname | |
1161 | marked working directory as branch newdirname |
|
1161 | marked working directory as branch newdirname | |
1162 | (branches are permanent and global, did you want a bookmark?) |
|
1162 | (branches are permanent and global, did you want a bookmark?) | |
1163 | $ hg mv olddirname newdirname |
|
1163 | $ hg mv olddirname newdirname | |
1164 | moving olddirname/commonfile.py to newdirname/commonfile.py |
|
1164 | moving olddirname/commonfile.py to newdirname/commonfile.py | |
1165 | $ hg ci -m rename |
|
1165 | $ hg ci -m rename | |
1166 |
|
1166 | |||
1167 | $ hg update default |
|
1167 | $ hg update default | |
1168 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1168 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1169 | $ echo line1 > olddirname/newfile.py |
|
1169 | $ echo line1 > olddirname/newfile.py | |
1170 | $ hg add olddirname/newfile.py |
|
1170 | $ hg add olddirname/newfile.py | |
1171 | $ hg ci -m log |
|
1171 | $ hg ci -m log | |
1172 |
|
1172 | |||
1173 | $ hg up newdirname |
|
1173 | $ hg up newdirname | |
1174 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1174 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1175 | $ # create newdirname/newfile.py |
|
1175 | $ # create newdirname/newfile.py | |
1176 | $ hg merge default |
|
1176 | $ hg merge default | |
1177 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1177 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1178 | (branch merge, don't forget to commit) |
|
1178 | (branch merge, don't forget to commit) | |
1179 | $ hg ci -m add |
|
1179 | $ hg ci -m add | |
1180 | $ |
|
1180 | $ | |
1181 | $ hg debugrename newdirname/newfile.py |
|
1181 | $ hg debugrename newdirname/newfile.py | |
1182 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1182 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def | |
1183 | $ hg status -C --change . |
|
1183 | $ hg status -C --change . | |
1184 | A newdirname/newfile.py |
|
1184 | A newdirname/newfile.py | |
1185 | $ hg status -C --rev 1 |
|
1185 | $ hg status -C --rev 1 | |
1186 | A newdirname/newfile.py |
|
1186 | A newdirname/newfile.py | |
1187 | $ hg status -C --rev 2 |
|
1187 | $ hg status -C --rev 2 | |
1188 | A newdirname/commonfile.py |
|
1188 | A newdirname/commonfile.py | |
1189 | olddirname/commonfile.py |
|
1189 | olddirname/commonfile.py | |
1190 | A newdirname/newfile.py |
|
1190 | A newdirname/newfile.py | |
1191 | olddirname/newfile.py |
|
1191 | olddirname/newfile.py | |
1192 | R olddirname/commonfile.py |
|
1192 | R olddirname/commonfile.py | |
1193 | R olddirname/newfile.py |
|
1193 | R olddirname/newfile.py | |
1194 | $ hg debugindex newdirname/newfile.py |
|
1194 | $ hg debugindex newdirname/newfile.py | |
1195 | rev linkrev nodeid p1 p2 |
|
1195 | rev linkrev nodeid p1 p2 | |
1196 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1196 | 0 3 34a4d536c0c0 000000000000 000000000000 | |
1197 |
|
1197 | |||
1198 | $ echo a >> newdirname/commonfile.py |
|
1198 | $ echo a >> newdirname/commonfile.py | |
1199 | $ hg ci --amend -m bug |
|
1199 | $ hg ci --amend -m bug | |
1200 | $ hg debugrename newdirname/newfile.py |
|
1200 | $ hg debugrename newdirname/newfile.py | |
1201 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1201 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def | |
1202 | $ hg debugindex newdirname/newfile.py |
|
1202 | $ hg debugindex newdirname/newfile.py | |
1203 | rev linkrev nodeid p1 p2 |
|
1203 | rev linkrev nodeid p1 p2 | |
1204 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1204 | 0 3 34a4d536c0c0 000000000000 000000000000 | |
1205 |
|
1205 | |||
1206 | #if execbit |
|
1206 | #if execbit | |
1207 |
|
1207 | |||
1208 | Test if amend preserves executable bit changes |
|
1208 | Test if amend preserves executable bit changes | |
1209 | $ chmod +x newdirname/commonfile.py |
|
1209 | $ chmod +x newdirname/commonfile.py | |
1210 | $ hg ci -m chmod |
|
1210 | $ hg ci -m chmod | |
1211 | $ hg ci --amend -m "chmod amended" |
|
1211 | $ hg ci --amend -m "chmod amended" | |
1212 | $ hg ci --amend -m "chmod amended second time" |
|
1212 | $ hg ci --amend -m "chmod amended second time" | |
1213 | $ hg log -p --git -r . |
|
1213 | $ hg log -p --git -r . | |
1214 | changeset: 7:b1326f52dddf |
|
1214 | changeset: 7:b1326f52dddf | |
1215 | branch: newdirname |
|
1215 | branch: newdirname | |
1216 | tag: tip |
|
1216 | tag: tip | |
1217 | parent: 4:7fd235f7cb2f |
|
1217 | parent: 4:7fd235f7cb2f | |
1218 | user: test |
|
1218 | user: test | |
1219 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1219 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1220 | summary: chmod amended second time |
|
1220 | summary: chmod amended second time | |
1221 |
|
1221 | |||
1222 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py |
|
1222 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py | |
1223 | old mode 100644 |
|
1223 | old mode 100644 | |
1224 | new mode 100755 |
|
1224 | new mode 100755 | |
1225 |
|
1225 | |||
1226 | #endif |
|
1226 | #endif | |
1227 |
|
1227 | |||
1228 | Test amend with file inclusion options |
|
1228 | Test amend with file inclusion options | |
1229 | -------------------------------------- |
|
1229 | -------------------------------------- | |
1230 |
|
1230 | |||
1231 | These tests ensure that we are always amending some files that were part of the |
|
1231 | These tests ensure that we are always amending some files that were part of the | |
1232 | pre-amend commit. We want to test that the remaining files in the pre-amend |
|
1232 | pre-amend commit. We want to test that the remaining files in the pre-amend | |
1233 | commit were not changed in the amended commit. We do so by performing a diff of |
|
1233 | commit were not changed in the amended commit. We do so by performing a diff of | |
1234 | the amended commit against its parent commit. |
|
1234 | the amended commit against its parent commit. | |
1235 | $ cd .. |
|
1235 | $ cd .. | |
1236 | $ hg init testfileinclusions |
|
1236 | $ hg init testfileinclusions | |
1237 | $ cd testfileinclusions |
|
1237 | $ cd testfileinclusions | |
1238 | $ echo a > a |
|
1238 | $ echo a > a | |
1239 | $ echo b > b |
|
1239 | $ echo b > b | |
1240 | $ hg commit -Aqm "Adding a and b" |
|
1240 | $ hg commit -Aqm "Adding a and b" | |
1241 |
|
1241 | |||
1242 | Only add changes to a particular file |
|
1242 | Only add changes to a particular file | |
1243 | $ echo a >> a |
|
1243 | $ echo a >> a | |
1244 | $ echo b >> b |
|
1244 | $ echo b >> b | |
1245 | $ hg commit --amend -I a |
|
1245 | $ hg commit --amend -I a | |
1246 | $ hg diff --git -r null -r . |
|
1246 | $ hg diff --git -r null -r . | |
1247 | diff --git a/a b/a |
|
1247 | diff --git a/a b/a | |
1248 | new file mode 100644 |
|
1248 | new file mode 100644 | |
1249 | --- /dev/null |
|
1249 | --- /dev/null | |
1250 | +++ b/a |
|
1250 | +++ b/a | |
1251 | @@ -0,0 +1,2 @@ |
|
1251 | @@ -0,0 +1,2 @@ | |
1252 | +a |
|
1252 | +a | |
1253 | +a |
|
1253 | +a | |
1254 | diff --git a/b b/b |
|
1254 | diff --git a/b b/b | |
1255 | new file mode 100644 |
|
1255 | new file mode 100644 | |
1256 | --- /dev/null |
|
1256 | --- /dev/null | |
1257 | +++ b/b |
|
1257 | +++ b/b | |
1258 | @@ -0,0 +1,1 @@ |
|
1258 | @@ -0,0 +1,1 @@ | |
1259 | +b |
|
1259 | +b | |
1260 |
|
1260 | |||
1261 | $ echo a >> a |
|
1261 | $ echo a >> a | |
1262 | $ hg commit --amend b |
|
1262 | $ hg commit --amend b | |
1263 | $ hg diff --git -r null -r . |
|
1263 | $ hg diff --git -r null -r . | |
1264 | diff --git a/a b/a |
|
1264 | diff --git a/a b/a | |
1265 | new file mode 100644 |
|
1265 | new file mode 100644 | |
1266 | --- /dev/null |
|
1266 | --- /dev/null | |
1267 | +++ b/a |
|
1267 | +++ b/a | |
1268 | @@ -0,0 +1,2 @@ |
|
1268 | @@ -0,0 +1,2 @@ | |
1269 | +a |
|
1269 | +a | |
1270 | +a |
|
1270 | +a | |
1271 | diff --git a/b b/b |
|
1271 | diff --git a/b b/b | |
1272 | new file mode 100644 |
|
1272 | new file mode 100644 | |
1273 | --- /dev/null |
|
1273 | --- /dev/null | |
1274 | +++ b/b |
|
1274 | +++ b/b | |
1275 | @@ -0,0 +1,2 @@ |
|
1275 | @@ -0,0 +1,2 @@ | |
1276 | +b |
|
1276 | +b | |
1277 | +b |
|
1277 | +b | |
1278 |
|
1278 | |||
1279 | Exclude changes to a particular file |
|
1279 | Exclude changes to a particular file | |
1280 | $ echo b >> b |
|
1280 | $ echo b >> b | |
1281 | $ hg commit --amend -X a |
|
1281 | $ hg commit --amend -X a | |
1282 | $ hg diff --git -r null -r . |
|
1282 | $ hg diff --git -r null -r . | |
1283 | diff --git a/a b/a |
|
1283 | diff --git a/a b/a | |
1284 | new file mode 100644 |
|
1284 | new file mode 100644 | |
1285 | --- /dev/null |
|
1285 | --- /dev/null | |
1286 | +++ b/a |
|
1286 | +++ b/a | |
1287 | @@ -0,0 +1,2 @@ |
|
1287 | @@ -0,0 +1,2 @@ | |
1288 | +a |
|
1288 | +a | |
1289 | +a |
|
1289 | +a | |
1290 | diff --git a/b b/b |
|
1290 | diff --git a/b b/b | |
1291 | new file mode 100644 |
|
1291 | new file mode 100644 | |
1292 | --- /dev/null |
|
1292 | --- /dev/null | |
1293 | +++ b/b |
|
1293 | +++ b/b | |
1294 | @@ -0,0 +1,3 @@ |
|
1294 | @@ -0,0 +1,3 @@ | |
1295 | +b |
|
1295 | +b | |
1296 | +b |
|
1296 | +b | |
1297 | +b |
|
1297 | +b | |
1298 |
|
1298 | |||
1299 | Check the addremove flag |
|
1299 | Check the addremove flag | |
1300 | $ echo c > c |
|
1300 | $ echo c > c | |
1301 | $ rm a |
|
1301 | $ rm a | |
1302 | $ hg commit --amend -A |
|
1302 | $ hg commit --amend -A | |
1303 | removing a |
|
1303 | removing a | |
1304 | adding c |
|
1304 | adding c | |
1305 | $ hg diff --git -r null -r . |
|
1305 | $ hg diff --git -r null -r . | |
1306 | diff --git a/b b/b |
|
1306 | diff --git a/b b/b | |
1307 | new file mode 100644 |
|
1307 | new file mode 100644 | |
1308 | --- /dev/null |
|
1308 | --- /dev/null | |
1309 | +++ b/b |
|
1309 | +++ b/b | |
1310 | @@ -0,0 +1,3 @@ |
|
1310 | @@ -0,0 +1,3 @@ | |
1311 | +b |
|
1311 | +b | |
1312 | +b |
|
1312 | +b | |
1313 | +b |
|
1313 | +b | |
1314 | diff --git a/c b/c |
|
1314 | diff --git a/c b/c | |
1315 | new file mode 100644 |
|
1315 | new file mode 100644 | |
1316 | --- /dev/null |
|
1316 | --- /dev/null | |
1317 | +++ b/c |
|
1317 | +++ b/c | |
1318 | @@ -0,0 +1,1 @@ |
|
1318 | @@ -0,0 +1,1 @@ | |
1319 | +c |
|
1319 | +c |
@@ -1,596 +1,596 b'' | |||||
1 | Test uncommit - set up the config |
|
1 | Test uncommit - set up the config | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH <<EOF |
|
3 | $ cat >> $HGRCPATH <<EOF | |
4 | > [experimental] |
|
4 | > [experimental] | |
5 | > evolution.createmarkers=True |
|
5 | > evolution.createmarkers=True | |
6 | > evolution.allowunstable=True |
|
6 | > evolution.allowunstable=True | |
7 | > [extensions] |
|
7 | > [extensions] | |
8 | > uncommit = |
|
8 | > uncommit = | |
9 | > drawdag=$TESTDIR/drawdag.py |
|
9 | > drawdag=$TESTDIR/drawdag.py | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 | Build up a repo |
|
12 | Build up a repo | |
13 |
|
13 | |||
14 | $ hg init repo |
|
14 | $ hg init repo | |
15 | $ cd repo |
|
15 | $ cd repo | |
16 | $ hg bookmark foo |
|
16 | $ hg bookmark foo | |
17 |
|
17 | |||
18 | Help for uncommit |
|
18 | Help for uncommit | |
19 |
|
19 | |||
20 | $ hg help uncommit |
|
20 | $ hg help uncommit | |
21 | hg uncommit [OPTION]... [FILE]... |
|
21 | hg uncommit [OPTION]... [FILE]... | |
22 |
|
22 | |||
23 | uncommit part or all of a local changeset |
|
23 | uncommit part or all of a local changeset | |
24 |
|
24 | |||
25 | This command undoes the effect of a local commit, returning the affected |
|
25 | This command undoes the effect of a local commit, returning the affected | |
26 | files to their uncommitted state. This means that files modified or |
|
26 | files to their uncommitted state. This means that files modified or | |
27 | deleted in the changeset will be left unchanged, and so will remain |
|
27 | deleted in the changeset will be left unchanged, and so will remain | |
28 | modified in the working directory. |
|
28 | modified in the working directory. | |
29 |
|
29 | |||
30 | If no files are specified, the commit will be pruned, unless --keep is |
|
30 | If no files are specified, the commit will be pruned, unless --keep is | |
31 | given. |
|
31 | given. | |
32 |
|
32 | |||
33 | (use 'hg help -e uncommit' to show help for the uncommit extension) |
|
33 | (use 'hg help -e uncommit' to show help for the uncommit extension) | |
34 |
|
34 | |||
35 | options ([+] can be repeated): |
|
35 | options ([+] can be repeated): | |
36 |
|
36 | |||
37 | --keep allow an empty commit after uncommitting |
|
37 | --keep allow an empty commit after uncommitting | |
38 | --allow-dirty-working-copy allow uncommit with outstanding changes |
|
38 | --allow-dirty-working-copy allow uncommit with outstanding changes | |
39 | -n --note TEXT store a note on uncommit |
|
39 | -n --note TEXT store a note on uncommit | |
40 | -I --include PATTERN [+] include names matching the given patterns |
|
40 | -I --include PATTERN [+] include names matching the given patterns | |
41 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
41 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
42 | -m --message TEXT use text as commit message |
|
42 | -m --message TEXT use text as commit message | |
43 | -l --logfile FILE read commit message from file |
|
43 | -l --logfile FILE read commit message from file | |
44 | -d --date DATE record the specified date as commit date |
|
44 | -d --date DATE record the specified date as commit date | |
45 | -u --user USER record the specified user as committer |
|
45 | -u --user USER record the specified user as committer | |
46 | -D --currentdate record the current date as commit date |
|
46 | -D --currentdate record the current date as commit date | |
47 | -U --currentuser record the current user as committer |
|
47 | -U --currentuser record the current user as committer | |
48 |
|
48 | |||
49 | (some details hidden, use --verbose to show complete help) |
|
49 | (some details hidden, use --verbose to show complete help) | |
50 |
|
50 | |||
51 | Uncommit with no commits should fail |
|
51 | Uncommit with no commits should fail | |
52 |
|
52 | |||
53 | $ hg uncommit |
|
53 | $ hg uncommit | |
54 | abort: cannot uncommit the null revision |
|
54 | abort: cannot uncommit the null revision | |
55 | (no changeset checked out) |
|
55 | (no changeset checked out) | |
56 | [10] |
|
56 | [10] | |
57 |
|
57 | |||
58 | Create some commits |
|
58 | Create some commits | |
59 |
|
59 | |||
60 | $ touch files |
|
60 | $ touch files | |
61 | $ hg add files |
|
61 | $ hg add files | |
62 | $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done |
|
62 | $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done | |
63 | $ ls -A |
|
63 | $ ls -A | |
64 | .hg |
|
64 | .hg | |
65 | file-a |
|
65 | file-a | |
66 | file-ab |
|
66 | file-ab | |
67 | file-abc |
|
67 | file-abc | |
68 | file-abcd |
|
68 | file-abcd | |
69 | file-abcde |
|
69 | file-abcde | |
70 | files |
|
70 | files | |
71 |
|
71 | |||
72 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
72 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
73 | @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
73 | @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
74 | | |
|
74 | | | |
75 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
75 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
76 | | |
|
76 | | | |
77 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
77 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
78 | | |
|
78 | | | |
79 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
79 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
80 | | |
|
80 | | | |
81 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
81 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
82 |
|
82 | |||
83 | Simple uncommit off the top, also moves bookmark |
|
83 | Simple uncommit off the top, also moves bookmark | |
84 |
|
84 | |||
85 | $ hg bookmark |
|
85 | $ hg bookmark | |
86 | * foo 4:6c4fd43ed714 |
|
86 | * foo 4:6c4fd43ed714 | |
87 | $ hg uncommit |
|
87 | $ hg uncommit | |
88 | $ hg status |
|
88 | $ hg status | |
89 | M files |
|
89 | M files | |
90 | A file-abcde |
|
90 | A file-abcde | |
91 | $ hg bookmark |
|
91 | $ hg bookmark | |
92 | * foo 3:6db330d65db4 |
|
92 | * foo 3:6db330d65db4 | |
93 |
|
93 | |||
94 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
94 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
95 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
95 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
96 | | |
|
96 | | | |
97 | @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
97 | @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
98 | | |
|
98 | | | |
99 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
99 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
100 | | |
|
100 | | | |
101 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
101 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
102 | | |
|
102 | | | |
103 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
103 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
104 |
|
104 | |||
105 |
|
105 | |||
106 | Recommit |
|
106 | Recommit | |
107 |
|
107 | |||
108 | $ hg commit -m 'new change abcde' |
|
108 | $ hg commit -m 'new change abcde' | |
109 | $ hg status |
|
109 | $ hg status | |
110 | $ hg heads -T '{rev}:{node} {desc}' |
|
110 | $ hg heads -T '{rev}:{node} {desc}' | |
111 | 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol) |
|
111 | 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol) | |
112 |
|
112 | |||
113 | Uncommit of non-existent and unchanged files aborts |
|
113 | Uncommit of non-existent and unchanged files aborts | |
114 | $ hg uncommit nothinghere |
|
114 | $ hg uncommit nothinghere | |
115 | abort: cannot uncommit "nothinghere" |
|
115 | abort: cannot uncommit "nothinghere" | |
116 | (file does not exist) |
|
116 | (file does not exist) | |
117 | [10] |
|
117 | [10] | |
118 | $ hg status |
|
118 | $ hg status | |
119 | $ hg uncommit file-abc |
|
119 | $ hg uncommit file-abc | |
120 | abort: cannot uncommit "file-abc" |
|
120 | abort: cannot uncommit "file-abc" | |
121 | (file was not changed in working directory parent) |
|
121 | (file was not changed in working directory parent) | |
122 | [10] |
|
122 | [10] | |
123 | $ hg status |
|
123 | $ hg status | |
124 |
|
124 | |||
125 | Try partial uncommit, also moves bookmark |
|
125 | Try partial uncommit, also moves bookmark | |
126 |
|
126 | |||
127 | $ hg bookmark |
|
127 | $ hg bookmark | |
128 | * foo 5:0c07a3ccda77 |
|
128 | * foo 5:0c07a3ccda77 | |
129 | $ hg uncommit files |
|
129 | $ hg uncommit files | |
130 | $ hg status |
|
130 | $ hg status | |
131 | M files |
|
131 | M files | |
132 | $ hg bookmark |
|
132 | $ hg bookmark | |
133 | * foo 6:3727deee06f7 |
|
133 | * foo 6:3727deee06f7 | |
134 | $ hg heads -T '{rev}:{node} {desc}' |
|
134 | $ hg heads -T '{rev}:{node} {desc}' | |
135 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol) |
|
135 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol) | |
136 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
136 | $ hg log -r . -p -T '{rev}:{node} {desc}' | |
137 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde |
|
137 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde | |
138 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
138 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
139 | +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000 |
|
139 | +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000 | |
140 | @@ -0,0 +1,1 @@ |
|
140 | @@ -0,0 +1,1 @@ | |
141 | +abcde |
|
141 | +abcde | |
142 |
|
142 | |||
143 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
143 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
144 | @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde |
|
144 | @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde | |
145 | | |
|
145 | | | |
146 | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde |
|
146 | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde | |
147 | |/ |
|
147 | |/ | |
148 | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
148 | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
149 | |/ |
|
149 | |/ | |
150 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
150 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
151 | | |
|
151 | | | |
152 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
152 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
153 | | |
|
153 | | | |
154 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
154 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
155 | | |
|
155 | | | |
156 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
156 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
157 |
|
157 | |||
158 | $ hg commit -m 'update files for abcde' |
|
158 | $ hg commit -m 'update files for abcde' | |
159 |
|
159 | |||
160 | Uncommit with dirty state |
|
160 | Uncommit with dirty state | |
161 |
|
161 | |||
162 | $ echo "foo" >> files |
|
162 | $ echo "foo" >> files | |
163 | $ cat files |
|
163 | $ cat files | |
164 | abcde |
|
164 | abcde | |
165 | foo |
|
165 | foo | |
166 | $ hg status |
|
166 | $ hg status | |
167 | M files |
|
167 | M files | |
168 | $ hg uncommit |
|
168 | $ hg uncommit | |
169 | abort: uncommitted changes |
|
169 | abort: uncommitted changes | |
170 | (requires --allow-dirty-working-copy to uncommit) |
|
170 | (requires --allow-dirty-working-copy to uncommit) | |
171 | [20] |
|
171 | [20] | |
172 | $ hg uncommit files |
|
172 | $ hg uncommit files | |
173 | abort: uncommitted changes |
|
173 | abort: uncommitted changes | |
174 | (requires --allow-dirty-working-copy to uncommit) |
|
174 | (requires --allow-dirty-working-copy to uncommit) | |
175 | [20] |
|
175 | [20] | |
176 | $ cat files |
|
176 | $ cat files | |
177 | abcde |
|
177 | abcde | |
178 | foo |
|
178 | foo | |
179 | $ hg commit --amend -m "files abcde + foo" |
|
179 | $ hg commit --amend -m "files abcde + foo" | |
180 |
|
180 | |||
181 | Testing the 'experimental.uncommitondirtywdir' config |
|
181 | Testing the 'experimental.uncommitondirtywdir' config | |
182 |
|
182 | |||
183 | $ echo "bar" >> files |
|
183 | $ echo "bar" >> files | |
184 | $ hg uncommit |
|
184 | $ hg uncommit | |
185 | abort: uncommitted changes |
|
185 | abort: uncommitted changes | |
186 | (requires --allow-dirty-working-copy to uncommit) |
|
186 | (requires --allow-dirty-working-copy to uncommit) | |
187 | [20] |
|
187 | [20] | |
188 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
188 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
189 | $ hg commit -m "files abcde + foo" |
|
189 | $ hg commit -m "files abcde + foo" | |
190 |
|
190 | |||
191 | Uncommit in the middle of a stack, does not move bookmark |
|
191 | Uncommit in the middle of a stack, does not move bookmark | |
192 |
|
192 | |||
193 | $ hg checkout '.^^^' |
|
193 | $ hg checkout '.^^^' | |
194 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
194 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
195 | (leaving bookmark foo) |
|
195 | (leaving bookmark foo) | |
196 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
196 | $ hg log -r . -p -T '{rev}:{node} {desc}' | |
197 | 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc |
|
197 | 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc | |
198 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
198 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
199 | +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000 |
|
199 | +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000 | |
200 | @@ -0,0 +1,1 @@ |
|
200 | @@ -0,0 +1,1 @@ | |
201 | +abc |
|
201 | +abc | |
202 | diff -r 69a232e754b0 -r abf2df566fc1 files |
|
202 | diff -r 69a232e754b0 -r abf2df566fc1 files | |
203 | --- a/files Thu Jan 01 00:00:00 1970 +0000 |
|
203 | --- a/files Thu Jan 01 00:00:00 1970 +0000 | |
204 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 |
|
204 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 | |
205 | @@ -1,1 +1,1 @@ |
|
205 | @@ -1,1 +1,1 @@ | |
206 | -ab |
|
206 | -ab | |
207 | +abc |
|
207 | +abc | |
208 |
|
208 | |||
209 | $ hg bookmark |
|
209 | $ hg bookmark | |
210 | foo 9:48e5bd7cd583 |
|
210 | foo 9:48e5bd7cd583 | |
211 | $ hg uncommit |
|
211 | $ hg uncommit | |
212 | 3 new orphan changesets |
|
212 | 3 new orphan changesets | |
213 | $ hg status |
|
213 | $ hg status | |
214 | M files |
|
214 | M files | |
215 | A file-abc |
|
215 | A file-abc | |
216 | $ hg heads -T '{rev}:{node} {desc}' |
|
216 | $ hg heads -T '{rev}:{node} {desc}' | |
217 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) |
|
217 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) | |
218 | $ hg bookmark |
|
218 | $ hg bookmark | |
219 | foo 9:48e5bd7cd583 |
|
219 | foo 9:48e5bd7cd583 | |
220 | $ hg commit -m 'new abc' |
|
220 | $ hg commit -m 'new abc' | |
221 | created new head |
|
221 | created new head | |
222 |
|
222 | |||
223 | Partial uncommit in the middle, does not move bookmark |
|
223 | Partial uncommit in the middle, does not move bookmark | |
224 |
|
224 | |||
225 | $ hg checkout '.^' |
|
225 | $ hg checkout '.^' | |
226 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
226 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
227 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
227 | $ hg log -r . -p -T '{rev}:{node} {desc}' | |
228 | 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab |
|
228 | 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab | |
229 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
229 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
230 | +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000 |
|
230 | +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000 | |
231 | @@ -0,0 +1,1 @@ |
|
231 | @@ -0,0 +1,1 @@ | |
232 | +ab |
|
232 | +ab | |
233 | diff -r 3004d2d9b508 -r 69a232e754b0 files |
|
233 | diff -r 3004d2d9b508 -r 69a232e754b0 files | |
234 | --- a/files Thu Jan 01 00:00:00 1970 +0000 |
|
234 | --- a/files Thu Jan 01 00:00:00 1970 +0000 | |
235 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 |
|
235 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 | |
236 | @@ -1,1 +1,1 @@ |
|
236 | @@ -1,1 +1,1 @@ | |
237 | -a |
|
237 | -a | |
238 | +ab |
|
238 | +ab | |
239 |
|
239 | |||
240 | $ hg bookmark |
|
240 | $ hg bookmark | |
241 | foo 9:48e5bd7cd583 |
|
241 | foo 9:48e5bd7cd583 | |
242 | $ hg uncommit file-ab |
|
242 | $ hg uncommit file-ab | |
243 | 1 new orphan changesets |
|
243 | 1 new orphan changesets | |
244 | $ hg status |
|
244 | $ hg status | |
245 | A file-ab |
|
245 | A file-ab | |
246 |
|
246 | |||
247 | $ hg heads -T '{rev}:{node} {desc}\n' |
|
247 | $ hg heads -T '{rev}:{node} {desc}\n' | |
248 | 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab |
|
248 | 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | |
249 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
249 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | |
250 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
250 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | |
251 |
|
251 | |||
252 | $ hg bookmark |
|
252 | $ hg bookmark | |
253 | foo 9:48e5bd7cd583 |
|
253 | foo 9:48e5bd7cd583 | |
254 | $ hg commit -m 'update ab' |
|
254 | $ hg commit -m 'update ab' | |
255 | $ hg status |
|
255 | $ hg status | |
256 | $ hg heads -T '{rev}:{node} {desc}\n' |
|
256 | $ hg heads -T '{rev}:{node} {desc}\n' | |
257 | 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab |
|
257 | 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | |
258 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
258 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | |
259 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
259 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | |
260 |
|
260 | |||
261 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
261 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
262 | @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab |
|
262 | @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | |
263 | | |
|
263 | | | |
264 | o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab |
|
264 | o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | |
265 | | |
|
265 | | | |
266 | | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
266 | | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | |
267 | | | |
|
267 | | | | |
268 | | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
268 | | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | |
269 | | | | |
|
269 | | | | | |
270 | | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo |
|
270 | | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | |
271 | | | |/ |
|
271 | | | |/ | |
272 | | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde |
|
272 | | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | |
273 | | | |/ |
|
273 | | | |/ | |
274 | | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde |
|
274 | | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde | |
275 | | | | |
|
275 | | | | | |
276 | | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde |
|
276 | | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde | |
277 | | | |/ |
|
277 | | | |/ | |
278 | | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
278 | | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
279 | | | |/ |
|
279 | | | |/ | |
280 | | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
280 | | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
281 | | | | |
|
281 | | | | | |
282 | | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
282 | | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
283 | | |/ |
|
283 | | |/ | |
284 | | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
284 | | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
285 | |/ |
|
285 | |/ | |
286 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
286 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
287 |
|
287 | |||
288 | Uncommit with draft parent |
|
288 | Uncommit with draft parent | |
289 |
|
289 | |||
290 | $ hg uncommit |
|
290 | $ hg uncommit | |
291 | $ hg phase -r . |
|
291 | $ hg phase -r . | |
292 | 11: draft |
|
292 | 11: draft | |
293 | $ hg commit -m 'update ab again' |
|
293 | $ hg commit -m 'update ab again' | |
294 |
|
294 | |||
295 | Phase is preserved |
|
295 | Phase is preserved | |
296 |
|
296 | |||
297 | $ hg uncommit --keep --config phases.new-commit=secret |
|
297 | $ hg uncommit --keep --config phases.new-commit=secret | |
298 | note: keeping empty commit |
|
298 | note: keeping empty commit | |
299 | $ hg phase -r . |
|
299 | $ hg phase -r . | |
300 | 14: draft |
|
300 | 14: draft | |
301 | $ hg commit --amend -m 'update ab again' |
|
301 | $ hg commit --amend -m 'update ab again' | |
302 |
|
302 | |||
303 | Uncommit with public parent |
|
303 | Uncommit with public parent | |
304 |
|
304 | |||
305 | $ hg phase -p "::.^" |
|
305 | $ hg phase -p "::.^" | |
306 | $ hg uncommit |
|
306 | $ hg uncommit | |
307 | $ hg phase -r . |
|
307 | $ hg phase -r . | |
308 | 11: public |
|
308 | 11: public | |
309 |
|
309 | |||
310 | Partial uncommit with public parent |
|
310 | Partial uncommit with public parent | |
311 |
|
311 | |||
312 | $ echo xyz > xyz |
|
312 | $ echo xyz > xyz | |
313 | $ hg add xyz |
|
313 | $ hg add xyz | |
314 | $ hg commit -m "update ab and add xyz" |
|
314 | $ hg commit -m "update ab and add xyz" | |
315 | $ hg uncommit xyz |
|
315 | $ hg uncommit xyz | |
316 | $ hg status |
|
316 | $ hg status | |
317 | A xyz |
|
317 | A xyz | |
318 | $ hg phase -r . |
|
318 | $ hg phase -r . | |
319 | 17: draft |
|
319 | 17: draft | |
320 | $ hg phase -r ".^" |
|
320 | $ hg phase -r ".^" | |
321 | 11: public |
|
321 | 11: public | |
322 |
|
322 | |||
323 | Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset |
|
323 | Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset | |
324 |
|
324 | |||
325 | $ cd $TESTTMP |
|
325 | $ cd $TESTTMP | |
326 | $ hg init repo1 |
|
326 | $ hg init repo1 | |
327 | $ cd repo1 |
|
327 | $ cd repo1 | |
328 | $ hg debugdrawdag <<'EOS' |
|
328 | $ hg debugdrawdag <<'EOS' | |
329 | > Q |
|
329 | > Q | |
330 | > | |
|
330 | > | | |
331 | > P |
|
331 | > P | |
332 | > EOS |
|
332 | > EOS | |
333 | $ hg up Q -q |
|
333 | $ hg up Q -q | |
334 | $ hg uncommit --keep |
|
334 | $ hg uncommit --keep | |
335 | note: keeping empty commit |
|
335 | note: keeping empty commit | |
336 | $ hg log -G -T '{desc} FILES: {files}' |
|
336 | $ hg log -G -T '{desc} FILES: {files}' | |
337 | @ Q FILES: |
|
337 | @ Q FILES: | |
338 | | |
|
338 | | | |
339 | | x Q FILES: Q |
|
339 | | x Q FILES: Q | |
340 | |/ |
|
340 | |/ | |
341 | o P FILES: P |
|
341 | o P FILES: P | |
342 |
|
342 | |||
343 | $ cat >> .hg/hgrc <<EOF |
|
343 | $ cat >> .hg/hgrc <<EOF | |
344 | > [experimental] |
|
344 | > [experimental] | |
345 | > uncommit.keep=True |
|
345 | > uncommit.keep=True | |
346 | > EOF |
|
346 | > EOF | |
347 | $ hg ci --amend |
|
347 | $ hg ci --amend | |
348 | $ hg uncommit |
|
348 | $ hg uncommit | |
349 | note: keeping empty commit |
|
349 | note: keeping empty commit | |
350 | $ hg log -G -T '{desc} FILES: {files}' |
|
350 | $ hg log -G -T '{desc} FILES: {files}' | |
351 | @ Q FILES: |
|
351 | @ Q FILES: | |
352 | | |
|
352 | | | |
353 | | x Q FILES: Q |
|
353 | | x Q FILES: Q | |
354 | |/ |
|
354 | |/ | |
355 | o P FILES: P |
|
355 | o P FILES: P | |
356 |
|
356 | |||
357 | $ hg status |
|
357 | $ hg status | |
358 | A Q |
|
358 | A Q | |
359 | $ hg ci --amend |
|
359 | $ hg ci --amend | |
360 | $ hg uncommit --no-keep |
|
360 | $ hg uncommit --no-keep | |
361 | $ hg log -G -T '{desc} FILES: {files}' |
|
361 | $ hg log -G -T '{desc} FILES: {files}' | |
362 | x Q FILES: Q |
|
362 | x Q FILES: Q | |
363 | | |
|
363 | | | |
364 | @ P FILES: P |
|
364 | @ P FILES: P | |
365 |
|
365 | |||
366 | $ hg status |
|
366 | $ hg status | |
367 | A Q |
|
367 | A Q | |
368 | $ cd .. |
|
368 | $ cd .. | |
369 | $ rm -rf repo1 |
|
369 | $ rm -rf repo1 | |
370 |
|
370 | |||
371 | Testing uncommit while merge |
|
371 | Testing uncommit while merge | |
372 |
|
372 | |||
373 | $ hg init repo2 |
|
373 | $ hg init repo2 | |
374 | $ cd repo2 |
|
374 | $ cd repo2 | |
375 |
|
375 | |||
376 | Create some history |
|
376 | Create some history | |
377 |
|
377 | |||
378 | $ touch a |
|
378 | $ touch a | |
379 | $ hg add a |
|
379 | $ hg add a | |
380 | $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done |
|
380 | $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done | |
381 | $ hg checkout 0 |
|
381 | $ hg checkout 0 | |
382 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
383 | $ touch b |
|
383 | $ touch b | |
384 | $ hg add b |
|
384 | $ hg add b | |
385 | $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done |
|
385 | $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done | |
386 | created new head |
|
386 | created new head | |
387 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
387 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
388 | @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 |
|
388 | @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 | |
389 | | |
|
389 | | | |
390 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 |
|
390 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 | |
391 | | |
|
391 | | | |
392 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 |
|
392 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 | |
393 | | |
|
393 | | | |
394 | | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 |
|
394 | | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 | |
395 | | | |
|
395 | | | | |
396 | | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 |
|
396 | | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 | |
397 | |/ |
|
397 | |/ | |
398 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 |
|
398 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 | |
399 |
|
399 | |||
400 |
|
400 | |||
401 | Add and expect uncommit to fail on both merge working dir and merge changeset |
|
401 | Add and expect uncommit to fail on both merge working dir and merge changeset | |
402 |
|
402 | |||
403 | $ hg merge 2 |
|
403 | $ hg merge 2 | |
404 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
404 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
405 | (branch merge, don't forget to commit) |
|
405 | (branch merge, don't forget to commit) | |
406 |
|
406 | |||
407 | $ hg uncommit |
|
407 | $ hg uncommit | |
408 | abort: outstanding uncommitted merge |
|
408 | abort: outstanding uncommitted merge | |
409 | (requires --allow-dirty-working-copy to uncommit) |
|
409 | (requires --allow-dirty-working-copy to uncommit) | |
410 | [20] |
|
410 | [20] | |
411 |
|
411 | |||
412 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
412 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
413 | abort: cannot uncommit while merging |
|
413 | abort: cannot uncommit changesets while merging | |
414 | [20] |
|
414 | [20] | |
415 |
|
415 | |||
416 | $ hg status |
|
416 | $ hg status | |
417 | M a |
|
417 | M a | |
418 | $ hg commit -m 'merge a and b' |
|
418 | $ hg commit -m 'merge a and b' | |
419 |
|
419 | |||
420 | $ hg uncommit |
|
420 | $ hg uncommit | |
421 | abort: cannot uncommit merge changeset |
|
421 | abort: cannot uncommit merge changeset | |
422 | [10] |
|
422 | [10] | |
423 |
|
423 | |||
424 | $ hg status |
|
424 | $ hg status | |
425 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
425 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
426 | @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b |
|
426 | @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b | |
427 | |\ |
|
427 | |\ | |
428 | | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 |
|
428 | | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 | |
429 | | | |
|
429 | | | | |
430 | | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 |
|
430 | | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 | |
431 | | | |
|
431 | | | | |
432 | | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 |
|
432 | | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 | |
433 | | | |
|
433 | | | | |
434 | o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 |
|
434 | o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 | |
435 | | | |
|
435 | | | | |
436 | o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 |
|
436 | o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 | |
437 | |/ |
|
437 | |/ | |
438 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 |
|
438 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 | |
439 |
|
439 | |||
440 |
|
440 | |||
441 | Rename a->b, then remove b in working copy. Result should remove a. |
|
441 | Rename a->b, then remove b in working copy. Result should remove a. | |
442 |
|
442 | |||
443 | $ hg co -q 0 |
|
443 | $ hg co -q 0 | |
444 | $ hg mv a b |
|
444 | $ hg mv a b | |
445 | $ hg ci -qm 'move a to b' |
|
445 | $ hg ci -qm 'move a to b' | |
446 | $ hg rm b |
|
446 | $ hg rm b | |
447 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
447 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
448 | $ hg st --copies |
|
448 | $ hg st --copies | |
449 | R a |
|
449 | R a | |
450 | $ hg revert a |
|
450 | $ hg revert a | |
451 |
|
451 | |||
452 | Rename a->b, then rename b->c in working copy. Result should rename a->c. |
|
452 | Rename a->b, then rename b->c in working copy. Result should rename a->c. | |
453 |
|
453 | |||
454 | $ hg co -q 0 |
|
454 | $ hg co -q 0 | |
455 | $ hg mv a b |
|
455 | $ hg mv a b | |
456 | $ hg ci -qm 'move a to b' |
|
456 | $ hg ci -qm 'move a to b' | |
457 | $ hg mv b c |
|
457 | $ hg mv b c | |
458 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
458 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
459 | $ hg st --copies |
|
459 | $ hg st --copies | |
460 | A c |
|
460 | A c | |
461 | a |
|
461 | a | |
462 | R a |
|
462 | R a | |
463 | $ hg revert a |
|
463 | $ hg revert a | |
464 | $ hg forget c |
|
464 | $ hg forget c | |
465 | $ rm c |
|
465 | $ rm c | |
466 |
|
466 | |||
467 | Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c. |
|
467 | Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c. | |
468 |
|
468 | |||
469 | $ hg co -q 0 |
|
469 | $ hg co -q 0 | |
470 | $ hg cp a b1 |
|
470 | $ hg cp a b1 | |
471 | $ hg cp a b2 |
|
471 | $ hg cp a b2 | |
472 | $ hg ci -qm 'move a to b1 and b2' |
|
472 | $ hg ci -qm 'move a to b1 and b2' | |
473 | $ hg mv b1 c |
|
473 | $ hg mv b1 c | |
474 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
474 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
475 | $ hg st --copies |
|
475 | $ hg st --copies | |
476 | A b2 |
|
476 | A b2 | |
477 | a |
|
477 | a | |
478 | A c |
|
478 | A c | |
479 | a |
|
479 | a | |
480 | $ cd .. |
|
480 | $ cd .. | |
481 |
|
481 | |||
482 | --allow-dirty-working-copy should also work on a dirty PATH |
|
482 | --allow-dirty-working-copy should also work on a dirty PATH | |
483 |
|
483 | |||
484 | $ hg init issue5977 |
|
484 | $ hg init issue5977 | |
485 | $ cd issue5977 |
|
485 | $ cd issue5977 | |
486 | $ echo 'super critical info!' > a |
|
486 | $ echo 'super critical info!' > a | |
487 | $ hg ci -Am 'add a' |
|
487 | $ hg ci -Am 'add a' | |
488 | adding a |
|
488 | adding a | |
489 | $ echo 'foo' > b |
|
489 | $ echo 'foo' > b | |
490 | $ hg add b |
|
490 | $ hg add b | |
491 | $ hg status |
|
491 | $ hg status | |
492 | A b |
|
492 | A b | |
493 | $ hg uncommit a |
|
493 | $ hg uncommit a | |
494 | note: keeping empty commit |
|
494 | note: keeping empty commit | |
495 | $ cat a |
|
495 | $ cat a | |
496 | super critical info! |
|
496 | super critical info! | |
497 | $ hg log |
|
497 | $ hg log | |
498 | changeset: 1:656ba143d384 |
|
498 | changeset: 1:656ba143d384 | |
499 | tag: tip |
|
499 | tag: tip | |
500 | parent: -1:000000000000 |
|
500 | parent: -1:000000000000 | |
501 | user: test |
|
501 | user: test | |
502 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
502 | date: Thu Jan 01 00:00:00 1970 +0000 | |
503 | summary: add a |
|
503 | summary: add a | |
504 |
|
504 | |||
505 | $ hg ci -Am 'add b' |
|
505 | $ hg ci -Am 'add b' | |
506 | $ echo 'foo bar' > b |
|
506 | $ echo 'foo bar' > b | |
507 | $ hg uncommit b |
|
507 | $ hg uncommit b | |
508 | abort: uncommitted changes |
|
508 | abort: uncommitted changes | |
509 | (requires --allow-dirty-working-copy to uncommit) |
|
509 | (requires --allow-dirty-working-copy to uncommit) | |
510 | [20] |
|
510 | [20] | |
511 | $ hg uncommit --allow-dirty-working-copy b |
|
511 | $ hg uncommit --allow-dirty-working-copy b | |
512 | $ hg log |
|
512 | $ hg log | |
513 | changeset: 3:30fa958635b2 |
|
513 | changeset: 3:30fa958635b2 | |
514 | tag: tip |
|
514 | tag: tip | |
515 | parent: 1:656ba143d384 |
|
515 | parent: 1:656ba143d384 | |
516 | user: test |
|
516 | user: test | |
517 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
517 | date: Thu Jan 01 00:00:00 1970 +0000 | |
518 | summary: add b |
|
518 | summary: add b | |
519 |
|
519 | |||
520 | changeset: 1:656ba143d384 |
|
520 | changeset: 1:656ba143d384 | |
521 | parent: -1:000000000000 |
|
521 | parent: -1:000000000000 | |
522 | user: test |
|
522 | user: test | |
523 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
523 | date: Thu Jan 01 00:00:00 1970 +0000 | |
524 | summary: add a |
|
524 | summary: add a | |
525 |
|
525 | |||
526 | Removes can be uncommitted |
|
526 | Removes can be uncommitted | |
527 |
|
527 | |||
528 | $ hg ci -m 'modified b' |
|
528 | $ hg ci -m 'modified b' | |
529 | $ hg rm b |
|
529 | $ hg rm b | |
530 | $ hg ci -m 'remove b' |
|
530 | $ hg ci -m 'remove b' | |
531 | $ hg uncommit b |
|
531 | $ hg uncommit b | |
532 | note: keeping empty commit |
|
532 | note: keeping empty commit | |
533 | $ hg status |
|
533 | $ hg status | |
534 | R b |
|
534 | R b | |
535 |
|
535 | |||
536 | Uncommitting a directory won't run afoul of the checks that an explicit file |
|
536 | Uncommitting a directory won't run afoul of the checks that an explicit file | |
537 | can be uncommitted. |
|
537 | can be uncommitted. | |
538 |
|
538 | |||
539 | $ mkdir dir |
|
539 | $ mkdir dir | |
540 | $ echo 1 > dir/file.txt |
|
540 | $ echo 1 > dir/file.txt | |
541 | $ hg ci -Aqm 'add file in directory' |
|
541 | $ hg ci -Aqm 'add file in directory' | |
542 | $ hg uncommit dir -m 'uncommit with message' -u 'different user' \ |
|
542 | $ hg uncommit dir -m 'uncommit with message' -u 'different user' \ | |
543 | > -d 'Jun 30 12:12:12 1980 +0000' |
|
543 | > -d 'Jun 30 12:12:12 1980 +0000' | |
544 | $ hg status |
|
544 | $ hg status | |
545 | A dir/file.txt |
|
545 | A dir/file.txt | |
546 | $ hg log -r . |
|
546 | $ hg log -r . | |
547 | changeset: 8:b4dd26dc42e0 |
|
547 | changeset: 8:b4dd26dc42e0 | |
548 | tag: tip |
|
548 | tag: tip | |
549 | parent: 6:2278a4c24330 |
|
549 | parent: 6:2278a4c24330 | |
550 | user: different user |
|
550 | user: different user | |
551 | date: Mon Jun 30 12:12:12 1980 +0000 |
|
551 | date: Mon Jun 30 12:12:12 1980 +0000 | |
552 | summary: uncommit with message |
|
552 | summary: uncommit with message | |
553 |
|
553 | |||
554 | Bad option combinations |
|
554 | Bad option combinations | |
555 |
|
555 | |||
556 | $ hg rollback -q --config ui.rollback=True |
|
556 | $ hg rollback -q --config ui.rollback=True | |
557 | $ hg uncommit -U --user 'user' |
|
557 | $ hg uncommit -U --user 'user' | |
558 | abort: cannot specify both --user and --currentuser |
|
558 | abort: cannot specify both --user and --currentuser | |
559 | [10] |
|
559 | [10] | |
560 | $ hg uncommit -D --date today |
|
560 | $ hg uncommit -D --date today | |
561 | abort: cannot specify both --date and --currentdate |
|
561 | abort: cannot specify both --date and --currentdate | |
562 | [10] |
|
562 | [10] | |
563 |
|
563 | |||
564 | `uncommit <dir>` and `cd <dir> && uncommit .` behave the same... |
|
564 | `uncommit <dir>` and `cd <dir> && uncommit .` behave the same... | |
565 |
|
565 | |||
566 | $ echo 2 > dir/file2.txt |
|
566 | $ echo 2 > dir/file2.txt | |
567 | $ hg ci -Aqm 'add file2 in directory' |
|
567 | $ hg ci -Aqm 'add file2 in directory' | |
568 | $ hg uncommit dir |
|
568 | $ hg uncommit dir | |
569 | note: keeping empty commit |
|
569 | note: keeping empty commit | |
570 | $ hg status |
|
570 | $ hg status | |
571 | A dir/file2.txt |
|
571 | A dir/file2.txt | |
572 |
|
572 | |||
573 | $ hg rollback -q --config ui.rollback=True |
|
573 | $ hg rollback -q --config ui.rollback=True | |
574 | $ cd dir |
|
574 | $ cd dir | |
575 | $ hg uncommit . -n 'this is a note' |
|
575 | $ hg uncommit . -n 'this is a note' | |
576 | note: keeping empty commit |
|
576 | note: keeping empty commit | |
577 | $ hg status |
|
577 | $ hg status | |
578 | A dir/file2.txt |
|
578 | A dir/file2.txt | |
579 | $ cd .. |
|
579 | $ cd .. | |
580 |
|
580 | |||
581 | ... and errors out the same way when nothing can be uncommitted |
|
581 | ... and errors out the same way when nothing can be uncommitted | |
582 |
|
582 | |||
583 | $ hg rollback -q --config ui.rollback=True |
|
583 | $ hg rollback -q --config ui.rollback=True | |
584 | $ mkdir emptydir |
|
584 | $ mkdir emptydir | |
585 | $ hg uncommit emptydir |
|
585 | $ hg uncommit emptydir | |
586 | abort: cannot uncommit "emptydir" |
|
586 | abort: cannot uncommit "emptydir" | |
587 | (file was untracked in working directory parent) |
|
587 | (file was untracked in working directory parent) | |
588 | [10] |
|
588 | [10] | |
589 |
|
589 | |||
590 | $ cd emptydir |
|
590 | $ cd emptydir | |
591 | $ hg uncommit . |
|
591 | $ hg uncommit . | |
592 | abort: cannot uncommit "emptydir" |
|
592 | abort: cannot uncommit "emptydir" | |
593 | (file was untracked in working directory parent) |
|
593 | (file was untracked in working directory parent) | |
594 | [10] |
|
594 | [10] | |
595 | $ hg status |
|
595 | $ hg status | |
596 | $ cd .. |
|
596 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now