annotate hgext/githelp.py @ 45392:c25efc468a49

mercurial: force LF endings for *.py, *.{c,h} and *.t in .editorconfig PyCharm on Windows otherwise uses CRLF. Differential Revision: https://phab.mercurial-scm.org/D8947
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 24 Aug 2020 12:39:48 -0400
parents 94f227baa76f
children 89a2afe31e82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 # githelp.py - Try to map Git commands to Mercurial equivalents.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 #
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 # Copyright 2013 Facebook, Inc.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
4 #
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
5 # This software may be used and distributed according to the terms of the
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
6 # GNU General Public License version 2 or any later version.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
7 """try mapping git commands to Mercurial commands
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
8
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
9 Tries to map a given git command to a Mercurial command:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
10
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
11 $ hg githelp -- git checkout master
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
12 hg update master
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
13
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
14 If an unknown command or parameter combination is detected, an error is
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
15 produced.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
16 """
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
17
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
18 from __future__ import absolute_import
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
19
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
20 import getopt
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
21 import re
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
22
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
23 from mercurial.i18n import _
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
24 from mercurial import (
36230
257f3651ada9 githelp: cast commands to bytes
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35721
diff changeset
25 encoding,
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
26 error,
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
27 fancyopts,
41414
031d91623fdc githelp: make argument parsing more compatible with Python 3
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41365
diff changeset
28 pycompat,
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
29 registrar,
37388
764ada920db5 githelp: use revsymbol() for looking up symbol
Martin von Zweigbergk <martinvonz@google.com>
parents: 37120
diff changeset
30 scmutil,
37120
a8a902d7176e procutil: bulk-replace function calls to point to new module
Yuya Nishihara <yuya@tcha.org>
parents: 36230
diff changeset
31 )
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
32 from mercurial.utils import procutil
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
33
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
34 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
35 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
36 # be specifying the version(s) of Mercurial they are tested with, or
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
37 # leave the attribute unspecified.
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
38 testedwith = b'ships-with-hg-core'
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
39
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
40 cmdtable = {}
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
41 command = registrar.command(cmdtable)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
42
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
43
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
44 def convert(s):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
45 if s.startswith(b"origin/"):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
46 return s[7:]
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
47 if b'HEAD' in s:
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
48 s = s.replace(b'HEAD', b'.')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
49 # HEAD~ in git is .~1 in mercurial
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
50 s = re.sub(b'~$', b'~1', s)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
51 return s
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
52
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
53
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
54 @command(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
55 b'githelp|git',
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
56 [],
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
57 _(b'hg githelp'),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
58 helpcategory=command.CATEGORY_HELP,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
59 helpbasic=True,
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
60 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
61 def githelp(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
62 '''suggests the Mercurial equivalent of the given git command
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
63
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
64 Usage: hg githelp -- <git command>
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
65 '''
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
66
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
67 if len(args) == 0 or (len(args) == 1 and args[0] == b'git'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
68 raise error.Abort(
43117
8ff1ecfadcd1 cleanup: join string literals that are already on one line
Martin von Zweigbergk <martinvonz@google.com>
parents: 43105
diff changeset
69 _(b'missing git command - usage: hg githelp -- <git command>')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
70 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
71
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
72 if args[0] == b'git':
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
73 args = args[1:]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
74
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
75 cmd = args[0]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
76 if not cmd in gitcommands:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
77 raise error.Abort(_(b"error: unknown git command %s") % cmd)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
78
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
79 ui.pager(b'githelp')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
80 args = args[1:]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
81 return gitcommands[cmd](ui, repo, *args, **kwargs)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
82
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
83
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
84 def parseoptions(ui, cmdoptions, args):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
85 cmdoptions = list(cmdoptions)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
86 opts = {}
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
87 args = list(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
88 while True:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
89 try:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
90 args = fancyopts.fancyopts(list(args), cmdoptions, opts, True)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
91 break
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
92 except getopt.GetoptError as ex:
43503
313e3a279828 cleanup: remove pointless r-prefixes on double-quoted strings
Augie Fackler <augie@google.com>
parents: 43117
diff changeset
93 if "requires argument" in ex.msg:
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
94 raise
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
95 if ('--' + ex.opt) in ex.msg:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
96 flag = b'--' + pycompat.bytestr(ex.opt)
43506
9f70512ae2cf cleanup: remove pointless r-prefixes on single-quoted strings
Augie Fackler <augie@google.com>
parents: 43503
diff changeset
97 elif ('-' + ex.opt) in ex.msg:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
98 flag = b'-' + pycompat.bytestr(ex.opt)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
99 else:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
100 raise error.Abort(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
101 _(b"unknown option %s") % pycompat.bytestr(ex.opt)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
102 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
103 try:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
104 args.remove(flag)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
105 except Exception:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
106 msg = _(b"unknown option '%s' packed with other options")
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
107 hint = _(b"please try passing the option as its own flag: -%s")
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
108 raise error.Abort(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
109 msg % pycompat.bytestr(ex.opt),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
110 hint=hint % pycompat.bytestr(ex.opt),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
111 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
112
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
113 ui.warn(_(b"ignoring unknown option %s\n") % flag)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
114
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
115 args = list([convert(x) for x in args])
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
116 opts = dict(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
117 [
43745
24d0189238f1 githelp: fix a `str` type conditional for py3
Matt Harbison <matt_harbison@yahoo.com>
parents: 43117
diff changeset
118 (k, convert(v)) if isinstance(v, bytes) else (k, v)
43105
649d3ac37a12 py3: define and use pycompat.iteritems() for hgext/
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
119 for k, v in pycompat.iteritems(opts)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
120 ]
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
121 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
122
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
123 return args, opts
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
124
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
125
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
126 class Command(object):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
127 def __init__(self, name):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
128 self.name = name
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
129 self.args = []
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
130 self.opts = {}
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
131
36230
257f3651ada9 githelp: cast commands to bytes
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35721
diff changeset
132 def __bytes__(self):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
133 cmd = b"hg " + self.name
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
134 if self.opts:
43105
649d3ac37a12 py3: define and use pycompat.iteritems() for hgext/
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43077
diff changeset
135 for k, values in sorted(pycompat.iteritems(self.opts)):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
136 for v in values:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
137 if v:
41415
873a28d7e962 githelp: format with %d if an integer
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41414
diff changeset
138 if isinstance(v, int):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
139 fmt = b' %s %d'
41415
873a28d7e962 githelp: format with %d if an integer
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41414
diff changeset
140 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
141 fmt = b' %s %s'
41415
873a28d7e962 githelp: format with %d if an integer
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41414
diff changeset
142
873a28d7e962 githelp: format with %d if an integer
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41414
diff changeset
143 cmd += fmt % (k, v)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
144 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
145 cmd += b" %s" % (k,)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
146 if self.args:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
147 cmd += b" "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
148 cmd += b" ".join(self.args)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
149 return cmd
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
150
36230
257f3651ada9 githelp: cast commands to bytes
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35721
diff changeset
151 __str__ = encoding.strmethod(__bytes__)
257f3651ada9 githelp: cast commands to bytes
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35721
diff changeset
152
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
153 def append(self, value):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
154 self.args.append(value)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
155
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
156 def extend(self, values):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
157 self.args.extend(values)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
158
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
159 def __setitem__(self, key, value):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
160 values = self.opts.setdefault(key, [])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
161 values.append(value)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
162
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
163 def __and__(self, other):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
164 return AndCommand(self, other)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
165
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
166
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
167 class AndCommand(object):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
168 def __init__(self, left, right):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
169 self.left = left
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
170 self.right = right
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
171
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
172 def __str__(self):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
173 return b"%s && %s" % (self.left, self.right)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
174
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
175 def __and__(self, other):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
176 return AndCommand(self, other)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
177
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
178
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
179 def add(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
180 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
181 (b'A', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
182 (b'p', b'patch', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
183 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
184 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
185
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
186 if opts.get(b'patch'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
187 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
188 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
189 b"note: Mercurial will commit when complete, "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
190 b"as there is no staging area in Mercurial\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
191 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
192 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
193 cmd = Command(b'commit --interactive')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
194 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
195 cmd = Command(b"add")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
196
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
197 if not opts.get(b'all'):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
198 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
199 else:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
200 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
201 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
202 b"note: use hg addremove to remove files that have "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
203 b"been deleted\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
204 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
205 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
206
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
207 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
208
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
209
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
210 def am(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
211 cmdoptions = []
43973
ca5bd34c597b githelp: drop unused variable assignments
Matt Harbison <matt_harbison@yahoo.com>
parents: 43793
diff changeset
212 parseoptions(ui, cmdoptions, args)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
213 cmd = Command(b'import')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
214 ui.status(bytes(cmd), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
215
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
216
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
217 def apply(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
218 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
219 (b'p', b'p', int, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
220 (b'', b'directory', b'', b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
221 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
222 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
223
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
224 cmd = Command(b'import --no-commit')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
225 if opts.get(b'p'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
226 cmd[b'-p'] = opts.get(b'p')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
227 if opts.get(b'directory'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
228 cmd[b'--prefix'] = opts.get(b'directory')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
229 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
230
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
231 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
232
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
233
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
234 def bisect(ui, repo, *args, **kwargs):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
235 ui.status(_(b"see 'hg help bisect' for how to use bisect\n\n"))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
236
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
237
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
238 def blame(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
239 cmdoptions = []
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
240 args, opts = parseoptions(ui, cmdoptions, args)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
241 cmd = Command(b'annotate -udl')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
242 cmd.extend([convert(v) for v in args])
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
243 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
244
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
245
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
246 def branch(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
247 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
248 (b'', b'set-upstream', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
249 (b'', b'set-upstream-to', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
250 (b'd', b'delete', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
251 (b'D', b'delete', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
252 (b'm', b'move', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
253 (b'M', b'move', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
254 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
255 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
256
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
257 cmd = Command(b"bookmark")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
258
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
259 if opts.get(b'set_upstream') or opts.get(b'set_upstream_to'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
260 ui.status(_(b"Mercurial has no concept of upstream branches\n"))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
261 return
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
262 elif opts.get(b'delete'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
263 cmd = Command(b"strip")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
264 for branch in args:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
265 cmd[b'-B'] = branch
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
266 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
267 cmd[b'-B'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
268 elif opts.get(b'move'):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
269 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
270 if len(args) > 1:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
271 old = args.pop(0)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
272 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
273 # shell command to output the active bookmark for the active
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
274 # revision
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
275 old = b'`hg log -T"{activebookmark}" -r .`'
38118
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
276 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
277 raise error.Abort(_(b'missing newbranch argument'))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
278 new = args[0]
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
279 cmd[b'-m'] = old
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
280 cmd.append(new)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
281 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
282 if len(args) > 1:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
283 cmd[b'-r'] = args[1]
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
284 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
285 elif len(args) == 1:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
286 cmd.append(args[0])
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
287 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
288
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
289
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
290 def ispath(repo, string):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
291 """
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
292 The first argument to git checkout can either be a revision or a path. Let's
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
293 generally assume it's a revision, unless it's obviously a path. There are
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
294 too many ways to spell revisions in git for us to reasonably catch all of
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
295 them, so let's be conservative.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
296 """
37388
764ada920db5 githelp: use revsymbol() for looking up symbol
Martin von Zweigbergk <martinvonz@google.com>
parents: 37120
diff changeset
297 if scmutil.isrevsymbol(repo, string):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
298 # if it's definitely a revision let's not even check if a file of the
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
299 # same name exists.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
300 return False
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
301
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
302 cwd = repo.getcwd()
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
303 if cwd == b'':
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
304 repopath = string
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
305 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
306 repopath = cwd + b'/' + string
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
307
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
308 exists = repo.wvfs.exists(repopath)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
309 if exists:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
310 return True
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
311
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
312 manifest = repo[b'.'].manifest()
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
313
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
314 didexist = (repopath in manifest) or manifest.hasdir(repopath)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
315
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
316 return didexist
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
317
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
318
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
319 def checkout(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
320 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
321 (b'b', b'branch', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
322 (b'B', b'branch', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
323 (b'f', b'force', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
324 (b'p', b'patch', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
325 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
326 paths = []
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
327 if b'--' in args:
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
328 sepindex = args.index(b'--')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
329 paths.extend(args[sepindex + 1 :])
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
330 args = args[:sepindex]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
331
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
332 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
333
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
334 rev = None
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
335 if args and ispath(repo, args[0]):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
336 paths = args + paths
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
337 elif args:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
338 rev = args[0]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
339 paths = args[1:] + paths
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
340
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
341 cmd = Command(b'update')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
342
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
343 if opts.get(b'force'):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
344 if paths or rev:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
345 cmd[b'-C'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
346
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
347 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
348 cmd = Command(b'revert')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
349 cmd[b'-i'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
350
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
351 if opts.get(b'branch'):
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
352 if len(args) == 0:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
353 cmd = Command(b'bookmark')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
354 cmd.append(opts.get(b'branch'))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
355 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
356 cmd.append(args[0])
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
357 bookcmd = Command(b'bookmark')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
358 bookcmd.append(opts.get(b'branch'))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
359 cmd = cmd & bookcmd
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
360 # if there is any path argument supplied, use revert instead of update
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
361 elif len(paths) > 0:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
362 ui.status(_(b"note: use --no-backup to avoid creating .orig files\n\n"))
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
363 cmd = Command(b'revert')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
364 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
365 cmd[b'-i'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
366 if rev:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
367 cmd[b'-r'] = rev
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
368 cmd.extend(paths)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
369 elif rev:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
370 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
371 cmd[b'-r'] = rev
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
372 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
373 cmd.append(rev)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
374 elif opts.get(b'force'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
375 cmd = Command(b'revert')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
376 cmd[b'--all'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
377 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
378 raise error.Abort(_(b"a commit must be specified"))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
379
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
380 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
381
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
382
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
383 def cherrypick(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
384 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
385 (b'', b'continue', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
386 (b'', b'abort', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
387 (b'e', b'edit', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
388 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
389 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
390
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
391 cmd = Command(b'graft')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
392
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
393 if opts.get(b'edit'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
394 cmd[b'--edit'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
395 if opts.get(b'continue'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
396 cmd[b'--continue'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
397 elif opts.get(b'abort'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
398 ui.status(_(b"note: hg graft does not have --abort\n\n"))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
399 return
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
400 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
401 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
402
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
403 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
404
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
405
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
406 def clean(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
407 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
408 (b'd', b'd', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
409 (b'f', b'force', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
410 (b'x', b'x', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
411 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
412 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
413
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
414 cmd = Command(b'purge')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
415 if opts.get(b'x'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
416 cmd[b'--all'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
417 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
418
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
419 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
420
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
421
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
422 def clone(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
423 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
424 (b'', b'bare', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
425 (b'n', b'no-checkout', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
426 (b'b', b'branch', b'', b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
427 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
428 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
429
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
430 if len(args) == 0:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
431 raise error.Abort(_(b"a repository to clone must be specified"))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
432
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
433 cmd = Command(b'clone')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
434 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
435 if len(args) > 1:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
436 cmd.append(args[1])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
437
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
438 if opts.get(b'bare'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
439 cmd[b'-U'] = None
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
440 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
441 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
442 b"note: Mercurial does not have bare clones. "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
443 b"-U will clone the repo without checking out a commit\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
444 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
445 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
446 elif opts.get(b'no_checkout'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
447 cmd[b'-U'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
448
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
449 if opts.get(b'branch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
450 cocmd = Command(b"update")
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
451 cocmd.append(opts.get(b'branch'))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
452 cmd = cmd & cocmd
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
453
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
454 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
455
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
456
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
457 def commit(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
458 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
459 (b'a', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
460 (b'm', b'message', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
461 (b'p', b'patch', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
462 (b'C', b'reuse-message', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
463 (b'F', b'file', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
464 (b'', b'author', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
465 (b'', b'date', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
466 (b'', b'amend', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
467 (b'', b'no-edit', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
468 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
469 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
470
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
471 cmd = Command(b'commit')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
472 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
473 cmd = Command(b'commit --interactive')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
474
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
475 if opts.get(b'amend'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
476 if opts.get(b'no_edit'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
477 cmd = Command(b'amend')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
478 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
479 cmd[b'--amend'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
480
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
481 if opts.get(b'reuse_message'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
482 cmd[b'-M'] = opts.get(b'reuse_message')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
483
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
484 if opts.get(b'message'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
485 cmd[b'-m'] = b"'%s'" % (opts.get(b'message'),)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
486
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
487 if opts.get(b'all'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
488 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
489 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
490 b"note: Mercurial doesn't have a staging area, "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
491 b"so there is no --all. -A will add and remove files "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
492 b"for you though.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
493 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
494 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
495
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
496 if opts.get(b'file'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
497 cmd[b'-l'] = opts.get(b'file')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
498
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
499 if opts.get(b'author'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
500 cmd[b'-u'] = opts.get(b'author')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
501
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
502 if opts.get(b'date'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
503 cmd[b'-d'] = opts.get(b'date')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
504
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
505 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
506
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
507 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
508
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
509
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
510 def deprecated(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
511 ui.warn(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
512 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
513 b'this command has been deprecated in the git project, '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
514 b'thus isn\'t supported by this tool\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
515 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
516 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
517
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
518
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
519 def diff(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
520 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
521 (b'a', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
522 (b'', b'cached', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
523 (b'R', b'reverse', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
524 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
525 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
526
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
527 cmd = Command(b'diff')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
528
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
529 if opts.get(b'cached'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
530 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
531 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
532 b'note: Mercurial has no concept of a staging area, '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
533 b'so --cached does nothing\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
534 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
535 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
536
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
537 if opts.get(b'reverse'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
538 cmd[b'--reverse'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
539
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
540 for a in list(args):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
541 args.remove(a)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
542 try:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
543 repo.revs(a)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
544 cmd[b'-r'] = a
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
545 except Exception:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
546 cmd.append(a)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
547
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
548 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
549
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
550
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
551 def difftool(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
552 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
553 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
554 b'Mercurial does not enable external difftool by default. You '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
555 b'need to enable the extdiff extension in your .hgrc file by adding\n'
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
556 b'extdiff =\n'
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
557 b'to the [extensions] section and then running\n\n'
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
558 b'hg extdiff -p <program>\n\n'
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
559 b'See \'hg help extdiff\' and \'hg help -e extdiff\' for more '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
560 b'information.\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
561 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
562 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
563
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
564
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
565 def fetch(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
566 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
567 (b'', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
568 (b'f', b'force', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
569 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
570 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
571
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
572 cmd = Command(b'pull')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
573
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
574 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
575 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
576 if len(args) > 1:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
577 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
578 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
579 b"note: Mercurial doesn't have refspecs. "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
580 b"-r can be used to specify which commits you want to "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
581 b"pull. -B can be used to specify which bookmark you "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
582 b"want to pull.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
583 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
584 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
585 for v in args[1:]:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
586 if v in repo._bookmarks:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
587 cmd[b'-B'] = v
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
588 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
589 cmd[b'-r'] = v
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
590
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
591 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
592
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
593
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
594 def grep(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
595 cmdoptions = []
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
596 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
597
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
598 cmd = Command(b'grep')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
599
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
600 # For basic usage, git grep and hg grep are the same. They both have the
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
601 # pattern first, followed by paths.
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
602 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
603
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
604 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
605
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
606
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
607 def init(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
608 cmdoptions = []
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
609 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
610
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
611 cmd = Command(b'init')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
612
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
613 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
614 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
615
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
616 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
617
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
618
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
619 def log(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
620 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
621 (b'', b'follow', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
622 (b'', b'decorate', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
623 (b'n', b'number', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
624 (b'1', b'1', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
625 (b'', b'pretty', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
626 (b'', b'format', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
627 (b'', b'oneline', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
628 (b'', b'stat', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
629 (b'', b'graph', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
630 (b'p', b'patch', None, b''),
44883
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
631 (b'G', b'grep-diff', b'', b''),
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
632 (b'S', b'pickaxe-regex', b'', b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
633 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
634 args, opts = parseoptions(ui, cmdoptions, args)
44883
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
635 grep_pat = opts.get(b'grep_diff') or opts.get(b'pickaxe_regex')
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
636 if grep_pat:
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
637 cmd = Command(b'grep')
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
638 cmd[b'--diff'] = grep_pat
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
639 ui.status(b'%s\n' % bytes(cmd))
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
640 return
94f227baa76f githelp: add some minimal help for pickaxe functionality
Augie Fackler <augie@google.com>
parents: 43973
diff changeset
641
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
642 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
643 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
644 b'note: -v prints the entire commit message like Git does. To '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
645 b'print just the first line, drop the -v.\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
646 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
647 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
648 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
649 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
650 b"note: see hg help revset for information on how to filter "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
651 b"log output\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
652 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
653 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
654
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
655 cmd = Command(b'log')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
656 cmd[b'-v'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
657
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
658 if opts.get(b'number'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
659 cmd[b'-l'] = opts.get(b'number')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
660 if opts.get(b'1'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
661 cmd[b'-l'] = b'1'
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
662 if opts.get(b'stat'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
663 cmd[b'--stat'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
664 if opts.get(b'graph'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
665 cmd[b'-G'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
666 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
667 cmd[b'-p'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
668
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
669 if opts.get(b'pretty') or opts.get(b'format') or opts.get(b'oneline'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
670 format = opts.get(b'format', b'')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
671 if b'format:' in format:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
672 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
673 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
674 b"note: --format format:??? equates to Mercurial's "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
675 b"--template. See hg help templates for more info.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
676 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
677 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
678 cmd[b'--template'] = b'???'
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
679 else:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
680 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
681 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
682 b"note: --pretty/format/oneline equate to Mercurial's "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
683 b"--style or --template. See hg help templates for "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
684 b"more info.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
685 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
686 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
687 cmd[b'--style'] = b'???'
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
688
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
689 if len(args) > 0:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
690 if b'..' in args[0]:
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
691 since, until = args[0].split(b'..')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
692 cmd[b'-r'] = b"'%s::%s'" % (since, until)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
693 del args[0]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
694 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
695
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
696 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
697
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
698
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
699 def lsfiles(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
700 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
701 (b'c', b'cached', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
702 (b'd', b'deleted', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
703 (b'm', b'modified', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
704 (b'o', b'others', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
705 (b'i', b'ignored', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
706 (b's', b'stage', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
707 (b'z', b'_zero', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
708 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
709 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
710
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
711 if (
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
712 opts.get(b'modified')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
713 or opts.get(b'deleted')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
714 or opts.get(b'others')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
715 or opts.get(b'ignored')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
716 ):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
717 cmd = Command(b'status')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
718 if opts.get(b'deleted'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
719 cmd[b'-d'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
720 if opts.get(b'modified'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
721 cmd[b'-m'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
722 if opts.get(b'others'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
723 cmd[b'-o'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
724 if opts.get(b'ignored'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
725 cmd[b'-i'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
726 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
727 cmd = Command(b'files')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
728 if opts.get(b'stage'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
729 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
730 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
731 b"note: Mercurial doesn't have a staging area, ignoring "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
732 b"--stage\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
733 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
734 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
735 if opts.get(b'_zero'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
736 cmd[b'-0'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
737 cmd.append(b'.')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
738 for include in args:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
739 cmd[b'-I'] = procutil.shellquote(include)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
740
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
741 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
742
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
743
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
744 def merge(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
745 cmdoptions = []
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
746 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
747
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
748 cmd = Command(b'merge')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
749
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
750 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
751 cmd.append(args[len(args) - 1])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
752
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
753 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
754
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
755
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
756 def mergebase(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
757 cmdoptions = []
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
758 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
759
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
760 if len(args) != 2:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
761 args = [b'A', b'B']
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
762
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
763 cmd = Command(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
764 b"log -T '{node}\\n' -r 'ancestor(%s,%s)'" % (args[0], args[1])
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
765 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
766
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
767 ui.status(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
768 _(b'note: ancestors() is part of the revset language\n'),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
769 _(b"(learn more about revsets with 'hg help revsets')\n\n"),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
770 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
771 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
772
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
773
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
774 def mergetool(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
775 cmdoptions = []
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
776 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
777
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
778 cmd = Command(b"resolve")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
779
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
780 if len(args) == 0:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
781 cmd[b'--all'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
782 cmd.extend(args)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
783 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
784
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
785
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
786 def mv(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
787 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
788 (b'f', b'force', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
789 (b'n', b'dry-run', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
790 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
791 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
792
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
793 cmd = Command(b'mv')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
794 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
795
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
796 if opts.get(b'force'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
797 cmd[b'-f'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
798 if opts.get(b'dry_run'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
799 cmd[b'-n'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
800
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
801 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
802
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
803
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
804 def pull(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
805 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
806 (b'', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
807 (b'f', b'force', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
808 (b'r', b'rebase', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
809 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
810 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
811
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
812 cmd = Command(b'pull')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
813 cmd[b'--rebase'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
814
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
815 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
816 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
817 if len(args) > 1:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
818 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
819 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
820 b"note: Mercurial doesn't have refspecs. "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
821 b"-r can be used to specify which commits you want to "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
822 b"pull. -B can be used to specify which bookmark you "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
823 b"want to pull.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
824 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
825 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
826 for v in args[1:]:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
827 if v in repo._bookmarks:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
828 cmd[b'-B'] = v
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
829 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
830 cmd[b'-r'] = v
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
831
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
832 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
833
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
834
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
835 def push(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
836 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
837 (b'', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
838 (b'f', b'force', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
839 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
840 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
841
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
842 cmd = Command(b'push')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
843
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
844 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
845 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
846 if len(args) > 1:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
847 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
848 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
849 b"note: Mercurial doesn't have refspecs. "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
850 b"-r can be used to specify which commits you want "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
851 b"to push. -B can be used to specify which bookmark "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
852 b"you want to push.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
853 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
854 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
855 for v in args[1:]:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
856 if v in repo._bookmarks:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
857 cmd[b'-B'] = v
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
858 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
859 cmd[b'-r'] = v
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
860
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
861 if opts.get(b'force'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
862 cmd[b'-f'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
863
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
864 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
865
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
866
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
867 def rebase(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
868 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
869 (b'', b'all', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
870 (b'i', b'interactive', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
871 (b'', b'onto', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
872 (b'', b'abort', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
873 (b'', b'continue', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
874 (b'', b'skip', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
875 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
876 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
877
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
878 if opts.get(b'interactive'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
879 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
880 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
881 b"note: hg histedit does not perform a rebase. "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
882 b"It just edits history.\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
883 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
884 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
885 cmd = Command(b'histedit')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
886 if len(args) > 0:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
887 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
888 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
889 b"also note: 'hg histedit' will automatically detect"
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
890 b" your stack, so no second argument is necessary\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
891 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
892 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
893 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
894 return
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
895
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
896 if opts.get(b'skip'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
897 cmd = Command(b'revert --all -r .')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
898 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
899
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
900 cmd = Command(b'rebase')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
901
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
902 if opts.get(b'continue') or opts.get(b'skip'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
903 cmd[b'--continue'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
904 if opts.get(b'abort'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
905 cmd[b'--abort'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
906
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
907 if opts.get(b'onto'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
908 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
909 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
910 b"note: if you're trying to lift a commit off one branch, "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
911 b"try hg rebase -d <destination commit> -s <commit to be "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
912 b"lifted>\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
913 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
914 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
915 cmd[b'-d'] = convert(opts.get(b'onto'))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
916 if len(args) < 2:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
917 raise error.Abort(_(b"expected format: git rebase --onto X Y Z"))
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
918 cmd[b'-s'] = b"'::%s - ::%s'" % (convert(args[1]), convert(args[0]))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
919 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
920 if len(args) == 1:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
921 cmd[b'-d'] = convert(args[0])
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
922 elif len(args) == 2:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
923 cmd[b'-d'] = convert(args[0])
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
924 cmd[b'-b'] = convert(args[1])
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
925
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
926 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
927
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
928
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
929 def reflog(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
930 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
931 (b'', b'all', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
932 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
933 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
934
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
935 cmd = Command(b'journal')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
936 if opts.get(b'all'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
937 cmd[b'--all'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
938 if len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
939 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
940
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
941 ui.status(bytes(cmd), b"\n\n")
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
942 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
943 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
944 b"note: in hg commits can be deleted from repo but we always"
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
945 b" have backups\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
946 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
947 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
948
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
949
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
950 def reset(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
951 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
952 (b'', b'soft', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
953 (b'', b'hard', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
954 (b'', b'mixed', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
955 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
956 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
957
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
958 commit = convert(args[0] if len(args) > 0 else b'.')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
959 hard = opts.get(b'hard')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
960
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
961 if opts.get(b'mixed'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
962 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
963 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
964 b'note: --mixed has no meaning since Mercurial has no '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
965 b'staging area\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
966 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
967 )
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
968 if opts.get(b'soft'):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
969 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
970 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
971 b'note: --soft has no meaning since Mercurial has no '
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
972 b'staging area\n\n'
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
973 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
974 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
975
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
976 cmd = Command(b'update')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
977 if hard:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
978 cmd.append(b'--clean')
35720
b3cf58487731 githelp: improve help for "reset"
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35719
diff changeset
979
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
980 cmd.append(commit)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
981
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
982 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
983
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
984
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
985 def revert(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
986 cmdoptions = []
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
987 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
988
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
989 if len(args) > 1:
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
990 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
991 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
992 b"note: hg backout doesn't support multiple commits at "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
993 b"once\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
994 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
995 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
996
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
997 cmd = Command(b'backout')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
998 if args:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
999 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1000
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1001 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1002
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1003
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1004 def revparse(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1005 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1006 (b'', b'show-cdup', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1007 (b'', b'show-toplevel', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1008 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1009 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1010
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1011 if opts.get(b'show_cdup') or opts.get(b'show_toplevel'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1012 cmd = Command(b'root')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1013 if opts.get(b'show_cdup'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1014 ui.status(_(b"note: hg root prints the root of the repository\n\n"))
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1015 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1016 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1017 ui.status(_(b"note: see hg help revset for how to refer to commits\n"))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1018
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1019
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1020 def rm(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1021 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1022 (b'f', b'force', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1023 (b'n', b'dry-run', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1024 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1025 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1026
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1027 cmd = Command(b'rm')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1028 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1029
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1030 if opts.get(b'force'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1031 cmd[b'-f'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1032 if opts.get(b'dry_run'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1033 cmd[b'-n'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1034
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1035 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1036
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1037
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1038 def show(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1039 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1040 (b'', b'name-status', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1041 (b'', b'pretty', b'', b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1042 (b'U', b'unified', int, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1043 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1044 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1045
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1046 if opts.get(b'name_status'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1047 if opts.get(b'pretty') == b'format:':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1048 cmd = Command(b'status')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1049 cmd[b'--change'] = b'.'
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1050 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1051 cmd = Command(b'log')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1052 cmd.append(b'--style status')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1053 cmd.append(b'-r .')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1054 elif len(args) > 0:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1055 if ispath(repo, args[0]):
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1056 cmd = Command(b'cat')
35721
f50067fbeead githelp: don't reference 3rd party commands for `git show`
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35720
diff changeset
1057 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1058 cmd = Command(b'export')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1059 cmd.extend(args)
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1060 if opts.get(b'unified'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1061 cmd.append(b'--config diff.unified=%d' % (opts[b'unified'],))
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1062 elif opts.get(b'unified'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1063 cmd = Command(b'export')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1064 cmd.append(b'--config diff.unified=%d' % (opts[b'unified'],))
35721
f50067fbeead githelp: don't reference 3rd party commands for `git show`
Gregory Szorc <gregory.szorc@gmail.com>
parents: 35720
diff changeset
1065 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1066 cmd = Command(b'export')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1067
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1068 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1069
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1070
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1071 def stash(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1072 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1073 (b'p', b'patch', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1074 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1075 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1076
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1077 cmd = Command(b'shelve')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1078 action = args[0] if len(args) > 0 else None
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1079
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1080 if action == b'list':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1081 cmd[b'-l'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1082 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1083 cmd[b'-p'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1084 elif action == b'show':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1085 if opts.get(b'patch'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1086 cmd[b'-p'] = None
42397
7752cd3a2f83 githelp: translate git stash show and clear actions and --patch flag
Anton Shestakov <av6@dwimlabs.net>
parents: 42396
diff changeset
1087 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1088 cmd[b'--stat'] = None
42397
7752cd3a2f83 githelp: translate git stash show and clear actions and --patch flag
Anton Shestakov <av6@dwimlabs.net>
parents: 42396
diff changeset
1089 if len(args) > 1:
7752cd3a2f83 githelp: translate git stash show and clear actions and --patch flag
Anton Shestakov <av6@dwimlabs.net>
parents: 42396
diff changeset
1090 cmd.append(args[1])
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1091 elif action == b'clear':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1092 cmd[b'--cleanup'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1093 elif action == b'drop':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1094 cmd[b'-d'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1095 if len(args) > 1:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1096 cmd.append(args[1])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1097 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1098 cmd.append(b'<shelve name>')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1099 elif action == b'pop' or action == b'apply':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1100 cmd = Command(b'unshelve')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1101 if len(args) > 1:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1102 cmd.append(args[1])
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1103 if action == b'apply':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1104 cmd[b'--keep'] = None
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1105 elif action == b'branch' or action == b'create':
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1106 ui.status(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1107 _(
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1108 b"note: Mercurial doesn't have equivalents to the "
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1109 b"git stash branch or create actions\n\n"
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1110 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1111 )
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1112 return
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1113 else:
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1114 if len(args) > 0:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1115 if args[0] != b'save':
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1116 cmd[b'--name'] = args[0]
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1117 elif len(args) > 1:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1118 cmd[b'--name'] = args[1]
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1119
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1120 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1121
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1122
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1123 def status(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1124 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1125 (b'', b'ignored', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1126 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1127 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1128
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1129 cmd = Command(b'status')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1130 cmd.extend(args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1131
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1132 if opts.get(b'ignored'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1133 cmd[b'-i'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1134
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1135 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1136
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1137
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1138 def svn(ui, repo, *args, **kwargs):
38118
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
1139 if not args:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1140 raise error.Abort(_(b'missing svn command'))
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1141 svncmd = args[0]
38121
10befe8e8b59 githelp: rewrite a Yoda conditional
Matt Harbison <matt_harbison@yahoo.com>
parents: 38120
diff changeset
1142 if svncmd not in gitsvncommands:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1143 raise error.Abort(_(b'unknown git svn command "%s"') % svncmd)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1144
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1145 args = args[1:]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1146 return gitsvncommands[svncmd](ui, repo, *args, **kwargs)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1147
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1148
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1149 def svndcommit(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1150 cmdoptions = []
43973
ca5bd34c597b githelp: drop unused variable assignments
Matt Harbison <matt_harbison@yahoo.com>
parents: 43793
diff changeset
1151 parseoptions(ui, cmdoptions, args)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1152
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1153 cmd = Command(b'push')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1154
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1155 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1156
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1157
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1158 def svnfetch(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1159 cmdoptions = []
43973
ca5bd34c597b githelp: drop unused variable assignments
Matt Harbison <matt_harbison@yahoo.com>
parents: 43793
diff changeset
1160 parseoptions(ui, cmdoptions, args)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1161
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1162 cmd = Command(b'pull')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1163 cmd.append(b'default-push')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1164
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1165 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1166
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1167
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1168 def svnfindrev(ui, repo, *args, **kwargs):
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1169 cmdoptions = []
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1170 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1171
38118
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
1172 if not args:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1173 raise error.Abort(_(b'missing find-rev argument'))
38118
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
1174
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1175 cmd = Command(b'log')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1176 cmd[b'-r'] = args[0]
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1177
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1178 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1179
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1180
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1181 def svnrebase(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1182 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1183 (b'l', b'local', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1184 ]
43973
ca5bd34c597b githelp: drop unused variable assignments
Matt Harbison <matt_harbison@yahoo.com>
parents: 43793
diff changeset
1185 parseoptions(ui, cmdoptions, args)
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1186
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1187 pullcmd = Command(b'pull')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1188 pullcmd.append(b'default-push')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1189 rebasecmd = Command(b'rebase')
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1190 rebasecmd.append(b'tip')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1191
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1192 cmd = pullcmd & rebasecmd
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1193
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1194 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1195
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1196
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1197 def tag(ui, repo, *args, **kwargs):
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1198 cmdoptions = [
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1199 (b'f', b'force', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1200 (b'l', b'list', None, b''),
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1201 (b'd', b'delete', None, b''),
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1202 ]
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1203 args, opts = parseoptions(ui, cmdoptions, args)
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1204
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1205 if opts.get(b'list'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1206 cmd = Command(b'tags')
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1207 else:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1208 cmd = Command(b'tag')
38118
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
1209
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
1210 if not args:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1211 raise error.Abort(_(b'missing tag argument'))
38118
d8bd6a9c64a5 githelp: fail gracefully in a couple cases where arguments are missing
Matt Harbison <matt_harbison@yahoo.com>
parents: 37388
diff changeset
1212
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1213 cmd.append(args[0])
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1214 if len(args) > 1:
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1215 cmd[b'-r'] = args[1]
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1216
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1217 if opts.get(b'delete'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1218 cmd[b'--remove'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1219
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1220 if opts.get(b'force'):
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1221 cmd[b'-f'] = None
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1222
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1223 ui.status((bytes(cmd)), b"\n")
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1224
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 42397
diff changeset
1225
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1226 gitcommands = {
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1227 b'add': add,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1228 b'am': am,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1229 b'apply': apply,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1230 b'bisect': bisect,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1231 b'blame': blame,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1232 b'branch': branch,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1233 b'checkout': checkout,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1234 b'cherry-pick': cherrypick,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1235 b'clean': clean,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1236 b'clone': clone,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1237 b'commit': commit,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1238 b'diff': diff,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1239 b'difftool': difftool,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1240 b'fetch': fetch,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1241 b'grep': grep,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1242 b'init': init,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1243 b'log': log,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1244 b'ls-files': lsfiles,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1245 b'merge': merge,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1246 b'merge-base': mergebase,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1247 b'mergetool': mergetool,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1248 b'mv': mv,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1249 b'pull': pull,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1250 b'push': push,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1251 b'rebase': rebase,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1252 b'reflog': reflog,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1253 b'reset': reset,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1254 b'revert': revert,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1255 b'rev-parse': revparse,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1256 b'rm': rm,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1257 b'show': show,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1258 b'stash': stash,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1259 b'status': status,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1260 b'svn': svn,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1261 b'tag': tag,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1262 b'whatchanged': deprecated,
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1263 }
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1264
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1265 gitsvncommands = {
43077
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1266 b'dcommit': svndcommit,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1267 b'fetch': svnfetch,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1268 b'find-rev': svnfindrev,
687b865b95ad formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents: 43076
diff changeset
1269 b'rebase': svnrebase,
35714
113281667205 githelp: vendor Facebook authored extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1270 }