annotate hgext/record.py @ 45049:513b3ef277a3

rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root` The println macro is not used to avoid string usage. Dealing only with bytes allows us to be compatible with any encoding and not just UTF8. Later on, format macro will be made to have more readable code. Differential Revision: https://phab.mercurial-scm.org/D8612
author Antoine Cezar <antoine.cezar@octobus.net>
date Fri, 05 Jun 2020 09:01:35 +0200
parents 9f70512ae2cf
children 89a2afe31e82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 # record.py
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2 #
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 # Copyright 2007 Bryan O'Sullivan <bos@serpentine.com>
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 #
8225
46293a0c7e9f updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents: 8208
diff changeset
5 # This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 9837
diff changeset
6 # GNU General Public License version 2 or any later version.
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7
28697
d001d6d27570 record: deprecate the extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 28381
diff changeset
8 '''commands to interactively select changes for commit/qrefresh (DEPRECATED)
d001d6d27570 record: deprecate the extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 28381
diff changeset
9
d001d6d27570 record: deprecate the extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 28381
diff changeset
10 The feature provided by this extension has been moved into core Mercurial as
d001d6d27570 record: deprecate the extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 28381
diff changeset
11 :hg:`commit --interactive`.'''
d001d6d27570 record: deprecate the extension
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 28381
diff changeset
12
28381
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
13 from __future__ import absolute_import
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14
29205
a0939666b836 py3: move up symbol imports to enforce import-checker rules
Yuya Nishihara <yuya@tcha.org>
parents: 28697
diff changeset
15 from mercurial.i18n import _
28381
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
16 from mercurial import (
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
17 cmdutil,
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
18 commands,
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
19 error,
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
20 extensions,
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31458
diff changeset
21 registrar,
28381
44ffbb2a4f59 record: use absolute_import
timeless <timeless@mozdev.org>
parents: 26587
diff changeset
22 )
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23
14408
054da1e0afbe record: use cmdutil.command decorator
Idan Kamara <idankk86@gmail.com>
parents: 14407
diff changeset
24 cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31458
diff changeset
25 command = registrar.command(cmdtable)
29841
d5883fd055c6 extensions: change magic "shipped with hg" string
Augie Fackler <augie@google.com>
parents: 29205
diff changeset
26 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
25186
80c5b2666a96 extensions: document that `testedwith = 'internal'` is special
Augie Fackler <augie@google.com>
parents: 24309
diff changeset
27 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
80c5b2666a96 extensions: document that `testedwith = 'internal'` is special
Augie Fackler <augie@google.com>
parents: 24309
diff changeset
28 # be specifying the version(s) of Mercurial they are tested with, or
80c5b2666a96 extensions: document that `testedwith = 'internal'` is special
Augie Fackler <augie@google.com>
parents: 24309
diff changeset
29 # leave the attribute unspecified.
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
30 testedwith = b'ships-with-hg-core'
14408
054da1e0afbe record: use cmdutil.command decorator
Idan Kamara <idankk86@gmail.com>
parents: 14407
diff changeset
31
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
33 @command(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
34 b"record",
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
35 # same options as commit + white space diff options
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
36 [c for c in commands.table[b'commit|ci'][1][:] if c[1] != b"interactive"]
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
37 + cmdutil.diffwsopts,
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
38 _(b'hg record [OPTION]... [FILE]...'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
39 helpcategory=command.CATEGORY_COMMITTING,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
40 )
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 def record(ui, repo, *pats, **opts):
5154
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
42 '''interactively select changes to commit
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
43
10973
49a07f441496 Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents: 10890
diff changeset
44 If a list of files is omitted, all changes reported by :hg:`status`
9272
784899697571 record: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9157
diff changeset
45 will be candidates for recording.
5154
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
46
10973
49a07f441496 Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents: 10890
diff changeset
47 See :hg:`help dates` for a list of formats valid for -d/--date.
6163
1f733c2f0165 Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5932
diff changeset
48
31065
7074589cf22a record: update help to describe ui.interface
eloimorlaas <eloimorlaas@fb.com>
parents: 30158
diff changeset
49 If using the text interface (see :hg:`help config`),
7074589cf22a record: update help to describe ui.interface
eloimorlaas <eloimorlaas@fb.com>
parents: 30158
diff changeset
50 you will be prompted for whether to record changes to each
9272
784899697571 record: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9157
diff changeset
51 modified file, and for files with multiple changes, for each
784899697571 record: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9157
diff changeset
52 change to use. For each query, the following responses are
784899697571 record: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9157
diff changeset
53 possible::
5154
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
54
9157
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
55 y - record this change
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
56 n - skip this change
16324
46b991a1f428 record: allow splitting of hunks by manually editing patches
A. S. Budden <abudden@gmail.com>
parents: 15184
diff changeset
57 e - edit this change manually
5154
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
58
9157
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
59 s - skip remaining changes to this file
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
60 f - record remaining changes to this file
5154
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
61
9157
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
62 d - done, skip remaining changes and files
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
63 a - record all changes to all remaining files
9261667e9b82 commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents: 9087
diff changeset
64 q - quit, recording no changes
5154
67afecb8d6cc record: improve docs, improve prompts
Bryan O'Sullivan <bos@serpentine.com>
parents: 5147
diff changeset
65
11237
feb2a58fc592 record: check that we are not committing a merge before patch selection
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11236
diff changeset
66 ? - display help
feb2a58fc592 record: check that we are not committing a merge before patch selection
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11236
diff changeset
67
feb2a58fc592 record: check that we are not committing a merge before patch selection
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11236
diff changeset
68 This command is not available when committing a merge.'''
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
69
25796
4eb8d8a44bf1 record: omit meaningless 'commit' suggestion at 'hg commit -i'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25223
diff changeset
70 if not ui.interactive():
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
71 raise error.Abort(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
72 _(b'running non-interactively, use %s instead') % b'commit'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
73 )
25796
4eb8d8a44bf1 record: omit meaningless 'commit' suggestion at 'hg commit -i'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25223
diff changeset
74
43503
313e3a279828 cleanup: remove pointless r-prefixes on double-quoted strings
Augie Fackler <augie@google.com>
parents: 43077
diff changeset
75 opts["interactive"] = True
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
76 overrides = {(b'experimental', b'crecord'): False}
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
77 with ui.configoverride(overrides, b'record'):
30158
1baa0e2cfc37 record: return code from underlying commit
Philippe Pepiot <philippe.pepiot@logilab.fr>
parents: 29841
diff changeset
78 return commands.commit(ui, repo, *pats, **opts)
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
79
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
80
15184
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
81 def qrefresh(origfn, ui, repo, *pats, **opts):
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
82 if not opts['interactive']:
15184
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
83 return origfn(ui, repo, *pats, **opts)
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
84
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
85 mq = extensions.find(b'mq')
14426
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
86
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
87 def committomq(ui, repo, *pats, **opts):
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
88 # At this point the working copy contains only changes that
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
89 # were accepted. All other changes were reverted.
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
90 # We can't pass *pats here since qrefresh will undo all other
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
91 # changed files in the patch that aren't in pats.
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
92 mq.refresh(ui, repo, **opts)
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
93
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
94 # backup all changed files
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
95 cmdutil.dorecord(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
96 ui, repo, committomq, None, True, cmdutil.recordfilter, *pats, **opts
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
97 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
98
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
99
21251
a836fa58b512 record: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 20334
diff changeset
100 # This command registration is replaced during uisetup().
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
101 @command(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
102 b'qrecord',
21787
fb5f34bb3867 record: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents: 21251
diff changeset
103 [],
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
104 _(b'hg qrecord [OPTION]... PATCH [FILE]...'),
40293
c303d65d2e34 help: assigning categories to existing commands
rdamazio@google.com
parents: 35403
diff changeset
105 helpcategory=command.CATEGORY_COMMITTING,
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
106 inferrepo=True,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
107 )
5932
b014ff3fdaeb qrecord: record complements commit, so qrecord should complement qnew
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5830
diff changeset
108 def qrecord(ui, repo, patch, *pats, **opts):
b014ff3fdaeb qrecord: record complements commit, so qrecord should complement qnew
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5830
diff changeset
109 '''interactively record a new patch
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
110
10973
49a07f441496 Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents: 10890
diff changeset
111 See :hg:`help qnew` & :hg:`help record` for more information and
9272
784899697571 record: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents: 9157
diff changeset
112 usage.
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
113 '''
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
114 return _qrecord(b'qnew', ui, repo, patch, *pats, **opts)
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
115
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
116
25797
cc9fb45986d4 record: omit meaningless 'qnew' suggestion at 'hg qnew -i'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25796
diff changeset
117 def _qrecord(cmdsuggest, ui, repo, patch, *pats, **opts):
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
118 try:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
119 mq = extensions.find(b'mq')
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
120 except KeyError:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
121 raise error.Abort(_(b"'mq' extension not loaded"))
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
122
14424
4eb88d296f63 record: check patch name is valid before prompting in qrecord
Idan Kamara <idankk86@gmail.com>
parents: 14408
diff changeset
123 repo.mq.checkpatchname(patch)
4eb88d296f63 record: check patch name is valid before prompting in qrecord
Idan Kamara <idankk86@gmail.com>
parents: 14408
diff changeset
124
10323
0aa59f532ef9 record: function variable naming & signature cleanup.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10282
diff changeset
125 def committomq(ui, repo, *pats, **opts):
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
126 opts['checkname'] = False
5932
b014ff3fdaeb qrecord: record complements commit, so qrecord should complement qnew
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5830
diff changeset
127 mq.new(ui, repo, patch, *pats, **opts)
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
128
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
129 overrides = {(b'experimental', b'crecord'): False}
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
130 with ui.configoverride(overrides, b'record'):
41790
4d21ebc4cb47 mq: disable qrecord during histedit (issue5981)
Navaneeth Suresh <navaneeths1998@gmail.com>
parents: 41759
diff changeset
131 cmdutil.checkunfinished(repo)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
132 cmdutil.dorecord(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
133 ui,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
134 repo,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
135 committomq,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
136 cmdsuggest,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
137 False,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
138 cmdutil.recordfilter,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
139 *pats,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
140 **opts
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
141 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
142
5827
0c29977bd7db record: refactor record into generic record driver
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5826
diff changeset
143
15184
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
144 def qnew(origfn, ui, repo, patch, *args, **opts):
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
145 if opts['interactive']:
25797
cc9fb45986d4 record: omit meaningless 'qnew' suggestion at 'hg qnew -i'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 25796
diff changeset
146 return _qrecord(None, ui, repo, patch, *args, **opts)
15184
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
147 return origfn(ui, repo, patch, *args, **opts)
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
148
5037
b2607267236d Add record extension, giving darcs-like interactive hunk picking
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
149
9710
1765599f4899 record: use uisetup instead of extsetup to register qrecord
Martin Geisler <mg@lazybytes.net>
parents: 9688
diff changeset
150 def uisetup(ui):
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
151 try:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
152 mq = extensions.find(b'mq')
5830
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
153 except KeyError:
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
154 return
c32d41affb68 hg qrecord -- like record, but for mq
Kirill Smelkov <kirr@mns.spb.ru>
parents: 5827
diff changeset
155
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
156 cmdtable[b"qrecord"] = (
41759
aaad36b88298 cleanup: use () to wrap long lines instead of \
Augie Fackler <augie@google.com>
parents: 40295
diff changeset
157 qrecord,
aaad36b88298 cleanup: use () to wrap long lines instead of \
Augie Fackler <augie@google.com>
parents: 40295
diff changeset
158 # same options as qnew, but copy them so we don't get
aaad36b88298 cleanup: use () to wrap long lines instead of \
Augie Fackler <augie@google.com>
parents: 40295
diff changeset
159 # -i/--interactive for qrecord and add white space diff options
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
160 mq.cmdtable[b'qnew'][1][:] + cmdutil.diffwsopts,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
161 _(b'hg qrecord [OPTION]... PATCH [FILE]...'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
162 )
14426
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
163
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
164 _wrapcmd(b'qnew', mq.cmdtable, qnew, _(b"interactively record a new patch"))
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
165 _wrapcmd(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
166 b'qrefresh',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
167 mq.cmdtable,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
168 qrefresh,
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
169 _(b"interactively select changes to refresh"),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
170 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 41790
diff changeset
171
14426
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
172
1df64ccef23e record: add qrefresh -i/--interactive
Idan Kamara <idankk86@gmail.com>
parents: 14425
diff changeset
173 def _wrapcmd(cmd, table, wrapfn, msg):
15184
351a9292e430 record: use command wrapper properly for qnew/qrefresh (issue3001)
Matt Mackall <mpm@selenic.com>
parents: 14597
diff changeset
174 entry = extensions.wrapcommand(table, cmd, wrapfn)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
175 entry[1].append((b'i', b'interactive', None, msg))