Mercurial > hg
annotate hgext/convert/monotone.py @ 13760:ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Currently the convert extension spawns a new mtn process for each
operation. For a large repository, this ends up being hundreds of
thousands of processes. The following enables usage of monotone's
"automate stdio" functionality - documented at:
http://www.monotone.ca/docs/Automation.html#index-mtn-automate-stdio-188
The effect is that (after determining that a new enough mtn executable
is available) a single long-running mtn process is used for all the
operations, using stdin/stdout to send commands and read output.
This has a pretty significant effect on the performance of some parts
of the conversion process.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 23 Mar 2011 14:26:56 -0400 |
parents | 33010ff1fd6f |
children | aeb41f0048e7 |
rev | line source |
---|---|
8250
1b60efdb8bc5
convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents:
8127
diff
changeset
|
1 # monotone.py - monotone support for the convert extension |
1b60efdb8bc5
convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents:
8127
diff
changeset
|
2 # |
1b60efdb8bc5
convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents:
8127
diff
changeset
|
3 # Copyright 2008, 2009 Mikkel Fahnoe Jorgensen <mikkel@dvide.com> and |
1b60efdb8bc5
convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents:
8127
diff
changeset
|
4 # others |
1b60efdb8bc5
convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents:
8127
diff
changeset
|
5 # |
1b60efdb8bc5
convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents:
8127
diff
changeset
|
6 # This software may be used and distributed according to the terms of the |
10263 | 7 # GNU General Public License version 2 or any later version. |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
8 |
7873
4a4c7f6a5912
cleanup: drop unused imports
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
6632
diff
changeset
|
9 import os, re |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
10 from mercurial import util |
7873
4a4c7f6a5912
cleanup: drop unused imports
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
6632
diff
changeset
|
11 from common import NoRepo, commit, converter_source, checktool |
6332
950e72fc7cf3
convert: allow missing tools not to stop source type detection
Patrick Mezard <pmezard@gmail.com>
parents:
6307
diff
changeset
|
12 from common import commandline |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
13 from mercurial.i18n import _ |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
14 |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
15 class monotone_source(converter_source, commandline): |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
16 def __init__(self, ui, path=None, rev=None): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
17 converter_source.__init__(self, ui, path, rev) |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
18 commandline.__init__(self, ui, 'mtn') |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
19 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
20 self.ui = ui |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
21 self.path = path |
13760
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
22 self.automatestdio = False |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
23 |
10938
02d6149a480b
convert: write "repository" instead of "repo"
Martin Geisler <mg@lazybytes.net>
parents:
10282
diff
changeset
|
24 norepo = NoRepo(_("%s does not look like a monotone repository") |
02d6149a480b
convert: write "repository" instead of "repo"
Martin Geisler <mg@lazybytes.net>
parents:
10282
diff
changeset
|
25 % path) |
7973
db3a68fd9387
convert: attempt to check repo type before checking for tool
Matt Mackall <mpm@selenic.com>
parents:
7957
diff
changeset
|
26 if not os.path.exists(os.path.join(path, '_MTN')): |
8052
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
27 # Could be a monotone repository (SQLite db file) |
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
28 try: |
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
29 header = file(path, 'rb').read(16) |
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
30 except: |
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
31 header = '' |
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
32 if header != 'SQLite format 3\x00': |
fe2a87a3d344
convert/mtn: allow monotone database files as sources
Patrick Mezard <pmezard@gmail.com>
parents:
8051
diff
changeset
|
33 raise norepo |
7973
db3a68fd9387
convert: attempt to check repo type before checking for tool
Matt Mackall <mpm@selenic.com>
parents:
7957
diff
changeset
|
34 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
35 # regular expressions for parsing monotone output |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
36 space = r'\s*' |
6632
aa3f61884a48
convert.monotone: fix quotes and backslashes in change descriptions.
David Reiss <davidn@gmail.com>
parents:
6376
diff
changeset
|
37 name = r'\s+"((?:\\"|[^"])*)"\s*' |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
38 value = name |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
39 revision = r'\s+\[(\w+)\]\s*' |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
40 lines = r'(?:.|\n)+' |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
41 |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
42 self.dir_re = re.compile(space + "dir" + name) |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
43 self.file_re = re.compile(space + "file" + name + |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
44 "content" + revision) |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
45 self.add_file_re = re.compile(space + "add_file" + name + |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
46 "content" + revision) |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
47 self.patch_re = re.compile(space + "patch" + name + |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
48 "from" + revision + "to" + revision) |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
49 self.rename_re = re.compile(space + "rename" + name + "to" + name) |
6376
b40e90341ae2
convert: record deleted files in monotone source
Patrick Mezard <pmezard@gmail.com>
parents:
6332
diff
changeset
|
50 self.delete_re = re.compile(space + "delete" + name) |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
51 self.tag_re = re.compile(space + "tag" + name + "revision" + |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
52 revision) |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
53 self.cert_re = re.compile(lines + space + "name" + name + |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
54 "value" + value) |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
55 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
56 attr = space + "file" + lines + space + "attr" + space |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
57 self.attr_execute_re = re.compile(attr + '"mtn:execute"' + |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10263
diff
changeset
|
58 space + '"true"') |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
59 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
60 # cached data |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
61 self.manifest_rev = None |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
62 self.manifest = None |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
63 self.files = None |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
64 self.dirs = None |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
65 |
6332
950e72fc7cf3
convert: allow missing tools not to stop source type detection
Patrick Mezard <pmezard@gmail.com>
parents:
6307
diff
changeset
|
66 checktool('mtn', abort=False) |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
67 |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
68 # test if there are any revisions |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
69 self.rev = None |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
70 try: |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
71 self.getheads() |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
72 except: |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
73 raise norepo |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
74 self.rev = rev |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
75 |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
76 def mtnrun(self, *args, **kwargs): |
13760
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
77 if self.automatestdio: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
78 return self.mtnrunstdio(*args, **kwargs) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
79 else: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
80 return self.mtnrunsingle(*args, **kwargs) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
81 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
82 def mtnrunsingle(self, *args, **kwargs): |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
83 kwargs['d'] = self.path |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
84 return self.run0('automate', *args, **kwargs) |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
85 |
13760
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
86 def mtnrunstdio(self, *args, **kwargs): |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
87 # Prepare the command in automate stdio format |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
88 command = [] |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
89 for k, v in kwargs.iteritems(): |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
90 command.append("%s:%s" % (len(k), k)) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
91 if v: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
92 command.append("%s:%s" % (len(v), v)) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
93 if command: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
94 command.insert(0, 'o') |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
95 command.append('e') |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
96 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
97 command.append('l') |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
98 for arg in args: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
99 command += "%s:%s" % (len(arg), arg) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
100 command.append('e') |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
101 command = ''.join(command) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
102 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
103 self.ui.debug("mtn: sending '%s'\n" % command) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
104 self.mtnwritefp.write(command) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
105 self.mtnwritefp.flush() |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
106 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
107 return self.mtnstdioreadcommandoutput(command) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
108 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
109 def mtnstdioreadpacket(self): |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
110 read = None |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
111 commandnbr = '' |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
112 while read != ':': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
113 read = self.mtnreadfp.read(1) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
114 if not read: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
115 raise util.Abort(_('bad mtn packet - no end of commandnbr')) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
116 commandnbr += read |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
117 commandnbr = commandnbr[:-1] |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
118 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
119 stream = self.mtnreadfp.read(1) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
120 if stream not in 'mewptl': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
121 raise util.Abort(_('bad mtn packet - bad stream type %s' % stream)) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
122 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
123 read = self.mtnreadfp.read(1) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
124 if read != ':': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
125 raise util.Abort(_('bad mtn packet - no divider before size')) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
126 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
127 read = None |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
128 lengthstr = '' |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
129 while read != ':': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
130 read = self.mtnreadfp.read(1) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
131 if not read: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
132 raise util.Abort(_('bad mtn packet - no end of packet size')) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
133 lengthstr += read |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
134 try: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
135 length = long(lengthstr[:-1]) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
136 except TypeError: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
137 raise util.Abort(_('bad mtn packet - bad packet size %s') |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
138 % lengthstr) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
139 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
140 read = self.mtnreadfp.read(length) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
141 if len(read) != length: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
142 raise util.Abort(_("bad mtn packet - unable to read full packet " |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
143 "read %s of %s") % (len(read), length)) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
144 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
145 return (commandnbr, stream, length, read) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
146 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
147 def mtnstdioreadcommandoutput(self, command): |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
148 retval = '' |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
149 while True: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
150 commandnbr, stream, length, output = self.mtnstdioreadpacket() |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
151 self.ui.debug('mtn: read packet %s:%s:%s\n' % |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
152 (commandnbr, stream, length)) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
153 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
154 if stream == 'l': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
155 # End of command |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
156 if output != '0': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
157 raise util.Abort(_("mtn command '%s' returned %s") % |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
158 (command, output)) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
159 break |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
160 elif stream in 'ew': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
161 # Error, warning output |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
162 self.ui.warn(_('%s error:\n') % self.command) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
163 self.ui.warn(output) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
164 elif stream == 'p': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
165 # Progress messages |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
166 self.ui.debug('mtn: ' + output) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
167 elif stream == 'm': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
168 # Main stream - command output |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
169 retval = output |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
170 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
171 return retval |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
172 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
173 def mtnloadmanifest(self, rev): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
174 if self.manifest_rev == rev: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
175 return |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
176 self.manifest = self.mtnrun("get_manifest_of", rev).split("\n\n") |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
177 self.manifest_rev = rev |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
178 self.files = {} |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
179 self.dirs = {} |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
180 |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
181 for e in self.manifest: |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
182 m = self.file_re.match(e) |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
183 if m: |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
184 attr = "" |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
185 name = m.group(1) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
186 node = m.group(2) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
187 if self.attr_execute_re.match(e): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
188 attr += "x" |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
189 self.files[name] = (node, attr) |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
190 m = self.dir_re.match(e) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
191 if m: |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
192 self.dirs[m.group(1)] = True |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
193 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
194 def mtnisfile(self, name, rev): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
195 # a non-file could be a directory or a deleted or renamed file |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
196 self.mtnloadmanifest(rev) |
8458
f6c99b1628d7
convert: cleanups in monotone converter
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8250
diff
changeset
|
197 return name in self.files |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
198 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
199 def mtnisdir(self, name, rev): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
200 self.mtnloadmanifest(rev) |
8458
f6c99b1628d7
convert: cleanups in monotone converter
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8250
diff
changeset
|
201 return name in self.dirs |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
202 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
203 def mtngetcerts(self, rev): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
204 certs = {"author":"<missing>", "date":"<missing>", |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
205 "changelog":"<missing>", "branch":"<missing>"} |
9823
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
206 certlist = self.mtnrun("certs", rev) |
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
207 # mtn < 0.45: |
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
208 # key "test@selenic.com" |
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
209 # mtn >= 0.45: |
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
210 # key [ff58a7ffb771907c4ff68995eada1c4da068d328] |
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
211 certlist = re.split('\n\n key ["\[]', certlist) |
11d7bb5e0df2
convert/mtn: handle change in mtn 0.45 certs output
Patrick Mezard <pmezard@gmail.com>
parents:
8458
diff
changeset
|
212 for e in certlist: |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
213 m = self.cert_re.match(e) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
214 if m: |
6632
aa3f61884a48
convert.monotone: fix quotes and backslashes in change descriptions.
David Reiss <davidn@gmail.com>
parents:
6376
diff
changeset
|
215 name, value = m.groups() |
aa3f61884a48
convert.monotone: fix quotes and backslashes in change descriptions.
David Reiss <davidn@gmail.com>
parents:
6376
diff
changeset
|
216 value = value.replace(r'\"', '"') |
aa3f61884a48
convert.monotone: fix quotes and backslashes in change descriptions.
David Reiss <davidn@gmail.com>
parents:
6376
diff
changeset
|
217 value = value.replace(r'\\', '\\') |
aa3f61884a48
convert.monotone: fix quotes and backslashes in change descriptions.
David Reiss <davidn@gmail.com>
parents:
6376
diff
changeset
|
218 certs[name] = value |
8101
d8229670710f
convert/mtn: handle subsecond commit dates (issue1616)
Paul Aurich <paul@darkrain42.org>
parents:
8099
diff
changeset
|
219 # Monotone may have subsecond dates: 2005-02-05T09:39:12.364306 |
8125
da9f3866c637
convert/mtn: mtn does not record timezones, mark dates as UTC (issue1624)
Paul Aurich <paul@darkrain42.org>
parents:
8124
diff
changeset
|
220 # and all times are stored in UTC |
da9f3866c637
convert/mtn: mtn does not record timezones, mark dates as UTC (issue1624)
Paul Aurich <paul@darkrain42.org>
parents:
8124
diff
changeset
|
221 certs["date"] = certs["date"].split('.')[0] + " UTC" |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
222 return certs |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
223 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
224 # implement the converter_source interface: |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
225 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
226 def getheads(self): |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
227 if not self.rev: |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
228 return self.mtnrun("leaves").splitlines() |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
229 else: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
230 return [self.rev] |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
231 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
232 def getchanges(self, rev): |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
233 #revision = self.mtncmd("get_revision %s" % rev).split("\n\n") |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
234 revision = self.mtnrun("get_revision", rev).split("\n\n") |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
235 files = {} |
8123
933b874e402f
convert/mtn: handle files moved in a moved directory (issue1619/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8101
diff
changeset
|
236 ignoremove = {} |
8099
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
237 renameddirs = [] |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
238 copies = {} |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
239 for e in revision: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
240 m = self.add_file_re.match(e) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
241 if m: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
242 files[m.group(1)] = rev |
8123
933b874e402f
convert/mtn: handle files moved in a moved directory (issue1619/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8101
diff
changeset
|
243 ignoremove[m.group(1)] = rev |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
244 m = self.patch_re.match(e) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
245 if m: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
246 files[m.group(1)] = rev |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
247 # Delete/rename is handled later when the convert engine |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
248 # discovers an IOError exception from getfile, |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
249 # but only if we add the "from" file to the list of changes. |
6376
b40e90341ae2
convert: record deleted files in monotone source
Patrick Mezard <pmezard@gmail.com>
parents:
6332
diff
changeset
|
250 m = self.delete_re.match(e) |
b40e90341ae2
convert: record deleted files in monotone source
Patrick Mezard <pmezard@gmail.com>
parents:
6332
diff
changeset
|
251 if m: |
b40e90341ae2
convert: record deleted files in monotone source
Patrick Mezard <pmezard@gmail.com>
parents:
6332
diff
changeset
|
252 files[m.group(1)] = rev |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
253 m = self.rename_re.match(e) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
254 if m: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
255 toname = m.group(2) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
256 fromname = m.group(1) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
257 if self.mtnisfile(toname, rev): |
8123
933b874e402f
convert/mtn: handle files moved in a moved directory (issue1619/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8101
diff
changeset
|
258 ignoremove[toname] = 1 |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
259 copies[toname] = fromname |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
260 files[toname] = rev |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
261 files[fromname] = rev |
8099
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
262 elif self.mtnisdir(toname, rev): |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
263 renameddirs.append((fromname, toname)) |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
264 |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
265 # Directory renames can be handled only once we have recorded |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
266 # all new files |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
267 for fromdir, todir in renameddirs: |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
268 renamed = {} |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
269 for tofile in self.files: |
8123
933b874e402f
convert/mtn: handle files moved in a moved directory (issue1619/2)
Patrick Mezard <pmezard@gmail.com>
parents:
8101
diff
changeset
|
270 if tofile in ignoremove: |
8099
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
271 continue |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
272 if tofile.startswith(todir + '/'): |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
273 renamed[tofile] = fromdir + tofile[len(todir):] |
8124
d883bfbd2e60
convert/mtn: handle directory move into moved directory (issue1619/3)
Patrick Mezard <pmezard@gmail.com>
parents:
8123
diff
changeset
|
274 # Avoid chained moves like: |
d883bfbd2e60
convert/mtn: handle directory move into moved directory (issue1619/3)
Patrick Mezard <pmezard@gmail.com>
parents:
8123
diff
changeset
|
275 # d1(/a) => d3/d1(/a) |
d883bfbd2e60
convert/mtn: handle directory move into moved directory (issue1619/3)
Patrick Mezard <pmezard@gmail.com>
parents:
8123
diff
changeset
|
276 # d2 => d3 |
d883bfbd2e60
convert/mtn: handle directory move into moved directory (issue1619/3)
Patrick Mezard <pmezard@gmail.com>
parents:
8123
diff
changeset
|
277 ignoremove[tofile] = 1 |
8099
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
278 for tofile, fromfile in renamed.items(): |
8100 | 279 self.ui.debug (_("copying file in renamed directory " |
280 "from '%s' to '%s'") | |
8099
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
281 % (fromfile, tofile), '\n') |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
282 files[tofile] = rev |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
283 copies[tofile] = fromfile |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
284 for fromfile in renamed.values(): |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
285 files[fromfile] = rev |
3cdf4872941a
convert/mtn: handle new files in moved directories (issue1619)
Patrick Mezard <pmezard@gmail.com>
parents:
8050
diff
changeset
|
286 |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
287 return (files.items(), copies) |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
288 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
289 def getfile(self, name, rev): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
290 if not self.mtnisfile(name, rev): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
291 raise IOError() # file was deleted or renamed |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
292 try: |
11134
33010ff1fd6f
convert: merge sources getmode() into getfile()
Patrick Mezard <pmezard@gmail.com>
parents:
10938
diff
changeset
|
293 data = self.mtnrun("get_file_of", name, r=rev) |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
294 except: |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
295 raise IOError() # file was deleted or renamed |
11134
33010ff1fd6f
convert: merge sources getmode() into getfile()
Patrick Mezard <pmezard@gmail.com>
parents:
10938
diff
changeset
|
296 self.mtnloadmanifest(rev) |
33010ff1fd6f
convert: merge sources getmode() into getfile()
Patrick Mezard <pmezard@gmail.com>
parents:
10938
diff
changeset
|
297 node, attr = self.files.get(name, (None, "")) |
33010ff1fd6f
convert: merge sources getmode() into getfile()
Patrick Mezard <pmezard@gmail.com>
parents:
10938
diff
changeset
|
298 return data, attr |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
299 |
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
300 def getcommit(self, rev): |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
301 certs = self.mtngetcerts(rev) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
302 return commit( |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
303 author=certs["author"], |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
304 date=util.datestr(util.strdate(certs["date"], "%Y-%m-%dT%H:%M:%S")), |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
305 desc=certs["changelog"], |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
306 rev=rev, |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
307 parents=self.mtnrun("parents", rev).splitlines(), |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
308 branch=certs["branch"]) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
309 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
310 def gettags(self): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
311 tags = {} |
6307
6840668e3bf6
cleanup monotone conversion and use commandline class
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
6306
diff
changeset
|
312 for e in self.mtnrun("tags").split("\n\n"): |
6306
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
313 m = self.tag_re.match(e) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
314 if m: |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
315 tags[m.group(1)] = m.group(2) |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
316 return tags |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
317 |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
318 def getchangedfiles(self, rev, i): |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
319 # This function is only needed to support --filemap |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
320 # ... and we don't support that |
2f9de4aaea9e
initial version of monotone source for convert extension
Mikkel Fahnøe Jørgensen <mikkel@dvide.com>
parents:
diff
changeset
|
321 raise NotImplementedError() |
13760
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
322 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
323 def before(self): |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
324 # Check if we have a new enough version to use automate stdio |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
325 version = 0.0 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
326 try: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
327 versionstr = self.mtnrunsingle("interface_version") |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
328 version = float(versionstr) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
329 except Exception: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
330 raise util.Abort(_("unable to determine mtn automate interface " |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
331 "version")) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
332 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
333 if version >= 12.0: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
334 self.automatestdio = True |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
335 self.ui.debug("mtn automate version %s - using automate stdio\n" % |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
336 version) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
337 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
338 # launch the long-running automate stdio process |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
339 self.mtnwritefp, self.mtnreadfp = self._run2('automate', 'stdio', |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
340 '-d', self.path) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
341 # read the headers |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
342 read = self.mtnreadfp.readline() |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
343 if read != 'format-version: 2\n': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
344 raise util.Abort(_('mtn automate stdio header unexpected: %s') |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
345 % read) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
346 while read != '\n': |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
347 read = self.mtnreadfp.readline() |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
348 if not read: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
349 raise util.Abort(_("failed to reach end of mtn automate " |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
350 "stdio headers")) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
351 else: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
352 self.ui.debug("mtn automate version %s - not using automate stdio " |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
353 "(automate >= 12.0 - mtn >= 0.46 is needed)\n" % version) |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
354 |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
355 def after(self): |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
356 if self.automatestdio: |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
357 self.mtnwritefp.close() |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
358 self.mtnwritefp = None |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
359 self.mtnreadfp.close() |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
360 self.mtnreadfp = None |
ed97955e0c04
convert/mtn: add support for using monotone's "automate stdio" when available
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11134
diff
changeset
|
361 |