Mercurial > python-hglib
annotate hglib/client.py @ 132:9ecb271600fc
client: fix passing multiple config settings
author | Julien Cristau <julien.cristau@logilab.fr> |
---|---|
date | Tue, 30 Sep 2014 12:00:34 +0200 |
parents | 53387d1e620b |
children | b6f601ba7f3c |
rev | line source |
---|---|
99
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
1 import subprocess, os, struct, cStringIO, re, datetime |
95
bd23bc72e662
client: add a convenience method __getitem__ to return a changectx
Idan Kamara <idankk86@gmail.com>
parents:
91
diff
changeset
|
2 import hglib, error, util, templates, merge, context |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 |
4 | 4 from util import cmdbuilder |
5 | |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
6 class revision(tuple): |
99
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
7 def __new__(cls, rev, node, tags, branch, author, desc, date): |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
8 return tuple.__new__(cls, (rev, node, tags, branch, author, desc, date)) |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
9 |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
10 @property |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
11 def rev(self): |
98 | 12 return self[0] |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
13 |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
14 @property |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
15 def node(self): |
98 | 16 return self[1] |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
17 |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
18 @property |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
19 def tags(self): |
98 | 20 return self[2] |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
21 |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
22 @property |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
23 def branch(self): |
98 | 24 return self[3] |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
25 |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
26 @property |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
27 def author(self): |
98 | 28 return self[4] |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
29 |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
30 @property |
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
31 def desc(self): |
98 | 32 return self[5] |
90
b894c2222dff
client: replace usage of namedtuple for python 2.4 compatibility
Idan Kamara <idankk86@gmail.com>
parents:
89
diff
changeset
|
33 |
99
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
34 @property |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
35 def date(self): |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
36 return self[6] |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
37 |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
38 class hgclient(object): |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
39 inputfmt = '>I' |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
40 outputfmt = '>cI' |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
41 outputfmtsize = struct.calcsize(outputfmt) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
42 retfmt = '>i' |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
43 |
91
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
44 def __init__(self, path, encoding, configs, connect=True): |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
45 self._args = [hglib.HGPATH, 'serve', '--cmdserver', 'pipe', |
44
3a661f63107e
client: tell the server we're interactive
Idan Kamara <idankk86@gmail.com>
parents:
43
diff
changeset
|
46 '--config', 'ui.interactive=True'] |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
47 if path: |
91
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
48 self._args += ['-R', path] |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
49 if configs: |
132
9ecb271600fc
client: fix passing multiple config settings
Julien Cristau <julien.cristau@logilab.fr>
parents:
127
diff
changeset
|
50 for config in configs: |
9ecb271600fc
client: fix passing multiple config settings
Julien Cristau <julien.cristau@logilab.fr>
parents:
127
diff
changeset
|
51 self._args += ['--config', config] |
105
86ff8611a8fa
client: always set HGPLAIN=1 (issue3502)
Siddharth Agarwal <sid0@fb.com>
parents:
100
diff
changeset
|
52 self._env = {'HGPLAIN': '1'} |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
53 if encoding: |
91
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
54 self._env['HGENCODING'] = encoding |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
55 |
91
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
56 self.server = None |
41
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
57 self._version = None |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
58 #include the hidden changesets if True |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
59 self.hidden = None |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
60 |
91
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
61 if connect: |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
62 self.open() |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
63 |
89
351d2799f145
client: added context manager protocol methods
Jeff Laughlin <jmlaughlin@integrated-informatics.com>
parents:
87
diff
changeset
|
64 def __enter__(self): |
127
53387d1e620b
client: connect to repo if necessary when using "with" statement
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
125
diff
changeset
|
65 if self.server is None: |
53387d1e620b
client: connect to repo if necessary when using "with" statement
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
125
diff
changeset
|
66 self.open() |
89
351d2799f145
client: added context manager protocol methods
Jeff Laughlin <jmlaughlin@integrated-informatics.com>
parents:
87
diff
changeset
|
67 return self |
351d2799f145
client: added context manager protocol methods
Jeff Laughlin <jmlaughlin@integrated-informatics.com>
parents:
87
diff
changeset
|
68 |
351d2799f145
client: added context manager protocol methods
Jeff Laughlin <jmlaughlin@integrated-informatics.com>
parents:
87
diff
changeset
|
69 def __exit__(self, exc_type, exc_val, exc_tb): |
351d2799f145
client: added context manager protocol methods
Jeff Laughlin <jmlaughlin@integrated-informatics.com>
parents:
87
diff
changeset
|
70 self.close() |
351d2799f145
client: added context manager protocol methods
Jeff Laughlin <jmlaughlin@integrated-informatics.com>
parents:
87
diff
changeset
|
71 |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
72 def _readhello(self): |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
73 """ read the hello message the server sends when started """ |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
74 ch, msg = self._readchannel() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
75 assert ch == 'o' |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
76 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
77 msg = msg.split('\n') |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
78 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
79 self.capabilities = msg[0][len('capabilities: '):] |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
80 if not self.capabilities: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
81 raise error.ResponseError("bad hello message: expected 'capabilities: '" |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
82 ", got %r" % msg[0]) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
83 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
84 self.capabilities = set(self.capabilities.split()) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
85 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
86 # at the very least the server should be able to run commands |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
87 assert 'runcommand' in self.capabilities |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
88 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
89 self._encoding = msg[1][len('encoding: '):] |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
90 if not self._encoding: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
91 raise error.ResponseError("bad hello message: expected 'encoding: '" |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
92 ", got %r" % msg[1]) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
93 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
94 def _readchannel(self): |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
95 data = self.server.stdout.read(hgclient.outputfmtsize) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
96 if not data: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
97 raise error.ServerError() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
98 channel, length = struct.unpack(hgclient.outputfmt, data) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
99 if channel in 'IL': |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
100 return channel, length |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
101 else: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
102 return channel, self.server.stdout.read(length) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
103 |
100
dd63d69a5ebf
client: make _parserevs a static method
Idan Kamara <idankk86@gmail.com>
parents:
99
diff
changeset
|
104 @staticmethod |
dd63d69a5ebf
client: make _parserevs a static method
Idan Kamara <idankk86@gmail.com>
parents:
99
diff
changeset
|
105 def _parserevs(splitted): |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
106 ''' splitted is a list of fields according to our rev.style, where each 6 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
107 fields compose one revision. ''' |
99
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
108 revs = [] |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
109 for rev in util.grouper(7, splitted): |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
110 # truncate the timezone and convert to a local datetime |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
111 posixtime = float(rev[6].split('.', 1)[0]) |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
112 dt = datetime.datetime.fromtimestamp(posixtime) |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
113 revs.append(revision(rev[0], rev[1], rev[2], rev[3], rev[4], rev[5], dt)) |
2b36619ec0a0
client: add date field to revision
Idan Kamara <idankk86@gmail.com>
parents:
98
diff
changeset
|
114 return revs |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
115 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
116 def runcommand(self, args, inchannels, outchannels): |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
117 def writeblock(data): |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
118 self.server.stdin.write(struct.pack(self.inputfmt, len(data))) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
119 self.server.stdin.write(data) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
120 self.server.stdin.flush() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
121 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
122 if not self.server: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
123 raise ValueError("server not connected") |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
124 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
125 self.server.stdin.write('runcommand\n') |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
126 writeblock('\0'.join(args)) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
127 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
128 while True: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
129 channel, data = self._readchannel() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
130 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
131 # input channels |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
132 if channel in inchannels: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
133 writeblock(inchannels[channel](data)) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
134 # output channels |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
135 elif channel in outchannels: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
136 outchannels[channel](data) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
137 # result channel, command finished |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
138 elif channel == 'r': |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
139 return struct.unpack(hgclient.retfmt, data)[0] |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
140 # a channel that we don't know and can't ignore |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
141 elif channel.isupper(): |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
142 raise error.ResponseError("unexpected data on required channel '%s'" |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
143 % channel) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
144 # optional channel |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
145 else: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
146 pass |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
147 |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
148 def rawcommand(self, args, eh=None, prompt=None, input=None): |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
149 """ |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
150 args is the cmdline (usually built using util.cmdbuilder) |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
151 |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
152 eh is an error handler that is passed the return code, stdout and stderr |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
153 If no eh is given, we raise a CommandError if ret != 0 |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
154 |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
155 prompt is used to reply to prompts by the server |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
156 It receives the max number of bytes to return and the contents of stdout |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
157 received so far |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
158 |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
159 input is used to reply to bulk data requests by the server |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
160 It receives the max number of bytes to return |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
161 """ |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
162 |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
163 out, err = cStringIO.StringIO(), cStringIO.StringIO() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
164 outchannels = {'o' : out.write, 'e' : err.write} |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
165 |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
166 inchannels = {} |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
167 if prompt is not None: |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
168 def func(size): |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
169 reply = prompt(size, out.getvalue()) |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
170 return str(reply) |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
171 inchannels['L'] = func |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
172 if input is not None: |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
173 inchannels['I'] = input |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
174 |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
175 ret = self.runcommand(args, inchannels, outchannels) |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
176 out, err = out.getvalue(), err.getvalue() |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
177 |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
178 if ret: |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
179 if eh is None: |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
180 raise error.CommandError(args, ret, out, err) |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
181 else: |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
182 return eh(ret, out, err) |
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
183 return out |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
184 |
91
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
185 def open(self): |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
186 if self.server is not None: |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
187 raise ValueError('server already open') |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
188 |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
189 self.server = util.popen(self._args, self._env) |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
190 self._readhello() |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
191 return self |
0383fc37102b
client: refactor opening of the cmd server to an open method
Idan Kamara <idankk86@gmail.com>
parents:
90
diff
changeset
|
192 |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
193 def close(self): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
194 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
195 Closes the command server instance and waits for it to exit, returns the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
196 exit code. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
197 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
198 Attempting to call any function afterwards that needs to communicate with |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
199 the server will raise a ValueError. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
200 """ |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
201 self.server.stdin.close() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
202 self.server.wait() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
203 ret = self.server.returncode |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
204 self.server = None |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
205 return ret |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
206 |
28 | 207 def add(self, files=[], dryrun=False, subrepos=False, include=None, |
208 exclude=None): | |
209 """ | |
210 Add the specified files on the next commit. | |
211 If no files are given, add all files to the repository. | |
212 | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
213 dryrun - do no perform actions |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
214 subrepos - recurse into subrepositories |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
215 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
216 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
217 |
28 | 218 Return whether all given files were added. |
219 """ | |
220 if not isinstance(files, list): | |
221 files = [files] | |
222 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
223 args = cmdbuilder('add', n=dryrun, S=subrepos, I=include, X=exclude, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
224 *files) |
28 | 225 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
226 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
227 self.rawcommand(args, eh=eh) |
28 | 228 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
229 return bool(eh) |
28 | 230 |
48
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
231 def addremove(self, files=[], similarity=None, dryrun=False, include=None, |
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
232 exclude=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
233 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
234 Add all new files and remove all missing files from the repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
235 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
236 New files are ignored if they match any of the patterns in ".hgignore". As |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
237 with add, these changes take effect at the next commit. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
238 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
239 similarity - used to detect renamed files. With a parameter |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
240 greater than 0, this compares every removed file with every added file and |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
241 records those similar enough as renames. This option takes a percentage |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
242 between 0 (disabled) and 100 (files must be identical) as its parameter. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
243 Detecting renamed files this way can be expensive. After using this |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
244 option, "hg status -C" can be used to check which files were identified as |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
245 moved or renamed. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
246 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
247 dryrun - do no perform actions |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
248 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
249 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
250 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
251 Return True if all files are successfully added. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
252 """ |
48
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
253 if not isinstance(files, list): |
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
254 files = [files] |
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
255 |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
256 args = cmdbuilder('addremove', s=similarity, n=dryrun, I=include, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
257 X=exclude, *files) |
48
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
258 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
259 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
260 self.rawcommand(args, eh=eh) |
48
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
261 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
262 return bool(eh) |
48
82d927ac1329
client: add addremove command
Idan Kamara <idankk86@gmail.com>
parents:
47
diff
changeset
|
263 |
52
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
264 def annotate(self, files, rev=None, nofollow=False, text=False, user=False, |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
265 file=False, date=False, number=False, changeset=False, |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
266 line=False, verbose=False, include=None, exclude=None): |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
267 """ |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
268 Show changeset information by line for each file in files. |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
269 |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
270 rev - annotate the specified revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
271 nofollow - don't follow copies and renames |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
272 text - treat all files as text |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
273 user - list the author (long with -v) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
274 file - list the filename |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
275 date - list the date |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
276 number - list the revision number (default) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
277 changeset - list the changeset |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
278 line - show line number at the first appearance |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
279 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
280 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
281 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
282 Yields a (info, contents) tuple for each line in a file. Info is a space |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
283 separated string according to the given options. |
52
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
284 """ |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
285 if not isinstance(files, list): |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
286 files = [files] |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
287 |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
288 args = cmdbuilder('annotate', r=rev, no_follow=nofollow, a=text, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
289 u=user, f=file, d=date, n=number, c=changeset, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
290 l=line, v=verbose, I=include, X=exclude, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
291 hidden=self.hidden, *files) |
52
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
292 |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
293 out = self.rawcommand(args) |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
294 |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
295 for line in out.splitlines(): |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
296 yield tuple(line.split(': ', 1)) |
18f72b255553
client: add annotate command
Idan Kamara <idankk86@gmail.com>
parents:
51
diff
changeset
|
297 |
53
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
298 def archive(self, dest, rev=None, nodecode=False, prefix=None, type=None, |
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
299 subrepos=False, include=None, exclude=None): |
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
300 """ |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
301 Create an unversioned archive of a repository revision. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
302 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
303 The exact name of the destination archive or directory is given using a |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
304 format string; see export for details. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
305 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
306 Each member added to an archive file has a directory prefix prepended. Use |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
307 prefix to specify a format string for the prefix. The default is the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
308 basename of the archive, with suffixes removed. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
309 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
310 dest - destination path |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
311 rev - revision to distribute. The revision used is the parent of the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
312 working directory if one isn't given. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
313 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
314 nodecode - do not pass files through decoders |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
315 prefix - directory prefix for files in archive |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
316 type - type of distribution to create. The archive type is automatically |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
317 detected based on file extension if one isn't given. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
318 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
319 Valid types are: |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
320 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
321 "files" a directory full of files (default) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
322 "tar" tar archive, uncompressed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
323 "tbz2" tar archive, compressed using bzip2 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
324 "tgz" tar archive, compressed using gzip |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
325 "uzip" zip archive, uncompressed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
326 "zip" zip archive, compressed using deflate |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
327 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
328 subrepos - recurse into subrepositories |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
329 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
330 exclude - exclude names matching the given patterns |
53
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
331 """ |
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
332 args = cmdbuilder('archive', dest, r=rev, no_decode=nodecode, p=prefix, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
333 t=type, S=subrepos, I=include, X=exclude, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
334 hidden=self.hidden) |
53
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
335 |
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
336 self.rawcommand(args) |
066dfa5c0b70
client: add archive command
Idan Kamara <idankk86@gmail.com>
parents:
52
diff
changeset
|
337 |
22
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
338 def backout(self, rev, merge=False, parent=None, tool=None, message=None, |
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
339 logfile=None, date=None, user=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
340 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
341 Prepare a new changeset with the effect of rev undone in the current |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
342 working directory. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
343 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
344 If rev is the parent of the working directory, then this new changeset is |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
345 committed automatically. Otherwise, hg needs to merge the changes and the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
346 merged result is left uncommitted. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
347 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
348 rev - revision to backout |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
349 merge - merge with old dirstate parent after backout |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
350 parent - parent to choose when backing out merge |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
351 tool - specify merge tool |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
352 message - use text as commit message |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
353 logfile - read commit message from file |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
354 date - record the specified date as commit date |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
355 user - record the specified user as committer |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
356 """ |
22
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
357 if message and logfile: |
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
358 raise ValueError("cannot specify both a message and a logfile") |
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
359 |
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
360 args = cmdbuilder('backout', r=rev, merge=merge, parent=parent, t=tool, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
361 m=message, l=logfile, d=date, u=user, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
362 hidden=self.hidden) |
22
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
363 |
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
364 self.rawcommand(args) |
297df22d6091
client: add backout command
Idan Kamara <idankk86@gmail.com>
parents:
21
diff
changeset
|
365 |
23
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
366 def bookmark(self, name, rev=None, force=False, delete=False, inactive=False, |
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
367 rename=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
368 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
369 Set a bookmark on the working directory's parent revision or rev, |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
370 with the given name. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
371 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
372 name - bookmark name |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
373 rev - revision to bookmark |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
374 force - bookmark even if another bookmark with the same name exists |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
375 delete - delete the given bookmark |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
376 inactive - do not mark the new bookmark active |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
377 rename - rename the bookmark given by rename to name |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
378 """ |
23
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
379 args = cmdbuilder('bookmark', name, r=rev, f=force, d=delete, |
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
380 i=inactive, m=rename) |
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
381 |
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
382 self.rawcommand(args) |
223e463c25e0
client: add bookmark command
Idan Kamara <idankk86@gmail.com>
parents:
22
diff
changeset
|
383 |
24
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
384 def bookmarks(self): |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
385 """ |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
386 Return the bookmarks as a list of (name, rev, node) and the index of the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
387 current one. |
24
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
388 |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
389 If there isn't a current one, -1 is returned as the index. |
24
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
390 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
391 args = cmdbuilder('bookmarks', hidden=self.hidden) |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
392 out = self.rawcommand(args) |
24
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
393 |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
394 bms = [] |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
395 current = -1 |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
396 if out.rstrip() != 'no bookmarks set': |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
397 for line in out.splitlines(): |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
398 iscurrent, line = line[0:3], line[3:] |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
399 if '*' in iscurrent: |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
400 current = len(bms) |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
401 name, line = line.split(' ', 1) |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
402 rev, node = line.split(':') |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
403 bms.append((name, int(rev), node)) |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
404 return bms, current |
ca0d7e212cf8
client: add bookmarks command
Idan Kamara <idankk86@gmail.com>
parents:
23
diff
changeset
|
405 |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
406 def branch(self, name=None, clean=False, force=False): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
407 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
408 When name isn't given, return the current branch name. Otherwise set the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
409 working directory branch name (the branch will not exist in the repository |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
410 until the next commit). Standard practice recommends that primary |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
411 development take place on the 'default' branch. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
412 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
413 When clean is True, reset and return the working directory branch to that |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
414 of the parent of the working directory, negating a previous branch change. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
415 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
416 name - new branch name |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
417 clean - reset branch name to parent branch name |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
418 force - set branch name even if it shadows an existing branch |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
419 """ |
11
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
420 if name and clean: |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
421 raise ValueError('cannot use both name and clean') |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
422 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
423 args = cmdbuilder('branch', name, f=force, C=clean) |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
424 out = self.rawcommand(args).rstrip() |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
425 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
426 if name: |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
427 return name |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
428 elif not clean: |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
429 return out |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
430 else: |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
431 # len('reset working directory to branch ') == 34 |
0549d00a617d
client: add missing options to branch()
Idan Kamara <idankk86@gmail.com>
parents:
10
diff
changeset
|
432 return out[34:] |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
433 |
12
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
434 def branches(self, active=False, closed=False): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
435 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
436 Returns the repository's named branches as a list of (name, rev, node). |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
437 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
438 active - show only branches that have unmerged heads |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
439 closed - show normal and closed branches |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
440 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
441 args = cmdbuilder('branches', a=active, c=closed, hidden=self.hidden) |
12
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
442 out = self.rawcommand(args) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
443 |
12
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
444 branches = [] |
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
445 for line in out.rstrip().splitlines(): |
79
ca5f8f43e585
branches: more robust parsing strategy
Matt Mackall <mpm@selenic.com>
parents:
72
diff
changeset
|
446 namerev, node = line.rsplit(':', 1) |
ca5f8f43e585
branches: more robust parsing strategy
Matt Mackall <mpm@selenic.com>
parents:
72
diff
changeset
|
447 name, rev = namerev.rsplit(' ', 1) |
ca5f8f43e585
branches: more robust parsing strategy
Matt Mackall <mpm@selenic.com>
parents:
72
diff
changeset
|
448 name = name.rstrip() |
12
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
449 node = node.split()[0] # get rid of ' (inactive)' |
c2a9b716cd80
client: rewrite branches(), return a list of (branchname, rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
11
diff
changeset
|
450 branches.append((name, int(rev), node)) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
451 return branches |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
452 |
54 | 453 def bundle(self, file, destrepo=None, rev=[], branch=[], base=[], all=False, |
454 force=False, type=None, ssh=None, remotecmd=None, insecure=False): | |
455 """ | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
456 Generate a compressed changegroup file collecting changesets not known to |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
457 be in another repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
458 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
459 If destrepo isn't given, then hg assumes the destination will have all |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
460 the nodes you specify with base. To create a bundle containing all |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
461 changesets, use all (or set base to 'null'). |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
462 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
463 file - destination file name |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
464 destrepo - repository to look for changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
465 rev - a changeset intended to be added to the destination |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
466 branch - a specific branch you would like to bundle |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
467 base - a base changeset assumed to be available at the destination |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
468 all - bundle all changesets in the repository |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
469 type - bundle compression type to use, available compression methods are: |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
470 none, bzip2, and gzip (default: bzip2) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
471 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
472 force - run even when the destrepo is unrelated |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
473 ssh - specify ssh command to use |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
474 remotecmd - specify hg command to run on the remote side |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
475 insecure - do not verify server certificate (ignoring web.cacerts config) |
54 | 476 |
477 Return True if a bundle was created, False if no changes were found. | |
478 """ | |
479 args = cmdbuilder('bundle', file, destrepo, f=force, r=rev, b=branch, | |
480 base=base, a=all, t=type, e=ssh, remotecmd=remotecmd, | |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
481 insecure=insecure, hidden=self.hidden) |
54 | 482 |
483 eh = util.reterrorhandler(args) | |
484 self.rawcommand(args, eh=eh) | |
485 | |
486 return bool(eh) | |
487 | |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
488 def cat(self, files, rev=None, output=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
489 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
490 Return a string containing the specified files as they were at the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
491 given revision. If no revision is given, the parent of the working |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
492 directory is used, or tip if no revision is checked out. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
493 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
494 If output is given, writes the contents to the specified file. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
495 The name of the file is given using a format string. The formatting rules |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
496 are the same as for the export command, with the following additions: |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
497 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
498 "%s" basename of file being printed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
499 "%d" dirname of file being printed, or '.' if in repository root |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
500 "%p" root-relative path name of file being printed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
501 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
502 args = cmdbuilder('cat', r=rev, o=output, hidden=self.hidden, *files) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
503 out = self.rawcommand(args) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
504 |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
505 if not output: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
506 return out |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
507 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
508 def clone(self, source='.', dest=None, branch=None, updaterev=None, |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
509 revrange=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
510 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
511 Create a copy of an existing repository specified by source in a new |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
512 directory dest. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
513 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
514 If dest isn't specified, it defaults to the basename of source. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
515 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
516 branch - clone only the specified branch |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
517 updaterev - revision, tag or branch to check out |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
518 revrange - include the specified changeset |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
519 """ |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
520 args = cmdbuilder('clone', source, dest, b=branch, u=updaterev, r=revrange) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
521 self.rawcommand(args) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
522 |
16
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
523 def commit(self, message=None, logfile=None, addremove=False, closebranch=False, |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
524 date=None, user=None, include=None, exclude=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
525 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
526 Commit changes reported by status into the repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
527 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
528 message - the commit message |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
529 logfile - read commit message from file |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
530 addremove - mark new/missing files as added/removed before committing |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
531 closebranch - mark a branch as closed, hiding it from the branch list |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
532 date - record the specified date as commit date |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
533 user - record the specified user as committer |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
534 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
535 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
536 """ |
16
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
537 if message is None and logfile is None: |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
538 raise ValueError("must provide at least a message or a logfile") |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
539 elif message and logfile: |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
540 raise ValueError("cannot specify both a message and a logfile") |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
541 |
14
e0d21c9db20b
client: use --debug when committing to get the new node info
Idan Kamara <idankk86@gmail.com>
parents:
13
diff
changeset
|
542 # --debug will print the committed cset |
16
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
543 args = cmdbuilder('commit', debug=True, m=message, A=addremove, |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
544 close_branch=closebranch, d=date, u=user, l=logfile, |
943aff89b068
client: add missing options to commit()
Idan Kamara <idankk86@gmail.com>
parents:
15
diff
changeset
|
545 I=include, X=exclude) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
546 |
14
e0d21c9db20b
client: use --debug when committing to get the new node info
Idan Kamara <idankk86@gmail.com>
parents:
13
diff
changeset
|
547 out = self.rawcommand(args) |
e0d21c9db20b
client: use --debug when committing to get the new node info
Idan Kamara <idankk86@gmail.com>
parents:
13
diff
changeset
|
548 rev, node = out.splitlines()[-1].rsplit(':') |
15
f1af31960414
client: change return value of commit() to (rev, node)
Idan Kamara <idankk86@gmail.com>
parents:
14
diff
changeset
|
549 return int(rev.split()[-1]), node |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
550 |
21 | 551 def config(self, names=[], untrusted=False, showsource=False): |
552 """ | |
553 Return a list of (section, key, value) config settings from all hgrc files | |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
554 |
21 | 555 When showsource is specified, return (source, section, key, value) where |
556 source is of the form filename:[line] | |
557 """ | |
558 def splitline(s): | |
559 k, value = s.rstrip().split('=', 1) | |
560 section, key = k.split('.', 1) | |
561 return (section, key, value) | |
562 | |
563 if not isinstance(names, list): | |
564 names = [names] | |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
565 |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
566 args = cmdbuilder('showconfig', u=untrusted, debug=showsource, *names) |
21 | 567 out = self.rawcommand(args) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
568 |
21 | 569 conf = [] |
570 if showsource: | |
571 out = util.skiplines(out, 'read config from: ') | |
572 for line in out.splitlines(): | |
573 m = re.match(r"(.+?:(?:\d+:)?) (.*)", line) | |
574 t = splitline(m.group(2)) | |
575 conf.append((m.group(1)[:-1], t[0], t[1], t[2])) | |
576 else: | |
577 for line in out.splitlines(): | |
578 conf.append(splitline(line)) | |
579 | |
580 return conf | |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
581 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
582 @property |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
583 def encoding(self): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
584 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
585 Return the server's encoding (as reported in the hello message). |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
586 """ |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
587 if not 'getencoding' in self.capabilities: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
588 raise CapabilityError('getencoding') |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
589 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
590 if not self._encoding: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
591 self.server.stdin.write('getencoding\n') |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
592 self._encoding = self._readfromchannel('r') |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
593 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
594 return self._encoding |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
595 |
29 | 596 def copy(self, source, dest, after=False, force=False, dryrun=False, |
597 include=None, exclude=None): | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
598 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
599 Mark dest as having copies of source files. If dest is a directory, copies |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
600 are put in that directory. If dest is a file, then source must be a string. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
601 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
602 Returns True on success, False if errors are encountered. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
603 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
604 source - a file or a list of files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
605 dest - a destination file or directory |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
606 after - record a copy that has already occurred |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
607 force - forcibly copy over an existing managed file |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
608 dryrun - do not perform actions, just print output |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
609 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
610 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
611 """ |
29 | 612 if not isinstance(source, list): |
613 source = [source] | |
614 | |
615 source.append(dest) | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
616 args = cmdbuilder('copy', A=after, f=force, n=dryrun, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
617 I=include, X=exclude, *source) |
29 | 618 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
619 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
620 self.rawcommand(args, eh=eh) |
29 | 621 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
622 return bool(eh) |
29 | 623 |
61
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
624 def diff(self, files=[], revs=[], change=None, text=False, |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
625 git=False, nodates=False, showfunction=False, reverse=False, |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
626 ignoreallspace=False, ignorespacechange=False, ignoreblanklines=False, |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
627 unified=None, stat=False, subrepos=False, include=None, exclude=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
628 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
629 Return differences between revisions for the specified files. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
630 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
631 revs - a revision or a list of two revisions to diff |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
632 change - change made by revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
633 text - treat all files as text |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
634 git - use git extended diff format |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
635 nodates - omit dates from diff headers |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
636 showfunction - show which function each change is in |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
637 reverse - produce a diff that undoes the changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
638 ignoreallspace - ignore white space when comparing lines |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
639 ignorespacechange - ignore changes in the amount of white space |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
640 ignoreblanklines - ignore changes whose lines are all blank |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
641 unified - number of lines of context to show |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
642 stat - output diffstat-style summary of changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
643 subrepos - recurse into subrepositories |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
644 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
645 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
646 """ |
61
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
647 if change and revs: |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
648 raise ValueError('cannot specify both change and rev') |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
649 |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
650 args = cmdbuilder('diff', r=revs, c=change, |
61
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
651 a=text, g=git, nodates=nodates, |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
652 p=showfunction, reverse=reverse, |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
653 w=ignoreallspace, b=ignorespacechange, |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
654 B=ignoreblanklines, U=unified, stat=stat, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
655 S=subrepos, I=include, X=exclude, hidden=self.hidden, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
656 *files) |
61
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
657 |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
658 return self.rawcommand(args) |
d0b9215180a4
client: fix diff indentation and position
Idan Kamara <idankk86@gmail.com>
parents:
57
diff
changeset
|
659 |
55 | 660 def export(self, revs, output=None, switchparent=False, text=False, git=False, |
661 nodates=False): | |
662 """ | |
663 Return the header and diffs for one or more changesets. When output is | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
664 given, dumps to file. The name of the file is given using a format string. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
665 The formatting rules are as follows: |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
666 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
667 "%%" literal "%" character |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
668 "%H" changeset hash (40 hexadecimal digits) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
669 "%N" number of patches being generated |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
670 "%R" changeset revision number |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
671 "%b" basename of the exporting repository |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
672 "%h" short-form changeset hash (12 hexadecimal digits) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
673 "%n" zero-padded sequence number, starting at 1 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
674 "%r" zero-padded changeset revision number |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
675 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
676 output - print output to file with formatted name |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
677 switchparent - diff against the second parent |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
678 rev - a revision or list of revisions to export |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
679 text - treat all files as text |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
680 git - use git extended diff format |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
681 nodates - omit dates from diff headers |
55 | 682 """ |
683 if not isinstance(revs, list): | |
684 revs = [revs] | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
685 args = cmdbuilder('export', o=output, switch_parent=switchparent, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
686 a=text, g=git, nodates=nodates, hidden=self.hidden, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
687 *revs) |
55 | 688 |
689 out = self.rawcommand(args) | |
690 | |
691 if output is None: | |
692 return out | |
693 | |
31 | 694 def forget(self, files, include=None, exclude=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
695 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
696 Mark the specified files so they will no longer be tracked after the next |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
697 commit. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
698 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
699 This only removes files from the current branch, not from the entire |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
700 project history, and it does not delete them from the working directory. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
701 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
702 Returns True on success. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
703 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
704 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
705 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
706 """ |
31 | 707 if not isinstance(files, list): |
708 files = [files] | |
709 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
710 args = cmdbuilder('forget', I=include, X=exclude, *files) |
31 | 711 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
712 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
713 self.rawcommand(args, eh=eh) |
31 | 714 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
715 return bool(eh) |
31 | 716 |
56 | 717 def grep(self, pattern, files=[], all=False, text=False, follow=False, |
718 ignorecase=False, fileswithmatches=False, line=False, user=False, | |
719 date=False, include=None, exclude=None): | |
720 """ | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
721 Search for a pattern in specified files and revisions. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
722 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
723 This behaves differently than Unix grep. It only accepts Python/Perl |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
724 regexps. It searches repository history, not the working directory. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
725 It always prints the revision number in which a match appears. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
726 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
727 Yields (filename, revision, [line, [match status, [user, [date, [match]]]]]) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
728 per match depending on the given options. |
56 | 729 |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
730 all - print all revisions that match |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
731 text - treat all files as text |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
732 follow - follow changeset history, or file history across copies and renames |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
733 ignorecase - ignore case when matching |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
734 fileswithmatches - return only filenames and revisions that match |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
735 line - return line numbers in the result tuple |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
736 user - return the author in the result tuple |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
737 date - return the date in the result tuple |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
738 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
739 exclude - exclude names matching the given patterns |
56 | 740 """ |
741 if not isinstance(files, list): | |
742 files = [files] | |
743 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
744 args = cmdbuilder('grep', all=all, a=text, f=follow, i=ignorecase, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
745 l=fileswithmatches, n=line, u=user, d=date, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
746 I=include, X=exclude, hidden=self.hidden, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
747 *[pattern] + files) |
56 | 748 args.append('-0') |
749 | |
750 def eh(ret, out, err): | |
751 if ret != 1: | |
752 raise error.CommandError(args, ret, out, err) | |
753 return '' | |
754 | |
755 out = self.rawcommand(args, eh=eh).split('\0') | |
756 | |
757 fieldcount = 3 | |
758 if user: | |
759 fieldcount += 1 | |
760 if date: | |
761 fieldcount += 1 | |
762 if line: | |
763 fieldcount += 1 | |
764 if all: | |
765 fieldcount += 1 | |
766 if fileswithmatches: | |
767 fieldcount -= 1 | |
768 | |
769 return util.grouper(fieldcount, out) | |
770 | |
57 | 771 def heads(self, rev=[], startrev=[], topological=False, closed=False): |
772 """ | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
773 Return a list of current repository heads or branch heads. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
774 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
775 rev - return only branch heads on the branches associated with the specified |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
776 changesets. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
777 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
778 startrev - return only heads which are descendants of the given revs. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
779 topological - named branch mechanics will be ignored and only changesets |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
780 without children will be shown. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
781 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
782 closed - normal and closed branch heads. |
57 | 783 """ |
784 if not isinstance(rev, list): | |
785 rev = [rev] | |
786 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
787 args = cmdbuilder('heads', r=startrev, t=topological, c=closed, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
788 template=templates.changeset, hidden=self.hidden, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
789 *rev) |
57 | 790 |
791 def eh(ret, out, err): | |
792 if ret != 1: | |
793 raise error.CommandError(args, ret, out, err) | |
794 return '' | |
795 | |
796 out = self.rawcommand(args, eh=eh).split('\0')[:-1] | |
797 return self._parserevs(out) | |
798 | |
38
32f6a2bbf63e
client: add identify command
Idan Kamara <idankk86@gmail.com>
parents:
37
diff
changeset
|
799 def identify(self, rev=None, source=None, num=False, id=False, branch=False, |
32f6a2bbf63e
client: add identify command
Idan Kamara <idankk86@gmail.com>
parents:
37
diff
changeset
|
800 tags=False, bookmarks=False): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
801 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
802 Return a summary string identifying the repository state at rev using one or |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
803 two parent hash identifiers, followed by a "+" if the working directory has |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
804 uncommitted changes, the branch name (if not default), a list of tags, and |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
805 a list of bookmarks. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
806 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
807 When rev is not given, return a summary string of the current state of the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
808 repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
809 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
810 Specifying source as a repository root or Mercurial bundle will cause |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
811 lookup to operate on that repository/bundle. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
812 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
813 num - show local revision number |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
814 id - show global revision id |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
815 branch - show branch |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
816 tags - show tags |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
817 bookmarks - show bookmarks |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
818 """ |
38
32f6a2bbf63e
client: add identify command
Idan Kamara <idankk86@gmail.com>
parents:
37
diff
changeset
|
819 args = cmdbuilder('identify', source, r=rev, n=num, i=id, b=branch, t=tags, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
820 B=bookmarks, hidden=self.hidden) |
38
32f6a2bbf63e
client: add identify command
Idan Kamara <idankk86@gmail.com>
parents:
37
diff
changeset
|
821 |
32f6a2bbf63e
client: add identify command
Idan Kamara <idankk86@gmail.com>
parents:
37
diff
changeset
|
822 return self.rawcommand(args) |
32f6a2bbf63e
client: add identify command
Idan Kamara <idankk86@gmail.com>
parents:
37
diff
changeset
|
823 |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
824 def import_(self, patches, strip=None, force=False, nocommit=False, |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
825 bypass=False, exact=False, importbranch=False, message=None, |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
826 date=None, user=None, similarity=None): |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
827 """ |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
828 Import the specified patches which can be a list of file names or a |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
829 file-like object and commit them individually (unless nocommit is |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
830 specified). |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
831 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
832 strip - directory strip option for patch. This has the same meaning as the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
833 corresponding patch option (default: 1) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
834 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
835 force - skip check for outstanding uncommitted changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
836 nocommit - don't commit, just update the working directory |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
837 bypass - apply patch without touching the working directory |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
838 exact - apply patch to the nodes from which it was generated |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
839 importbranch - use any branch information in patch (implied by exact) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
840 message - the commit message |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
841 date - record the specified date as commit date |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
842 user - record the specified user as committer |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
843 similarity - guess renamed files by similarity (0<=s<=100) |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
844 """ |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
845 if hasattr(patches, 'read') and hasattr(patches, 'readline'): |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
846 patch = patches |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
847 |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
848 def readline(size, output): |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
849 return patch.readline(size) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
850 |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
851 stdin = True |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
852 patches = () |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
853 prompt = readline |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
854 input = patch.read |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
855 else: |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
856 stdin = False |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
857 prompt = None |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
858 input = None |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
859 |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
860 args = cmdbuilder('import', strip=strip, force=force, |
96
9746227239e0
client: fix import --no-commit flag (issue3206)
Idan Kamara <idankk86@gmail.com>
parents:
95
diff
changeset
|
861 no_commit=nocommit, bypass=bypass, exact=exact, |
97
705e601e6085
client: fix import --import-branch flag
Idan Kamara <idankk86@gmail.com>
parents:
96
diff
changeset
|
862 import_branch=importbranch, message=message, |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
863 date=date, user=user, similarity=similarity, _=stdin, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
864 *patches) |
13
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
865 |
400cb1520834
client: add missing options to import_()
Idan Kamara <idankk86@gmail.com>
parents:
12
diff
changeset
|
866 self.rawcommand(args, prompt=prompt, input=input) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
867 |
25
85ae94b98324
client: add missing options to incoming
Idan Kamara <idankk86@gmail.com>
parents:
24
diff
changeset
|
868 def incoming(self, revrange=None, path=None, force=False, newest=False, |
85ae94b98324
client: add missing options to incoming
Idan Kamara <idankk86@gmail.com>
parents:
24
diff
changeset
|
869 bundle=None, bookmarks=False, branch=None, limit=None, |
85ae94b98324
client: add missing options to incoming
Idan Kamara <idankk86@gmail.com>
parents:
24
diff
changeset
|
870 nomerges=False, subrepos=False): |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
871 """ |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
872 Return new changesets found in the specified path or the default pull |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
873 location. |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
874 |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
875 When bookmarks=True, return a list of (name, node) of incoming bookmarks. |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
876 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
877 revrange - a remote changeset or list of changesets intended to be added |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
878 force - run even if remote repository is unrelated |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
879 newest - show newest record first |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
880 bundle - avoid downloading the changesets twice and store the bundles into |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
881 the specified file. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
882 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
883 bookmarks - compare bookmarks (this changes the return value) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
884 branch - a specific branch you would like to pull |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
885 limit - limit number of changes returned |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
886 nomerges - do not show merges |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
887 ssh - specify ssh command to use |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
888 remotecmd - specify hg command to run on the remote side |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
889 insecure- do not verify server certificate (ignoring web.cacerts config) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
890 subrepos - recurse into subrepositories |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
891 """ |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
892 args = cmdbuilder('incoming', |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
893 path, |
25
85ae94b98324
client: add missing options to incoming
Idan Kamara <idankk86@gmail.com>
parents:
24
diff
changeset
|
894 template=templates.changeset, r=revrange, |
85ae94b98324
client: add missing options to incoming
Idan Kamara <idankk86@gmail.com>
parents:
24
diff
changeset
|
895 f=force, n=newest, bundle=bundle, |
85ae94b98324
client: add missing options to incoming
Idan Kamara <idankk86@gmail.com>
parents:
24
diff
changeset
|
896 B=bookmarks, b=branch, l=limit, M=nomerges, S=subrepos) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
897 |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
898 def eh(ret, out, err): |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
899 if ret != 1: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
900 raise error.CommandError(args, ret, out, err) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
901 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
902 out = self.rawcommand(args, eh=eh) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
903 if not out: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
904 return [] |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
905 |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
906 out = util.eatlines(out, 2) |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
907 if bookmarks: |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
908 bms = [] |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
909 for line in out.splitlines(): |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
910 bms.append(tuple(line.split())) |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
911 return bms |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
912 else: |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
913 out = out.split('\0')[:-1] |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
914 return self._parserevs(out) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
915 |
17
b68c444d42bb
client: add missing options to log()
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
916 def log(self, revrange=None, files=[], follow=False, followfirst=False, |
b68c444d42bb
client: add missing options to log()
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
917 date=None, copies=False, keyword=None, removed=False, onlymerges=False, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
918 user=None, branch=None, prune=None, hidden=None, limit=None, |
17
b68c444d42bb
client: add missing options to log()
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
919 nomerges=False, include=None, exclude=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
920 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
921 Return the revision history of the specified files or the entire project. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
922 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
923 File history is shown without following rename or copy history of files. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
924 Use follow with a filename to follow history across renames and copies. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
925 follow without a filename will only show ancestors or descendants of the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
926 starting revision. followfirst only follows the first parent of merge |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
927 revisions. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
928 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
929 If revrange isn't specified, the default is "tip:0" unless follow is set, |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
930 in which case the working directory parent is used as the starting |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
931 revision. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
932 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
933 The returned changeset is a named tuple with the following string fields: |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
934 - rev |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
935 - node |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
936 - tags (space delimited) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
937 - branch |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
938 - author |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
939 - desc |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
940 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
941 follow - follow changeset history, or file history across copies and renames |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
942 followfirst - only follow the first parent of merge changesets |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
943 date - show revisions matching date spec |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
944 copies - show copied files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
945 keyword - do case-insensitive search for a given text |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
946 removed - include revisions where files were removed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
947 onlymerges - show only merges |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
948 user - revisions committed by user |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
949 branch - show changesets within the given named branch |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
950 prune - do not display revision or any of its ancestors |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
951 hidden - show hidden changesets |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
952 limit - limit number of changes displayed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
953 nomerges - do not show merges |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
954 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
955 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
956 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
957 if hidden is None: |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
958 hidden = self.hidden |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
959 args = cmdbuilder('log', template=templates.changeset, |
17
b68c444d42bb
client: add missing options to log()
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
960 r=revrange, f=follow, follow_first=followfirst, |
b68c444d42bb
client: add missing options to log()
Idan Kamara <idankk86@gmail.com>
parents:
16
diff
changeset
|
961 d=date, C=copies, k=keyword, removed=removed, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
962 m=onlymerges, u=user, b=branch, P=prune, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
963 l=limit, M=nomerges, I=include, X=exclude, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
964 hidden=hidden, *files) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
965 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
966 out = self.rawcommand(args) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
967 out = out.split('\0')[:-1] |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
968 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
969 return self._parserevs(out) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
970 |
64
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
971 def manifest(self, rev=None, all=False): |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
972 """ |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
973 Yields (nodeid, permission, executable, symlink, file path) tuples for |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
974 version controlled files for the given revision. If no revision is given, |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
975 the first parent of the working directory is used, or the null revision if |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
976 no revision is checked out. |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
977 |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
978 When all is True, all files from all revisions are yielded (just the name). |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
979 This includes deleted and renamed files. |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
980 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
981 args = cmdbuilder('manifest', r=rev, all=all, debug=True, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
982 hidden=self.hidden) |
64
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
983 |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
984 out = self.rawcommand(args) |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
985 |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
986 if all: |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
987 for line in out.splitlines(): |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
988 yield line |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
989 else: |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
990 for line in out.splitlines(): |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
991 node = line[0:40] |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
992 perm = line[41:44] |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
993 symlink = line[45] == '@' |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
994 executable = line[45] == '*' |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
995 yield (node, perm, executable, symlink, line[47:]) |
a7d98dc798c5
client: add manifest command
Idan Kamara <idankk86@gmail.com>
parents:
63
diff
changeset
|
996 |
46
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
997 def merge(self, rev=None, force=False, tool=None, cb=merge.handlers.abort): |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
998 """ |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
999 Merge working directory with rev. If no revision is specified, the working |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1000 directory's parent is a head revision, and the current branch contains |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1001 exactly one other head, the other head is merged with by default. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1002 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1003 The current working directory is updated with all changes made in the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1004 requested revision since the last common predecessor revision. |
46
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1005 |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1006 Files that changed between either parent are marked as changed for the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1007 next commit and a commit must be performed before any further updates to |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1008 the repository are allowed. The next commit will have two parents. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1009 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1010 force - force a merge with outstanding changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1011 tool - can be used to specify the merge tool used for file merges. It |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1012 overrides the HGMERGE environment variable and your configuration files. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1013 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1014 cb - controls the behaviour when Mercurial prompts what to do with regard |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1015 to a specific file, e.g. when one parent modified a file and the other |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1016 removed it. It can be one of merge.handlers, or a function that gets a |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1017 single argument which are the contents of stdout. It should return one |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1018 of the expected choices (a single character). |
46
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1019 """ |
45 | 1020 # we can't really use --preview since merge doesn't support --template |
1021 args = cmdbuilder('merge', r=rev, f=force, t=tool) | |
1022 | |
46
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1023 prompt = None |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1024 if cb is merge.handlers.abort: |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1025 prompt = cb |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1026 elif cb is merge.handlers.noninteractive: |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1027 args.append('-y') |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1028 else: |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1029 prompt = lambda size, output: cb(output) + '\n' |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1030 |
ebcc5d7dd528
client: introduce merge handlers
Idan Kamara <idankk86@gmail.com>
parents:
45
diff
changeset
|
1031 self.rawcommand(args, prompt=prompt) |
45 | 1032 |
32 | 1033 def move(self, source, dest, after=False, force=False, dryrun=False, |
1034 include=None, exclude=None): | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1035 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1036 Mark dest as copies of source; mark source for deletion. If dest is a |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1037 directory, copies are put in that directory. If dest is a file, then source |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1038 must be a string. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1039 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1040 Returns True on success, False if errors are encountered. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1041 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1042 source - a file or a list of files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1043 dest - a destination file or directory |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1044 after - record a rename that has already occurred |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1045 force - forcibly copy over an existing managed file |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1046 dryrun - do not perform actions, just print output |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1047 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1048 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1049 """ |
32 | 1050 if not isinstance(source, list): |
1051 source = [source] | |
1052 | |
1053 source.append(dest) | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1054 args = cmdbuilder('move', A=after, f=force, n=dryrun, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1055 I=include, X=exclude, *source) |
32 | 1056 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1057 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1058 self.rawcommand(args, eh=eh) |
32 | 1059 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1060 return bool(eh) |
32 | 1061 |
26
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1062 def outgoing(self, revrange=None, path=None, force=False, newest=False, |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1063 bookmarks=False, branch=None, limit=None, nomerges=False, |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1064 subrepos=False): |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1065 """ |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1066 Return changesets not found in the specified path or the default push |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1067 location. |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1068 |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1069 When bookmarks=True, return a list of (name, node) of bookmarks that will |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1070 be pushed. |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1071 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1072 revrange - a (list of) changeset intended to be included in the destination |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1073 force - run even when the destination is unrelated |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1074 newest - show newest record first |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1075 branch - a specific branch you would like to push |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1076 limit - limit number of changes displayed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1077 nomerges - do not show merges |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1078 ssh - specify ssh command to use |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1079 remotecmd - specify hg command to run on the remote side |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1080 insecure - do not verify server certificate (ignoring web.cacerts config) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1081 subrepos - recurse into subrepositories |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1082 """ |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1083 args = cmdbuilder('outgoing', |
26
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1084 path, |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1085 template=templates.changeset, r=revrange, |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1086 f=force, n=newest, B=bookmarks, |
b4e5c8745ef3
client: add missing options to outgoing
Idan Kamara <idankk86@gmail.com>
parents:
25
diff
changeset
|
1087 b=branch, S=subrepos) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1088 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1089 def eh(ret, out, err): |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1090 if ret != 1: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1091 raise error.CommandError(args, ret, out, err) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1092 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1093 out = self.rawcommand(args, eh=eh) |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1094 if not out: |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1095 return [] |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1096 |
27
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1097 out = util.eatlines(out, 2) |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1098 if bookmarks: |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1099 bms = [] |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1100 for line in out.splitlines(): |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1101 bms.append(tuple(line.split())) |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1102 return bms |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1103 else: |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1104 out = out.split('\0')[:-1] |
46908f4b87d5
client: add bookmarks support to incoming and outgoing
Idan Kamara <idankk86@gmail.com>
parents:
26
diff
changeset
|
1105 return self._parserevs(out) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1106 |
18
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1107 def parents(self, rev=None, file=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1108 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1109 Return the working directory's parent revisions. If rev is given, the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1110 parent of that revision will be printed. If file is given, the revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1111 in which the file was last changed (before the working directory revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1112 or the revision specified by rev) is returned. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1113 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1114 args = cmdbuilder('parents', file, template=templates.changeset, r=rev, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1115 hidden=self.hidden) |
18
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1116 |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1117 out = self.rawcommand(args) |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1118 if not out: |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1119 return |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1120 |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1121 out = out.split('\0')[:-1] |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1122 |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1123 return self._parserevs(out) |
518149e32888
client: add parents command
Idan Kamara <idankk86@gmail.com>
parents:
17
diff
changeset
|
1124 |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1125 def paths(self, name=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1126 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1127 Return the definition of given symbolic path name. If no name is given, |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1128 return a dictionary of pathname : url of all available names. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1129 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1130 Path names are defined in the [paths] section of your configuration file |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1131 and in "/etc/mercurial/hgrc". If run inside a repository, ".hg/hgrc" is |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1132 used, too. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1133 """ |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1134 if not name: |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
1135 out = self.rawcommand(['paths']) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1136 if not out: |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1137 return {} |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1138 |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1139 return dict([s.split(' = ') for s in out.rstrip().split('\n')]) |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1140 else: |
4 | 1141 args = cmdbuilder('paths', name) |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
1142 out = self.rawcommand(args) |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1143 return out.rstrip() |
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1144 |
40 | 1145 def pull(self, source=None, rev=None, update=False, force=False, bookmark=None, |
1146 branch=None, ssh=None, remotecmd=None, insecure=False, tool=None): | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1147 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1148 Pull changes from a remote repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1149 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1150 This finds all changes from the repository specified by source and adds |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1151 them to this repository. If source is omitted, the 'default' path will be |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1152 used. By default, this does not update the copy of the project in the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1153 working directory. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1154 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1155 Returns True on success, False if update was given and there were |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1156 unresolved files. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1157 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1158 update - update to new branch head if changesets were pulled |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1159 force - run even when remote repository is unrelated |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1160 rev - a (list of) remote changeset intended to be added |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1161 bookmark - (list of) bookmark to pull |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1162 branch - a (list of) specific branch you would like to pull |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1163 ssh - specify ssh command to use |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1164 remotecmd - specify hg command to run on the remote side |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1165 insecure - do not verify server certificate (ignoring web.cacerts config) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1166 tool - specify merge tool for rebase |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1167 """ |
40 | 1168 args = cmdbuilder('pull', source, r=rev, u=update, f=force, B=bookmark, |
1169 b=branch, e=ssh, remotecmd=remotecmd, insecure=insecure, | |
1170 t=tool) | |
1171 | |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1172 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1173 self.rawcommand(args, eh=eh) |
40 | 1174 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1175 return bool(eh) |
40 | 1176 |
39 | 1177 def push(self, dest=None, rev=None, force=False, bookmark=None, branch=None, |
1178 newbranch=False, ssh=None, remotecmd=None, insecure=False): | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1179 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1180 Push changesets from this repository to the specified destination. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1181 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1182 This operation is symmetrical to pull: it is identical to a pull in the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1183 destination repository from the current one. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1184 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1185 Returns True if push was successful, False if nothing to push. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1186 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1187 rev - the (list of) specified revision and all its ancestors will be pushed |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1188 to the remote repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1189 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1190 force - override the default behavior and push all changesets on all |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1191 branches. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1192 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1193 bookmark - (list of) bookmark to push |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1194 branch - a (list of) specific branch you would like to push |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1195 newbranch - allows push to create a new named branch that is not present at |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1196 the destination. This allows you to only create a new branch without |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1197 forcing other changes. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1198 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1199 ssh - specify ssh command to use |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1200 remotecmd - specify hg command to run on the remote side |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1201 insecure - do not verify server certificate (ignoring web.cacerts config) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1202 """ |
39 | 1203 args = cmdbuilder('push', dest, r=rev, f=force, B=bookmark, b=branch, |
1204 new_branch=newbranch, e=ssh, remotecmd=remotecmd, | |
1205 insecure=insecure) | |
1206 | |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1207 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1208 self.rawcommand(args, eh=eh) |
39 | 1209 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1210 return bool(eh) |
39 | 1211 |
30 | 1212 def remove(self, files, after=False, force=False, include=None, exclude=None): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1213 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1214 Schedule the indicated files for removal from the repository. This only |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1215 removes files from the current branch, not from the entire project history. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1216 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1217 Returns True on success, False if any warnings encountered. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1218 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1219 after - used to remove only files that have already been deleted |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1220 force - remove (and delete) file even if added or modified |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1221 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1222 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1223 """ |
30 | 1224 if not isinstance(files, list): |
1225 files = [files] | |
1226 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1227 args = cmdbuilder('remove', A=after, f=force, I=include, X=exclude, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1228 *files) |
30 | 1229 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1230 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1231 self.rawcommand(args, eh=eh) |
30 | 1232 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1233 return bool(eh) |
30 | 1234 |
63
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1235 def resolve(self, file=[], all=False, listfiles=False, mark=False, unmark=False, |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1236 tool=None, include=None, exclude=None): |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1237 """ |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1238 Redo merges or set/view the merge status of given files. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1239 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1240 Returns True on success, False if any files fail a resolve attempt. |
63
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1241 |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1242 When listfiles is True, returns a list of (code, file path) of resolved |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1243 and unresolved files. Code will be 'R' or 'U' accordingly. |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1244 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1245 all - select all unresolved files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1246 mark - mark files as resolved |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1247 unmark - mark files as unresolved |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1248 tool - specify merge tool |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1249 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1250 exclude - exclude names matching the given patterns |
63
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1251 """ |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1252 if not isinstance(file, list): |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1253 file = [file] |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1254 |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1255 args = cmdbuilder('resolve', a=all, l=listfiles, m=mark, u=unmark, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1256 t=tool, I=include, X=exclude, *file) |
63
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1257 |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1258 out = self.rawcommand(args) |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1259 |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1260 if listfiles: |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1261 l = [] |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1262 for line in out.splitlines(): |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1263 l.append(tuple(line.split(' ', 1))) |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1264 return l |
939d1d763bb1
client: add resolve command
Idan Kamara <idankk86@gmail.com>
parents:
62
diff
changeset
|
1265 |
47 | 1266 def revert(self, files, rev=None, all=False, date=None, nobackup=False, |
1267 dryrun=False, include=None, exclude=None): | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1268 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1269 With no revision specified, revert the specified files or directories to |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1270 the contents they had in the parent of the working directory. This |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1271 restores the contents of files to an unmodified state and unschedules |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1272 adds, removes, copies, and renames. If the working directory has two |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1273 parents, you must explicitly specify a revision. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1274 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1275 Specifying rev or date will revert the given files or directories to their |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1276 states as of a specific revision. Because revert does not change the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1277 working directory parents, this will cause these files to appear modified. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1278 This can be helpful to "back out" some or all of an earlier change. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1279 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1280 Modified files are saved with a .orig suffix before reverting. To disable |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1281 these backups, use nobackup. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1282 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1283 Returns True on success. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1284 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1285 all - revert all changes when no arguments given |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1286 date - tipmost revision matching date |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1287 rev - revert to the specified revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1288 nobackup - do not save backup copies of files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1289 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1290 exclude - exclude names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1291 dryrun - do not perform actions, just print output |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1292 """ |
47 | 1293 if not isinstance(files, list): |
1294 files = [files] | |
1295 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1296 args = cmdbuilder('revert', r=rev, a=all, d=date, |
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1297 no_backup=nobackup, n=dryrun, I=include, X=exclude, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1298 hidden=self.hidden, *files) |
47 | 1299 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1300 eh = util.reterrorhandler(args) |
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1301 self.rawcommand(args, eh=eh) |
47 | 1302 |
50
bd7dfd94b0d9
client: use util.reterrorhandler
Idan Kamara <idankk86@gmail.com>
parents:
48
diff
changeset
|
1303 return bool(eh) |
47 | 1304 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1305 def root(self): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1306 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1307 Return the root directory of the current repository. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1308 """ |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1309 return self.rawcommand(['root']).rstrip() |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1310 |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1311 def status(self, rev=None, change=None, all=False, modified=False, added=False, |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1312 removed=False, deleted=False, clean=False, unknown=False, |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1313 ignored=False, copies=False, subrepos=False, include=None, |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1314 exclude=None): |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1315 """ |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1316 Return status of files in the repository as a list of (code, file path) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1317 where code can be: |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1318 |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1319 M = modified |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1320 A = added |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1321 R = removed |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1322 C = clean |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1323 ! = missing (deleted by non-hg command, but still tracked) |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1324 ? = untracked |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1325 I = ignored |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1326 = origin of the previous file listed as A (added) |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1327 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1328 rev - show difference from (list of) revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1329 change - list the changed files of a revision |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1330 all - show status of all files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1331 modified - show only modified files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1332 added - show only added files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1333 removed - show only removed files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1334 deleted - show only deleted (but tracked) files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1335 clean - show only files without changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1336 unknown - show only unknown (not tracked) files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1337 ignored - show only ignored files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1338 copies - show source of copied files |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1339 subrepos - recurse into subrepositories |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1340 include - include names matching the given patterns |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1341 exclude - exclude names matching the given patterns |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1342 """ |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1343 if rev and change: |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1344 raise ValueError('cannot specify both rev and change') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1345 |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1346 args = cmdbuilder('status', rev=rev, change=change, A=all, m=modified, |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1347 a=added, r=removed, d=deleted, c=clean, u=unknown, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1348 i=ignored, C=copies, S=subrepos, I=include, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1349 X=exclude, hidden=self.hidden) |
33
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1350 |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1351 args.append('-0') |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1352 |
d74a5891d9d1
client: add missing options to status
Idan Kamara <idankk86@gmail.com>
parents:
32
diff
changeset
|
1353 out = self.rawcommand(args) |
34
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
1354 l = [] |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1355 |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1356 for entry in out.split('\0'): |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1357 if entry: |
35
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
1358 if entry[0] == ' ': |
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
1359 l.append((' ', entry[2:])) |
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
1360 else: |
1e33bbea23e5
client: handle spaces correctly in status()
Idan Kamara <idankk86@gmail.com>
parents:
34
diff
changeset
|
1361 l.append(tuple(entry.split(' ', 1))) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1362 |
34
f6e1d9a6e0cd
client: change return value of status() to a list of (code, file path)
Idan Kamara <idankk86@gmail.com>
parents:
33
diff
changeset
|
1363 return l |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1364 |
42 | 1365 def tag(self, names, rev=None, message=None, force=False, local=False, |
1366 remove=False, date=None, user=None): | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1367 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1368 Add one or more tags specified by names for the current or given revision. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1369 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1370 Changing an existing tag is normally disallowed; use force to override. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1371 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1372 Tag commits are usually made at the head of a branch. If the parent of the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1373 working directory is not a branch head, a CommandError will be raised. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1374 force can be specified to force the tag commit to be based on a non-head |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1375 changeset. |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1376 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1377 local - make the tag local |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1378 rev - revision to tag |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1379 remove - remove a tag |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1380 message - set commit message |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1381 date - record the specified date as commit date |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1382 user - record the specified user as committer |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1383 """ |
42 | 1384 if not isinstance(names, list): |
1385 names = [names] | |
1386 | |
87
5661d5f7e39b
client: make varargs ordering py2.4-compatible
Matt Mackall <mpm@selenic.com>
parents:
79
diff
changeset
|
1387 args = cmdbuilder('tag', r=rev, m=message, f=force, l=local, |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1388 remove=remove, d=date, u=user, hidden=self.hidden, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1389 *names) |
42 | 1390 |
1391 self.rawcommand(args) | |
1392 | |
43 | 1393 def tags(self): |
1394 """ | |
1395 Return a list of repository tags as: (name, rev, node, islocal) | |
1396 """ | |
1397 args = cmdbuilder('tags', v=True) | |
1398 | |
1399 out = self.rawcommand(args) | |
1400 | |
1401 t = [] | |
1402 for line in out.splitlines(): | |
1403 taglocal = line.endswith(' local') | |
1404 if taglocal: | |
1405 line = line[:-6] | |
1406 name, rev = line.rsplit(' ', 1) | |
1407 rev, node = rev.split(':') | |
1408 t.append((name.rstrip(), int(rev), node, taglocal)) | |
1409 return t | |
1410 | |
125
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1411 def phase(self, revs=(), secret=False, draft=False, public=False, |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1412 force=False): |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1413 '''Set or show the current phase name. |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1414 |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1415 revs - target revision(s) |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1416 public - set changeset phase to public |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1417 draft - set changeset phase to draft |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1418 secret - set changeset phase to secret |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1419 force - allow to move boundary backward |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1420 |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1421 output format: [(id, phase) ...] for each changeset |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1422 |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1423 The arguments match the mercurial API. |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1424 ''' |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1425 if not isinstance(revs, (list, tuple)): |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1426 revs = [revs] |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1427 args = util.cmdbuilder('phase', secret=secret, draft=draft, |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1428 public=public, force=force, hidden=self.hidden, *revs) |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1429 out = self.rawcommand(args) |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1430 if draft or public or secret: |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1431 return |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1432 else: |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1433 output = [i.split(': ')for i in out.strip().split('\n')] |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1434 return [(int(num), phase) for (num, phase) in output] |
8d9a9da3e7b4
client: add 'phase' method to set or get the phase of a changeset
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
123
diff
changeset
|
1435 |
51
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1436 def summary(self, remote=False): |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1437 """ |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1438 Return a dictionary with a brief summary of the working directory state, |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1439 including parents, branch, commit status, and available updates. |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1440 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1441 'parent' : a list of (rev, node, tags, message) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1442 'branch' : the current branch |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1443 'commit' : True if the working directory is clean, False otherwise |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1444 'update' : number of available updates, |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1445 ['remote' : (in, in bookmarks, out, out bookmarks),] |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1446 ['mq': (applied, unapplied) mq patches,] |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1447 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1448 unparsed entries will be of them form key : value |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1449 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1450 args = cmdbuilder('summary', remote=remote, hidden=self.hidden) |
51
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1451 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1452 out = self.rawcommand(args).splitlines() |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1453 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1454 d = {} |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1455 while out: |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1456 line = out.pop(0) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1457 name, value = line.split(': ', 1) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1458 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1459 if name == 'parent': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1460 parent, tags = value.split(' ', 1) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1461 rev, node = parent.split(':') |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1462 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1463 if tags: |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1464 tags = tags.replace(' (empty repository)', '') |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1465 else: |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1466 tags = None |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1467 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1468 value = d.get(name, []) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1469 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1470 if rev == '-1': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1471 value.append((int(rev), node, tags, None)) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1472 else: |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1473 message = out.pop(0)[1:] |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1474 value.append((int(rev), node, tags, message)) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1475 elif name == 'branch': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1476 pass |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1477 elif name == 'commit': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1478 value = value == '(clean)' |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1479 elif name == 'update': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1480 if value == '(current)': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1481 value = 0 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1482 else: |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1483 value = int(value.split(' ', 1)[0]) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1484 elif remote and name == 'remote': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1485 if value == '(synced)': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1486 value = 0, 0, 0, 0 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1487 else: |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1488 inc = incb = out_ = outb = 0 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1489 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1490 for v in value.split(', '): |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1491 count, v = v.split(' ', 1) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1492 if v == 'outgoing': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1493 out_ = int(count) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1494 elif v.endswith('incoming'): |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1495 inc = int(count) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1496 elif v == 'incoming bookmarks': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1497 incb = int(count) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1498 elif v == 'outgoing bookmarks': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1499 outb = int(count) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1500 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1501 value = inc, incb, out_, outb |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1502 elif name == 'mq': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1503 applied = unapplied = 0 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1504 for v in value.split(', '): |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1505 count, v = v.split(' ', 1) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1506 if v == 'applied': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1507 applied = int(count) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1508 elif v == 'unapplied': |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1509 unapplied = int(count) |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1510 value = applied, unapplied |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1511 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1512 d[name] = value |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1513 |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1514 return d |
c52383a550fb
client: add summary command
Idan Kamara <idankk86@gmail.com>
parents:
50
diff
changeset
|
1515 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1516 def tip(self): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1517 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1518 Return the tip revision (usually just called the tip) which is the |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1519 changeset most recently added to the repository (and therefore the most |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1520 recently changed head). |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1521 """ |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1522 args = cmdbuilder('tip', template=templates.changeset, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1523 hidden=self.hidden) |
5
3182303f388d
client: rawcommand, more convenient helper to run commands instead of outputruncommand
Idan Kamara <idankk86@gmail.com>
parents:
4
diff
changeset
|
1524 out = self.rawcommand(args) |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1525 out = out.split('\0') |
2
5fa34c3ac9a0
turn hglib into a module and expose open (previously connect) in its __init__.py
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1526 |
10
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1527 return self._parserevs(out)[0] |
fce3102c19e5
client: sort commands by name
Idan Kamara <idankk86@gmail.com>
parents:
8
diff
changeset
|
1528 |
20 | 1529 def update(self, rev=None, clean=False, check=False, date=None): |
1530 """ | |
1531 Update the repository's working directory to changeset specified by rev. | |
1532 If rev isn't specified, update to the tip of the current named branch. | |
1533 | |
1534 Return the number of files (updated, merged, removed, unresolved) | |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1535 |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1536 clean - discard uncommitted changes (no backup) |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1537 check - update across branches if no uncommitted changes |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1538 date - tipmost revision matching date |
20 | 1539 """ |
1540 if clean and check: | |
1541 raise ValueError('clean and check cannot both be True') | |
1542 | |
123
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1543 args = cmdbuilder('update', r=rev, C=clean, c=check, d=date, |
cdde1656346f
client: add 'hidden' property to show hidden changesets.
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
122
diff
changeset
|
1544 hidden=self.hidden) |
20 | 1545 |
1546 def eh(ret, out, err): | |
1547 if ret == 1: | |
1548 return out | |
1549 | |
1550 raise error.CommandError(args, ret, out, err) | |
1551 | |
1552 | |
1553 out = self.rawcommand(args, eh=eh) | |
1554 | |
109
9324a89dd84e
client: Be more permissive on the output of update (issue3892)
Benoit Allard <benoit@aeteurope.nl>
parents:
105
diff
changeset
|
1555 m = re.search(r'^(\d+).+, (\d+).+, (\d+).+, (\d+)', out, re.MULTILINE) |
9324a89dd84e
client: Be more permissive on the output of update (issue3892)
Benoit Allard <benoit@aeteurope.nl>
parents:
105
diff
changeset
|
1556 return tuple(map(int,list(m.groups()))) |
41
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1557 |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1558 @property |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1559 def version(self): |
65
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1560 """ |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1561 Return hg version that runs the command server as a 4 fielded tuple: major, |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1562 minor, micro and local build info. e.g. (1, 9, 1, '+4-3095db9f5c2c') |
91ffa1de398c
document all commands in client.py
Idan Kamara <idankk86@gmail.com>
parents:
64
diff
changeset
|
1563 """ |
41
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1564 if self._version is None: |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1565 v = self.rawcommand(cmdbuilder('version', q=True)) |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1566 v = list(re.match(r'.*?(\d+)\.(\d+)\.?(\d+)?(\+[0-9a-f-]+)?', |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1567 v).groups()) |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1568 |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1569 for i in range(3): |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1570 try: |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1571 v[i] = int(v[i]) |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1572 except TypeError: |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1573 v[i] = 0 |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1574 |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1575 self._version = tuple(v) |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1576 |
e185c3922c68
client: add version command
Idan Kamara <idankk86@gmail.com>
parents:
40
diff
changeset
|
1577 return self._version |
95
bd23bc72e662
client: add a convenience method __getitem__ to return a changectx
Idan Kamara <idankk86@gmail.com>
parents:
91
diff
changeset
|
1578 |
bd23bc72e662
client: add a convenience method __getitem__ to return a changectx
Idan Kamara <idankk86@gmail.com>
parents:
91
diff
changeset
|
1579 def __getitem__(self, changeid): |
bd23bc72e662
client: add a convenience method __getitem__ to return a changectx
Idan Kamara <idankk86@gmail.com>
parents:
91
diff
changeset
|
1580 return context.changectx(self, changeid) |
122
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1581 |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1582 def __contains__(self, changeid): |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1583 """ |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1584 check if changeid, which can be either a local revision number or a |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1585 changeset id, matches a changeset in the client. |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1586 """ |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1587 try: |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1588 context.changectx(self, changeid) |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1589 return True |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1590 except ValueError: |
e05b0cf920bb
client: implement the 'in' keyword for a client object
Paul Tonelli <paul.tonelli@logilab.fr>
parents:
120
diff
changeset
|
1591 return False |