Show More
@@ -1,150 +1,151 b'' | |||||
1 | # record.py |
|
1 | # record.py | |
2 | # |
|
2 | # | |
3 | # Copyright 2007 Bryan O'Sullivan <bos@serpentine.com> |
|
3 | # Copyright 2007 Bryan O'Sullivan <bos@serpentine.com> | |
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 | '''commands to interactively select changes for commit/qrefresh (DEPRECATED) |
|
8 | '''commands to interactively select changes for commit/qrefresh (DEPRECATED) | |
9 |
|
9 | |||
10 | The feature provided by this extension has been moved into core Mercurial as |
|
10 | The feature provided by this extension has been moved into core Mercurial as | |
11 | :hg:`commit --interactive`.''' |
|
11 | :hg:`commit --interactive`.''' | |
12 |
|
12 | |||
13 | from __future__ import absolute_import |
|
13 | from __future__ import absolute_import | |
14 |
|
14 | |||
15 | from mercurial.i18n import _ |
|
15 | from mercurial.i18n import _ | |
16 | from mercurial import ( |
|
16 | from mercurial import ( | |
17 | cmdutil, |
|
17 | cmdutil, | |
18 | commands, |
|
18 | commands, | |
19 | error, |
|
19 | error, | |
20 | extensions, |
|
20 | extensions, | |
21 | registrar, |
|
21 | registrar, | |
22 | ) |
|
22 | ) | |
23 |
|
23 | |||
24 | cmdtable = {} |
|
24 | cmdtable = {} | |
25 | command = registrar.command(cmdtable) |
|
25 | command = registrar.command(cmdtable) | |
26 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
|
26 | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | |
27 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
|
27 | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | |
28 | # be specifying the version(s) of Mercurial they are tested with, or |
|
28 | # be specifying the version(s) of Mercurial they are tested with, or | |
29 | # leave the attribute unspecified. |
|
29 | # leave the attribute unspecified. | |
30 | testedwith = 'ships-with-hg-core' |
|
30 | testedwith = 'ships-with-hg-core' | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | @command("record", |
|
33 | @command("record", | |
34 | # same options as commit + white space diff options |
|
34 | # same options as commit + white space diff options | |
35 | [c for c in commands.table['commit|ci'][1][:] |
|
35 | [c for c in commands.table['commit|ci'][1][:] | |
36 | if c[1] != "interactive"] + cmdutil.diffwsopts, |
|
36 | if c[1] != "interactive"] + cmdutil.diffwsopts, | |
37 | _('hg record [OPTION]... [FILE]...'), |
|
37 | _('hg record [OPTION]... [FILE]...'), | |
38 | helpcategory=command.CATEGORY_COMMITTING) |
|
38 | helpcategory=command.CATEGORY_COMMITTING) | |
39 | def record(ui, repo, *pats, **opts): |
|
39 | def record(ui, repo, *pats, **opts): | |
40 | '''interactively select changes to commit |
|
40 | '''interactively select changes to commit | |
41 |
|
41 | |||
42 | If a list of files is omitted, all changes reported by :hg:`status` |
|
42 | If a list of files is omitted, all changes reported by :hg:`status` | |
43 | will be candidates for recording. |
|
43 | will be candidates for recording. | |
44 |
|
44 | |||
45 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
45 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
46 |
|
46 | |||
47 | If using the text interface (see :hg:`help config`), |
|
47 | If using the text interface (see :hg:`help config`), | |
48 | you will be prompted for whether to record changes to each |
|
48 | you will be prompted for whether to record changes to each | |
49 | modified file, and for files with multiple changes, for each |
|
49 | modified file, and for files with multiple changes, for each | |
50 | change to use. For each query, the following responses are |
|
50 | change to use. For each query, the following responses are | |
51 | possible:: |
|
51 | possible:: | |
52 |
|
52 | |||
53 | y - record this change |
|
53 | y - record this change | |
54 | n - skip this change |
|
54 | n - skip this change | |
55 | e - edit this change manually |
|
55 | e - edit this change manually | |
56 |
|
56 | |||
57 | s - skip remaining changes to this file |
|
57 | s - skip remaining changes to this file | |
58 | f - record remaining changes to this file |
|
58 | f - record remaining changes to this file | |
59 |
|
59 | |||
60 | d - done, skip remaining changes and files |
|
60 | d - done, skip remaining changes and files | |
61 | a - record all changes to all remaining files |
|
61 | a - record all changes to all remaining files | |
62 | q - quit, recording no changes |
|
62 | q - quit, recording no changes | |
63 |
|
63 | |||
64 | ? - display help |
|
64 | ? - display help | |
65 |
|
65 | |||
66 | This command is not available when committing a merge.''' |
|
66 | This command is not available when committing a merge.''' | |
67 |
|
67 | |||
68 | if not ui.interactive(): |
|
68 | if not ui.interactive(): | |
69 | raise error.Abort(_('running non-interactively, use %s instead') % |
|
69 | raise error.Abort(_('running non-interactively, use %s instead') % | |
70 | 'commit') |
|
70 | 'commit') | |
71 |
|
71 | |||
72 | opts[r"interactive"] = True |
|
72 | opts[r"interactive"] = True | |
73 | overrides = {('experimental', 'crecord'): False} |
|
73 | overrides = {('experimental', 'crecord'): False} | |
74 | with ui.configoverride(overrides, 'record'): |
|
74 | with ui.configoverride(overrides, 'record'): | |
75 | return commands.commit(ui, repo, *pats, **opts) |
|
75 | return commands.commit(ui, repo, *pats, **opts) | |
76 |
|
76 | |||
77 | def qrefresh(origfn, ui, repo, *pats, **opts): |
|
77 | def qrefresh(origfn, ui, repo, *pats, **opts): | |
78 | if not opts[r'interactive']: |
|
78 | if not opts[r'interactive']: | |
79 | return origfn(ui, repo, *pats, **opts) |
|
79 | return origfn(ui, repo, *pats, **opts) | |
80 |
|
80 | |||
81 | mq = extensions.find('mq') |
|
81 | mq = extensions.find('mq') | |
82 |
|
82 | |||
83 | def committomq(ui, repo, *pats, **opts): |
|
83 | def committomq(ui, repo, *pats, **opts): | |
84 | # At this point the working copy contains only changes that |
|
84 | # At this point the working copy contains only changes that | |
85 | # were accepted. All other changes were reverted. |
|
85 | # were accepted. All other changes were reverted. | |
86 | # We can't pass *pats here since qrefresh will undo all other |
|
86 | # We can't pass *pats here since qrefresh will undo all other | |
87 | # changed files in the patch that aren't in pats. |
|
87 | # changed files in the patch that aren't in pats. | |
88 | mq.refresh(ui, repo, **opts) |
|
88 | mq.refresh(ui, repo, **opts) | |
89 |
|
89 | |||
90 | # backup all changed files |
|
90 | # backup all changed files | |
91 | cmdutil.dorecord(ui, repo, committomq, None, True, |
|
91 | cmdutil.dorecord(ui, repo, committomq, None, True, | |
92 | cmdutil.recordfilter, *pats, **opts) |
|
92 | cmdutil.recordfilter, *pats, **opts) | |
93 |
|
93 | |||
94 | # This command registration is replaced during uisetup(). |
|
94 | # This command registration is replaced during uisetup(). | |
95 | @command('qrecord', |
|
95 | @command('qrecord', | |
96 | [], |
|
96 | [], | |
97 | _('hg qrecord [OPTION]... PATCH [FILE]...'), |
|
97 | _('hg qrecord [OPTION]... PATCH [FILE]...'), | |
98 | helpcategory=command.CATEGORY_COMMITTING, |
|
98 | helpcategory=command.CATEGORY_COMMITTING, | |
99 | inferrepo=True) |
|
99 | inferrepo=True) | |
100 | def qrecord(ui, repo, patch, *pats, **opts): |
|
100 | def qrecord(ui, repo, patch, *pats, **opts): | |
101 | '''interactively record a new patch |
|
101 | '''interactively record a new patch | |
102 |
|
102 | |||
103 | See :hg:`help qnew` & :hg:`help record` for more information and |
|
103 | See :hg:`help qnew` & :hg:`help record` for more information and | |
104 | usage. |
|
104 | usage. | |
105 | ''' |
|
105 | ''' | |
106 | return _qrecord('qnew', ui, repo, patch, *pats, **opts) |
|
106 | return _qrecord('qnew', ui, repo, patch, *pats, **opts) | |
107 |
|
107 | |||
108 | def _qrecord(cmdsuggest, ui, repo, patch, *pats, **opts): |
|
108 | def _qrecord(cmdsuggest, ui, repo, patch, *pats, **opts): | |
109 | try: |
|
109 | try: | |
110 | mq = extensions.find('mq') |
|
110 | mq = extensions.find('mq') | |
111 | except KeyError: |
|
111 | except KeyError: | |
112 | raise error.Abort(_("'mq' extension not loaded")) |
|
112 | raise error.Abort(_("'mq' extension not loaded")) | |
113 |
|
113 | |||
114 | repo.mq.checkpatchname(patch) |
|
114 | repo.mq.checkpatchname(patch) | |
115 |
|
115 | |||
116 | def committomq(ui, repo, *pats, **opts): |
|
116 | def committomq(ui, repo, *pats, **opts): | |
117 | opts[r'checkname'] = False |
|
117 | opts[r'checkname'] = False | |
118 | mq.new(ui, repo, patch, *pats, **opts) |
|
118 | mq.new(ui, repo, patch, *pats, **opts) | |
119 |
|
119 | |||
120 | overrides = {('experimental', 'crecord'): False} |
|
120 | overrides = {('experimental', 'crecord'): False} | |
121 | with ui.configoverride(overrides, 'record'): |
|
121 | with ui.configoverride(overrides, 'record'): | |
|
122 | cmdutil.checkunfinished(repo) | |||
122 | cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, |
|
123 | cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, | |
123 | cmdutil.recordfilter, *pats, **opts) |
|
124 | cmdutil.recordfilter, *pats, **opts) | |
124 |
|
125 | |||
125 | def qnew(origfn, ui, repo, patch, *args, **opts): |
|
126 | def qnew(origfn, ui, repo, patch, *args, **opts): | |
126 | if opts[r'interactive']: |
|
127 | if opts[r'interactive']: | |
127 | return _qrecord(None, ui, repo, patch, *args, **opts) |
|
128 | return _qrecord(None, ui, repo, patch, *args, **opts) | |
128 | return origfn(ui, repo, patch, *args, **opts) |
|
129 | return origfn(ui, repo, patch, *args, **opts) | |
129 |
|
130 | |||
130 |
|
131 | |||
131 | def uisetup(ui): |
|
132 | def uisetup(ui): | |
132 | try: |
|
133 | try: | |
133 | mq = extensions.find('mq') |
|
134 | mq = extensions.find('mq') | |
134 | except KeyError: |
|
135 | except KeyError: | |
135 | return |
|
136 | return | |
136 |
|
137 | |||
137 | cmdtable["qrecord"] = ( |
|
138 | cmdtable["qrecord"] = ( | |
138 | qrecord, |
|
139 | qrecord, | |
139 | # same options as qnew, but copy them so we don't get |
|
140 | # same options as qnew, but copy them so we don't get | |
140 | # -i/--interactive for qrecord and add white space diff options |
|
141 | # -i/--interactive for qrecord and add white space diff options | |
141 | mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts, |
|
142 | mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts, | |
142 | _('hg qrecord [OPTION]... PATCH [FILE]...')) |
|
143 | _('hg qrecord [OPTION]... PATCH [FILE]...')) | |
143 |
|
144 | |||
144 | _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch")) |
|
145 | _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch")) | |
145 | _wrapcmd('qrefresh', mq.cmdtable, qrefresh, |
|
146 | _wrapcmd('qrefresh', mq.cmdtable, qrefresh, | |
146 | _("interactively select changes to refresh")) |
|
147 | _("interactively select changes to refresh")) | |
147 |
|
148 | |||
148 | def _wrapcmd(cmd, table, wrapfn, msg): |
|
149 | def _wrapcmd(cmd, table, wrapfn, msg): | |
149 | entry = extensions.wrapcommand(table, cmd, wrapfn) |
|
150 | entry = extensions.wrapcommand(table, cmd, wrapfn) | |
150 | entry[1].append(('i', 'interactive', None, msg)) |
|
151 | entry[1].append(('i', 'interactive', None, msg)) |
@@ -1,424 +1,464 b'' | |||||
1 | Create configuration |
|
1 | Create configuration | |
2 |
|
2 | |||
3 | $ echo "[ui]" >> $HGRCPATH |
|
3 | $ echo "[ui]" >> $HGRCPATH | |
4 | $ echo "interactive=true" >> $HGRCPATH |
|
4 | $ echo "interactive=true" >> $HGRCPATH | |
5 |
|
5 | |||
6 | help record (no record) |
|
6 | help record (no record) | |
7 |
|
7 | |||
8 | $ hg help record |
|
8 | $ hg help record | |
9 | record extension - commands to interactively select changes for |
|
9 | record extension - commands to interactively select changes for | |
10 | commit/qrefresh (DEPRECATED) |
|
10 | commit/qrefresh (DEPRECATED) | |
11 |
|
11 | |||
12 | The feature provided by this extension has been moved into core Mercurial as |
|
12 | The feature provided by this extension has been moved into core Mercurial as | |
13 | 'hg commit --interactive'. |
|
13 | 'hg commit --interactive'. | |
14 |
|
14 | |||
15 | (use 'hg help extensions' for information on enabling extensions) |
|
15 | (use 'hg help extensions' for information on enabling extensions) | |
16 |
|
16 | |||
17 | help qrecord (no record) |
|
17 | help qrecord (no record) | |
18 |
|
18 | |||
19 | $ hg help qrecord |
|
19 | $ hg help qrecord | |
20 | 'qrecord' is provided by the following extension: |
|
20 | 'qrecord' is provided by the following extension: | |
21 |
|
21 | |||
22 | record commands to interactively select changes for commit/qrefresh |
|
22 | record commands to interactively select changes for commit/qrefresh | |
23 | (DEPRECATED) |
|
23 | (DEPRECATED) | |
24 |
|
24 | |||
25 | (use 'hg help extensions' for information on enabling extensions) |
|
25 | (use 'hg help extensions' for information on enabling extensions) | |
26 |
|
26 | |||
27 | $ echo "[extensions]" >> $HGRCPATH |
|
27 | $ echo "[extensions]" >> $HGRCPATH | |
28 | $ echo "record=" >> $HGRCPATH |
|
28 | $ echo "record=" >> $HGRCPATH | |
29 |
|
29 | |||
30 | help record (record) |
|
30 | help record (record) | |
31 |
|
31 | |||
32 | $ hg help record |
|
32 | $ hg help record | |
33 | hg record [OPTION]... [FILE]... |
|
33 | hg record [OPTION]... [FILE]... | |
34 |
|
34 | |||
35 | interactively select changes to commit |
|
35 | interactively select changes to commit | |
36 |
|
36 | |||
37 | If a list of files is omitted, all changes reported by 'hg status' will be |
|
37 | If a list of files is omitted, all changes reported by 'hg status' will be | |
38 | candidates for recording. |
|
38 | candidates for recording. | |
39 |
|
39 | |||
40 | See 'hg help dates' for a list of formats valid for -d/--date. |
|
40 | See 'hg help dates' for a list of formats valid for -d/--date. | |
41 |
|
41 | |||
42 | If using the text interface (see 'hg help config'), you will be prompted |
|
42 | If using the text interface (see 'hg help config'), you will be prompted | |
43 | for whether to record changes to each modified file, and for files with |
|
43 | for whether to record changes to each modified file, and for files with | |
44 | multiple changes, for each change to use. For each query, the following |
|
44 | multiple changes, for each change to use. For each query, the following | |
45 | responses are possible: |
|
45 | responses are possible: | |
46 |
|
46 | |||
47 | y - record this change |
|
47 | y - record this change | |
48 | n - skip this change |
|
48 | n - skip this change | |
49 | e - edit this change manually |
|
49 | e - edit this change manually | |
50 |
|
50 | |||
51 | s - skip remaining changes to this file |
|
51 | s - skip remaining changes to this file | |
52 | f - record remaining changes to this file |
|
52 | f - record remaining changes to this file | |
53 |
|
53 | |||
54 | d - done, skip remaining changes and files |
|
54 | d - done, skip remaining changes and files | |
55 | a - record all changes to all remaining files |
|
55 | a - record all changes to all remaining files | |
56 | q - quit, recording no changes |
|
56 | q - quit, recording no changes | |
57 |
|
57 | |||
58 | ? - display help |
|
58 | ? - display help | |
59 |
|
59 | |||
60 | This command is not available when committing a merge. |
|
60 | This command is not available when committing a merge. | |
61 |
|
61 | |||
62 | (use 'hg help -e record' to show help for the record extension) |
|
62 | (use 'hg help -e record' to show help for the record extension) | |
63 |
|
63 | |||
64 | options ([+] can be repeated): |
|
64 | options ([+] can be repeated): | |
65 |
|
65 | |||
66 | -A --addremove mark new/missing files as added/removed before |
|
66 | -A --addremove mark new/missing files as added/removed before | |
67 | committing |
|
67 | committing | |
68 | --close-branch mark a branch head as closed |
|
68 | --close-branch mark a branch head as closed | |
69 | --amend amend the parent of the working directory |
|
69 | --amend amend the parent of the working directory | |
70 | -s --secret use the secret phase for committing |
|
70 | -s --secret use the secret phase for committing | |
71 | -e --edit invoke editor on commit messages |
|
71 | -e --edit invoke editor on commit messages | |
72 | -I --include PATTERN [+] include names matching the given patterns |
|
72 | -I --include PATTERN [+] include names matching the given patterns | |
73 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
73 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
74 | -m --message TEXT use text as commit message |
|
74 | -m --message TEXT use text as commit message | |
75 | -l --logfile FILE read commit message from file |
|
75 | -l --logfile FILE read commit message from file | |
76 | -d --date DATE record the specified date as commit date |
|
76 | -d --date DATE record the specified date as commit date | |
77 | -u --user USER record the specified user as committer |
|
77 | -u --user USER record the specified user as committer | |
78 | -S --subrepos recurse into subrepositories |
|
78 | -S --subrepos recurse into subrepositories | |
79 | -w --ignore-all-space ignore white space when comparing lines |
|
79 | -w --ignore-all-space ignore white space when comparing lines | |
80 | -b --ignore-space-change ignore changes in the amount of white space |
|
80 | -b --ignore-space-change ignore changes in the amount of white space | |
81 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
81 | -B --ignore-blank-lines ignore changes whose lines are all blank | |
82 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL |
|
82 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL | |
83 |
|
83 | |||
84 | (some details hidden, use --verbose to show complete help) |
|
84 | (some details hidden, use --verbose to show complete help) | |
85 |
|
85 | |||
86 | help (no mq, so no qrecord) |
|
86 | help (no mq, so no qrecord) | |
87 |
|
87 | |||
88 | $ hg help qrecord |
|
88 | $ hg help qrecord | |
89 | hg qrecord [OPTION]... PATCH [FILE]... |
|
89 | hg qrecord [OPTION]... PATCH [FILE]... | |
90 |
|
90 | |||
91 | interactively record a new patch |
|
91 | interactively record a new patch | |
92 |
|
92 | |||
93 | See 'hg help qnew' & 'hg help record' for more information and usage. |
|
93 | See 'hg help qnew' & 'hg help record' for more information and usage. | |
94 |
|
94 | |||
95 | (some details hidden, use --verbose to show complete help) |
|
95 | (some details hidden, use --verbose to show complete help) | |
96 |
|
96 | |||
97 | $ hg init a |
|
97 | $ hg init a | |
98 |
|
98 | |||
99 | qrecord (mq not present) |
|
99 | qrecord (mq not present) | |
100 |
|
100 | |||
101 | $ hg -R a qrecord |
|
101 | $ hg -R a qrecord | |
102 | hg qrecord: invalid arguments |
|
102 | hg qrecord: invalid arguments | |
103 | hg qrecord [OPTION]... PATCH [FILE]... |
|
103 | hg qrecord [OPTION]... PATCH [FILE]... | |
104 |
|
104 | |||
105 | interactively record a new patch |
|
105 | interactively record a new patch | |
106 |
|
106 | |||
107 | (use 'hg qrecord -h' to show more help) |
|
107 | (use 'hg qrecord -h' to show more help) | |
108 | [255] |
|
108 | [255] | |
109 |
|
109 | |||
110 | qrecord patch (mq not present) |
|
110 | qrecord patch (mq not present) | |
111 |
|
111 | |||
112 | $ hg -R a qrecord patch |
|
112 | $ hg -R a qrecord patch | |
113 | abort: 'mq' extension not loaded |
|
113 | abort: 'mq' extension not loaded | |
114 | [255] |
|
114 | [255] | |
115 |
|
115 | |||
116 | help (bad mq) |
|
116 | help (bad mq) | |
117 |
|
117 | |||
118 | $ echo "mq=nonexistent" >> $HGRCPATH |
|
118 | $ echo "mq=nonexistent" >> $HGRCPATH | |
119 | $ hg help qrecord |
|
119 | $ hg help qrecord | |
120 | *** failed to import extension mq from nonexistent: [Errno *] * (glob) |
|
120 | *** failed to import extension mq from nonexistent: [Errno *] * (glob) | |
121 | hg qrecord [OPTION]... PATCH [FILE]... |
|
121 | hg qrecord [OPTION]... PATCH [FILE]... | |
122 |
|
122 | |||
123 | interactively record a new patch |
|
123 | interactively record a new patch | |
124 |
|
124 | |||
125 | See 'hg help qnew' & 'hg help record' for more information and usage. |
|
125 | See 'hg help qnew' & 'hg help record' for more information and usage. | |
126 |
|
126 | |||
127 | (some details hidden, use --verbose to show complete help) |
|
127 | (some details hidden, use --verbose to show complete help) | |
128 |
|
128 | |||
129 | help (mq present) |
|
129 | help (mq present) | |
130 |
|
130 | |||
131 | $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp |
|
131 | $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp | |
132 | $ mv hgrc.tmp $HGRCPATH |
|
132 | $ mv hgrc.tmp $HGRCPATH | |
133 |
|
133 | |||
134 | $ hg help qrecord |
|
134 | $ hg help qrecord | |
135 | hg qrecord [OPTION]... PATCH [FILE]... |
|
135 | hg qrecord [OPTION]... PATCH [FILE]... | |
136 |
|
136 | |||
137 | interactively record a new patch |
|
137 | interactively record a new patch | |
138 |
|
138 | |||
139 | See 'hg help qnew' & 'hg help record' for more information and usage. |
|
139 | See 'hg help qnew' & 'hg help record' for more information and usage. | |
140 |
|
140 | |||
141 | options ([+] can be repeated): |
|
141 | options ([+] can be repeated): | |
142 |
|
142 | |||
143 | -e --edit invoke editor on commit messages |
|
143 | -e --edit invoke editor on commit messages | |
144 | -g --git use git extended diff format |
|
144 | -g --git use git extended diff format | |
145 | -U --currentuser add "From: <current user>" to patch |
|
145 | -U --currentuser add "From: <current user>" to patch | |
146 | -u --user USER add "From: <USER>" to patch |
|
146 | -u --user USER add "From: <USER>" to patch | |
147 | -D --currentdate add "Date: <current date>" to patch |
|
147 | -D --currentdate add "Date: <current date>" to patch | |
148 | -d --date DATE add "Date: <DATE>" to patch |
|
148 | -d --date DATE add "Date: <DATE>" to patch | |
149 | -I --include PATTERN [+] include names matching the given patterns |
|
149 | -I --include PATTERN [+] include names matching the given patterns | |
150 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
150 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
151 | -m --message TEXT use text as commit message |
|
151 | -m --message TEXT use text as commit message | |
152 | -l --logfile FILE read commit message from file |
|
152 | -l --logfile FILE read commit message from file | |
153 | -w --ignore-all-space ignore white space when comparing lines |
|
153 | -w --ignore-all-space ignore white space when comparing lines | |
154 | -b --ignore-space-change ignore changes in the amount of white space |
|
154 | -b --ignore-space-change ignore changes in the amount of white space | |
155 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
155 | -B --ignore-blank-lines ignore changes whose lines are all blank | |
156 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL |
|
156 | -Z --ignore-space-at-eol ignore changes in whitespace at EOL | |
157 | --mq operate on patch repository |
|
157 | --mq operate on patch repository | |
158 |
|
158 | |||
159 | (some details hidden, use --verbose to show complete help) |
|
159 | (some details hidden, use --verbose to show complete help) | |
160 |
|
160 | |||
161 | $ cd a |
|
161 | $ cd a | |
162 |
|
162 | |||
163 | Base commit |
|
163 | Base commit | |
164 |
|
164 | |||
165 | $ cat > 1.txt <<EOF |
|
165 | $ cat > 1.txt <<EOF | |
166 | > 1 |
|
166 | > 1 | |
167 | > 2 |
|
167 | > 2 | |
168 | > 3 |
|
168 | > 3 | |
169 | > 4 |
|
169 | > 4 | |
170 | > 5 |
|
170 | > 5 | |
171 | > EOF |
|
171 | > EOF | |
172 | $ cat > 2.txt <<EOF |
|
172 | $ cat > 2.txt <<EOF | |
173 | > a |
|
173 | > a | |
174 | > b |
|
174 | > b | |
175 | > c |
|
175 | > c | |
176 | > d |
|
176 | > d | |
177 | > e |
|
177 | > e | |
178 | > f |
|
178 | > f | |
179 | > EOF |
|
179 | > EOF | |
180 |
|
180 | |||
181 | $ mkdir dir |
|
181 | $ mkdir dir | |
182 | $ cat > dir/a.txt <<EOF |
|
182 | $ cat > dir/a.txt <<EOF | |
183 | > hello world |
|
183 | > hello world | |
184 | > |
|
184 | > | |
185 | > someone |
|
185 | > someone | |
186 | > up |
|
186 | > up | |
187 | > there |
|
187 | > there | |
188 | > loves |
|
188 | > loves | |
189 | > me |
|
189 | > me | |
190 | > EOF |
|
190 | > EOF | |
191 |
|
191 | |||
192 | $ hg add 1.txt 2.txt dir/a.txt |
|
192 | $ hg add 1.txt 2.txt dir/a.txt | |
193 | $ hg commit -m 'initial checkin' |
|
193 | $ hg commit -m 'initial checkin' | |
194 |
|
194 | |||
195 | Changing files |
|
195 | Changing files | |
196 |
|
196 | |||
197 | $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new |
|
197 | $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new | |
198 | $ sed -e 's/b/b b/' 2.txt > 2.txt.new |
|
198 | $ sed -e 's/b/b b/' 2.txt > 2.txt.new | |
199 | $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new |
|
199 | $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new | |
200 |
|
200 | |||
201 | $ mv -f 1.txt.new 1.txt |
|
201 | $ mv -f 1.txt.new 1.txt | |
202 | $ mv -f 2.txt.new 2.txt |
|
202 | $ mv -f 2.txt.new 2.txt | |
203 | $ mv -f dir/a.txt.new dir/a.txt |
|
203 | $ mv -f dir/a.txt.new dir/a.txt | |
204 |
|
204 | |||
205 | Whole diff |
|
205 | Whole diff | |
206 |
|
206 | |||
207 | $ hg diff --nodates |
|
207 | $ hg diff --nodates | |
208 | diff -r 1057167b20ef 1.txt |
|
208 | diff -r 1057167b20ef 1.txt | |
209 | --- a/1.txt |
|
209 | --- a/1.txt | |
210 | +++ b/1.txt |
|
210 | +++ b/1.txt | |
211 | @@ -1,5 +1,5 @@ |
|
211 | @@ -1,5 +1,5 @@ | |
212 | 1 |
|
212 | 1 | |
213 | -2 |
|
213 | -2 | |
214 | +2 2 |
|
214 | +2 2 | |
215 | 3 |
|
215 | 3 | |
216 | -4 |
|
216 | -4 | |
217 | +4 4 |
|
217 | +4 4 | |
218 | 5 |
|
218 | 5 | |
219 | diff -r 1057167b20ef 2.txt |
|
219 | diff -r 1057167b20ef 2.txt | |
220 | --- a/2.txt |
|
220 | --- a/2.txt | |
221 | +++ b/2.txt |
|
221 | +++ b/2.txt | |
222 | @@ -1,5 +1,5 @@ |
|
222 | @@ -1,5 +1,5 @@ | |
223 | a |
|
223 | a | |
224 | -b |
|
224 | -b | |
225 | +b b |
|
225 | +b b | |
226 | c |
|
226 | c | |
227 | d |
|
227 | d | |
228 | e |
|
228 | e | |
229 | diff -r 1057167b20ef dir/a.txt |
|
229 | diff -r 1057167b20ef dir/a.txt | |
230 | --- a/dir/a.txt |
|
230 | --- a/dir/a.txt | |
231 | +++ b/dir/a.txt |
|
231 | +++ b/dir/a.txt | |
232 | @@ -1,4 +1,4 @@ |
|
232 | @@ -1,4 +1,4 @@ | |
233 | -hello world |
|
233 | -hello world | |
234 | +hello world! |
|
234 | +hello world! | |
235 |
|
235 | |||
236 | someone |
|
236 | someone | |
237 | up |
|
237 | up | |
238 |
|
238 | |||
239 | qrecord with bad patch name, should abort before prompting |
|
239 | qrecord with bad patch name, should abort before prompting | |
240 |
|
240 | |||
241 | $ hg qrecord .hg |
|
241 | $ hg qrecord .hg | |
242 | abort: patch name cannot begin with ".hg" |
|
242 | abort: patch name cannot begin with ".hg" | |
243 | [255] |
|
243 | [255] | |
244 | $ hg qrecord ' foo' |
|
244 | $ hg qrecord ' foo' | |
245 | abort: patch name cannot begin or end with whitespace |
|
245 | abort: patch name cannot begin or end with whitespace | |
246 | [255] |
|
246 | [255] | |
247 | $ hg qrecord 'foo ' |
|
247 | $ hg qrecord 'foo ' | |
248 | abort: patch name cannot begin or end with whitespace |
|
248 | abort: patch name cannot begin or end with whitespace | |
249 | [255] |
|
249 | [255] | |
250 |
|
250 | |||
251 | qrecord a.patch |
|
251 | qrecord a.patch | |
252 |
|
252 | |||
253 | $ hg qrecord -d '0 0' -m aaa a.patch <<EOF |
|
253 | $ hg qrecord -d '0 0' -m aaa a.patch <<EOF | |
254 | > y |
|
254 | > y | |
255 | > y |
|
255 | > y | |
256 | > n |
|
256 | > n | |
257 | > y |
|
257 | > y | |
258 | > y |
|
258 | > y | |
259 | > n |
|
259 | > n | |
260 | > EOF |
|
260 | > EOF | |
261 | diff --git a/1.txt b/1.txt |
|
261 | diff --git a/1.txt b/1.txt | |
262 | 2 hunks, 2 lines changed |
|
262 | 2 hunks, 2 lines changed | |
263 | examine changes to '1.txt'? [Ynesfdaq?] y |
|
263 | examine changes to '1.txt'? [Ynesfdaq?] y | |
264 |
|
264 | |||
265 | @@ -1,3 +1,3 @@ |
|
265 | @@ -1,3 +1,3 @@ | |
266 | 1 |
|
266 | 1 | |
267 | -2 |
|
267 | -2 | |
268 | +2 2 |
|
268 | +2 2 | |
269 | 3 |
|
269 | 3 | |
270 | record change 1/4 to '1.txt'? [Ynesfdaq?] y |
|
270 | record change 1/4 to '1.txt'? [Ynesfdaq?] y | |
271 |
|
271 | |||
272 | @@ -3,3 +3,3 @@ |
|
272 | @@ -3,3 +3,3 @@ | |
273 | 3 |
|
273 | 3 | |
274 | -4 |
|
274 | -4 | |
275 | +4 4 |
|
275 | +4 4 | |
276 | 5 |
|
276 | 5 | |
277 | record change 2/4 to '1.txt'? [Ynesfdaq?] n |
|
277 | record change 2/4 to '1.txt'? [Ynesfdaq?] n | |
278 |
|
278 | |||
279 | diff --git a/2.txt b/2.txt |
|
279 | diff --git a/2.txt b/2.txt | |
280 | 1 hunks, 1 lines changed |
|
280 | 1 hunks, 1 lines changed | |
281 | examine changes to '2.txt'? [Ynesfdaq?] y |
|
281 | examine changes to '2.txt'? [Ynesfdaq?] y | |
282 |
|
282 | |||
283 | @@ -1,5 +1,5 @@ |
|
283 | @@ -1,5 +1,5 @@ | |
284 | a |
|
284 | a | |
285 | -b |
|
285 | -b | |
286 | +b b |
|
286 | +b b | |
287 | c |
|
287 | c | |
288 | d |
|
288 | d | |
289 | e |
|
289 | e | |
290 | record change 3/4 to '2.txt'? [Ynesfdaq?] y |
|
290 | record change 3/4 to '2.txt'? [Ynesfdaq?] y | |
291 |
|
291 | |||
292 | diff --git a/dir/a.txt b/dir/a.txt |
|
292 | diff --git a/dir/a.txt b/dir/a.txt | |
293 | 1 hunks, 1 lines changed |
|
293 | 1 hunks, 1 lines changed | |
294 | examine changes to 'dir/a.txt'? [Ynesfdaq?] n |
|
294 | examine changes to 'dir/a.txt'? [Ynesfdaq?] n | |
295 |
|
295 | |||
296 |
|
296 | |||
297 | After qrecord a.patch 'tip'" |
|
297 | After qrecord a.patch 'tip'" | |
298 |
|
298 | |||
299 | $ hg tip -p |
|
299 | $ hg tip -p | |
300 | changeset: 1:5d1ca63427ee |
|
300 | changeset: 1:5d1ca63427ee | |
301 | tag: a.patch |
|
301 | tag: a.patch | |
302 | tag: qbase |
|
302 | tag: qbase | |
303 | tag: qtip |
|
303 | tag: qtip | |
304 | tag: tip |
|
304 | tag: tip | |
305 | user: test |
|
305 | user: test | |
306 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
306 | date: Thu Jan 01 00:00:00 1970 +0000 | |
307 | summary: aaa |
|
307 | summary: aaa | |
308 |
|
308 | |||
309 | diff -r 1057167b20ef -r 5d1ca63427ee 1.txt |
|
309 | diff -r 1057167b20ef -r 5d1ca63427ee 1.txt | |
310 | --- a/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
310 | --- a/1.txt Thu Jan 01 00:00:00 1970 +0000 | |
311 | +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
311 | +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 | |
312 | @@ -1,5 +1,5 @@ |
|
312 | @@ -1,5 +1,5 @@ | |
313 | 1 |
|
313 | 1 | |
314 | -2 |
|
314 | -2 | |
315 | +2 2 |
|
315 | +2 2 | |
316 | 3 |
|
316 | 3 | |
317 | 4 |
|
317 | 4 | |
318 | 5 |
|
318 | 5 | |
319 | diff -r 1057167b20ef -r 5d1ca63427ee 2.txt |
|
319 | diff -r 1057167b20ef -r 5d1ca63427ee 2.txt | |
320 | --- a/2.txt Thu Jan 01 00:00:00 1970 +0000 |
|
320 | --- a/2.txt Thu Jan 01 00:00:00 1970 +0000 | |
321 | +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000 |
|
321 | +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000 | |
322 | @@ -1,5 +1,5 @@ |
|
322 | @@ -1,5 +1,5 @@ | |
323 | a |
|
323 | a | |
324 | -b |
|
324 | -b | |
325 | +b b |
|
325 | +b b | |
326 | c |
|
326 | c | |
327 | d |
|
327 | d | |
328 | e |
|
328 | e | |
329 |
|
329 | |||
330 |
|
330 | |||
331 | After qrecord a.patch 'diff'" |
|
331 | After qrecord a.patch 'diff'" | |
332 |
|
332 | |||
333 | $ hg diff --nodates |
|
333 | $ hg diff --nodates | |
334 | diff -r 5d1ca63427ee 1.txt |
|
334 | diff -r 5d1ca63427ee 1.txt | |
335 | --- a/1.txt |
|
335 | --- a/1.txt | |
336 | +++ b/1.txt |
|
336 | +++ b/1.txt | |
337 | @@ -1,5 +1,5 @@ |
|
337 | @@ -1,5 +1,5 @@ | |
338 | 1 |
|
338 | 1 | |
339 | 2 2 |
|
339 | 2 2 | |
340 | 3 |
|
340 | 3 | |
341 | -4 |
|
341 | -4 | |
342 | +4 4 |
|
342 | +4 4 | |
343 | 5 |
|
343 | 5 | |
344 | diff -r 5d1ca63427ee dir/a.txt |
|
344 | diff -r 5d1ca63427ee dir/a.txt | |
345 | --- a/dir/a.txt |
|
345 | --- a/dir/a.txt | |
346 | +++ b/dir/a.txt |
|
346 | +++ b/dir/a.txt | |
347 | @@ -1,4 +1,4 @@ |
|
347 | @@ -1,4 +1,4 @@ | |
348 | -hello world |
|
348 | -hello world | |
349 | +hello world! |
|
349 | +hello world! | |
350 |
|
350 | |||
351 | someone |
|
351 | someone | |
352 | up |
|
352 | up | |
353 |
|
353 | |||
354 | qrecord b.patch |
|
354 | qrecord b.patch | |
355 |
|
355 | |||
356 | $ hg qrecord -d '0 0' -m bbb b.patch <<EOF |
|
356 | $ hg qrecord -d '0 0' -m bbb b.patch <<EOF | |
357 | > y |
|
357 | > y | |
358 | > y |
|
358 | > y | |
359 | > y |
|
359 | > y | |
360 | > y |
|
360 | > y | |
361 | > EOF |
|
361 | > EOF | |
362 | diff --git a/1.txt b/1.txt |
|
362 | diff --git a/1.txt b/1.txt | |
363 | 1 hunks, 1 lines changed |
|
363 | 1 hunks, 1 lines changed | |
364 | examine changes to '1.txt'? [Ynesfdaq?] y |
|
364 | examine changes to '1.txt'? [Ynesfdaq?] y | |
365 |
|
365 | |||
366 | @@ -1,5 +1,5 @@ |
|
366 | @@ -1,5 +1,5 @@ | |
367 | 1 |
|
367 | 1 | |
368 | 2 2 |
|
368 | 2 2 | |
369 | 3 |
|
369 | 3 | |
370 | -4 |
|
370 | -4 | |
371 | +4 4 |
|
371 | +4 4 | |
372 | 5 |
|
372 | 5 | |
373 | record change 1/2 to '1.txt'? [Ynesfdaq?] y |
|
373 | record change 1/2 to '1.txt'? [Ynesfdaq?] y | |
374 |
|
374 | |||
375 | diff --git a/dir/a.txt b/dir/a.txt |
|
375 | diff --git a/dir/a.txt b/dir/a.txt | |
376 | 1 hunks, 1 lines changed |
|
376 | 1 hunks, 1 lines changed | |
377 | examine changes to 'dir/a.txt'? [Ynesfdaq?] y |
|
377 | examine changes to 'dir/a.txt'? [Ynesfdaq?] y | |
378 |
|
378 | |||
379 | @@ -1,4 +1,4 @@ |
|
379 | @@ -1,4 +1,4 @@ | |
380 | -hello world |
|
380 | -hello world | |
381 | +hello world! |
|
381 | +hello world! | |
382 |
|
382 | |||
383 | someone |
|
383 | someone | |
384 | up |
|
384 | up | |
385 | record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y |
|
385 | record change 2/2 to 'dir/a.txt'? [Ynesfdaq?] y | |
386 |
|
386 | |||
387 |
|
387 | |||
388 | After qrecord b.patch 'tip' |
|
388 | After qrecord b.patch 'tip' | |
389 |
|
389 | |||
390 | $ hg tip -p |
|
390 | $ hg tip -p | |
391 | changeset: 2:b056198bf878 |
|
391 | changeset: 2:b056198bf878 | |
392 | tag: b.patch |
|
392 | tag: b.patch | |
393 | tag: qtip |
|
393 | tag: qtip | |
394 | tag: tip |
|
394 | tag: tip | |
395 | user: test |
|
395 | user: test | |
396 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
396 | date: Thu Jan 01 00:00:00 1970 +0000 | |
397 | summary: bbb |
|
397 | summary: bbb | |
398 |
|
398 | |||
399 | diff -r 5d1ca63427ee -r b056198bf878 1.txt |
|
399 | diff -r 5d1ca63427ee -r b056198bf878 1.txt | |
400 | --- a/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
400 | --- a/1.txt Thu Jan 01 00:00:00 1970 +0000 | |
401 | +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 |
|
401 | +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 | |
402 | @@ -1,5 +1,5 @@ |
|
402 | @@ -1,5 +1,5 @@ | |
403 | 1 |
|
403 | 1 | |
404 | 2 2 |
|
404 | 2 2 | |
405 | 3 |
|
405 | 3 | |
406 | -4 |
|
406 | -4 | |
407 | +4 4 |
|
407 | +4 4 | |
408 | 5 |
|
408 | 5 | |
409 | diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt |
|
409 | diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt | |
410 | --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 |
|
410 | --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 | |
411 | +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 |
|
411 | +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 | |
412 | @@ -1,4 +1,4 @@ |
|
412 | @@ -1,4 +1,4 @@ | |
413 | -hello world |
|
413 | -hello world | |
414 | +hello world! |
|
414 | +hello world! | |
415 |
|
415 | |||
416 | someone |
|
416 | someone | |
417 | up |
|
417 | up | |
418 |
|
418 | |||
419 |
|
419 | |||
420 | After qrecord b.patch 'diff' |
|
420 | After qrecord b.patch 'diff' | |
421 |
|
421 | |||
422 | $ hg diff --nodates |
|
422 | $ hg diff --nodates | |
423 |
|
423 | |||
424 | $ cd .. |
|
424 | $ cd .. | |
|
425 | ||||
|
426 | qrecord should throw an error when histedit in process | |||
|
427 | ||||
|
428 | $ hg init issue5981 | |||
|
429 | $ cd issue5981 | |||
|
430 | $ cat >> $HGRCPATH <<EOF | |||
|
431 | > [extensions] | |||
|
432 | > histedit= | |||
|
433 | > mq= | |||
|
434 | > EOF | |||
|
435 | $ echo > a | |||
|
436 | $ hg ci -Am 'foo bar' | |||
|
437 | adding a | |||
|
438 | $ hg log | |||
|
439 | changeset: 0:ea55e2ae468f | |||
|
440 | tag: tip | |||
|
441 | user: test | |||
|
442 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
443 | summary: foo bar | |||
|
444 | ||||
|
445 | $ hg histedit tip --commands - 2>&1 <<EOF | |||
|
446 | > edit ea55e2ae468f foo bar | |||
|
447 | > EOF | |||
|
448 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
449 | adding a | |||
|
450 | Editing (ea55e2ae468f), you may commit or record as needed now. | |||
|
451 | (hg histedit --continue to resume) | |||
|
452 | [1] | |||
|
453 | $ echo 'foo bar' > a | |||
|
454 | $ hg qrecord -d '0 0' -m aaa a.patch <<EOF | |||
|
455 | > y | |||
|
456 | > y | |||
|
457 | > n | |||
|
458 | > y | |||
|
459 | > y | |||
|
460 | > n | |||
|
461 | > EOF | |||
|
462 | abort: histedit in progress | |||
|
463 | (use 'hg histedit --continue' or 'hg histedit --abort') | |||
|
464 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now