author | Patrick Mezard <pmezard@gmail.com> |
Mon, 21 Jan 2008 10:04:35 +0100 | |
changeset 5883 | a893610f6f0c |
parent 5521 | 03496d4fa509 |
child 5528 | 6ffca2bf23da |
permissions | -rw-r--r-- |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1 |
# darcs support for the convert extension |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
2 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 |
from common import NoRepo, commit, converter_source |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 |
from mercurial.i18n import _ |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 |
from mercurial import util |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
6 |
import os, shutil, tempfile |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
7 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
8 |
# The naming drift of ElementTree is fun! |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
9 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
10 |
try: from xml.etree.cElementTree import ElementTree |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 |
except ImportError: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
12 |
try: from xml.etree.ElementTree import ElementTree |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 |
except ImportError: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
14 |
try: from elementtree.cElementTree import ElementTree |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
15 |
except ImportError: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 |
try: from elementtree.ElementTree import ElementTree |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
17 |
except ImportError: ElementTree = None |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
18 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 |
class darcs_source(converter_source): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
21 |
def __init__(self, ui, path, rev=None): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
22 |
super(darcs_source, self).__init__(ui, path, rev=rev) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
23 |
|
5520
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5481
diff
changeset
|
24 |
# check for _darcs, ElementTree, _darcs/inventory so that we can |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5481
diff
changeset
|
25 |
# easily skip test-convert-darcs if ElementTree is not around |
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5481
diff
changeset
|
26 |
if not os.path.exists(os.path.join(path, '_darcs')): |
5521
03496d4fa509
convert: display all errors if we couldn't open the source repo
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5520
diff
changeset
|
27 |
raise NoRepo("%s does not look like a darcs repo" % path) |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
28 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
29 |
if ElementTree is None: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
30 |
raise util.Abort(_("Python ElementTree module is not available")) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
31 |
|
5520
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5481
diff
changeset
|
32 |
if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): |
5521
03496d4fa509
convert: display all errors if we couldn't open the source repo
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5520
diff
changeset
|
33 |
raise NoRepo("%s does not look like a darcs repo" % path) |
5520
cc3af86ab6fe
test-convert-darcs: skip if we can't find the elementtree module
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5481
diff
changeset
|
34 |
|
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
35 |
self.path = os.path.realpath(path) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
36 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
37 |
self.lastrev = None |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
38 |
self.changes = {} |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
39 |
self.parents = {} |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
40 |
self.tags = {} |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
41 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
42 |
def before(self): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
43 |
self.tmppath = tempfile.mkdtemp( |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
44 |
prefix='convert-' + os.path.basename(self.path) + '-') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
45 |
output, status = self.run('init', repodir=self.tmppath) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
46 |
self.checkexit(status) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
47 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
48 |
tree = self.xml('changes', '--xml-output', '--summary') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
49 |
tagname = None |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
50 |
child = None |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
51 |
for elt in tree.findall('patch'): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
52 |
node = elt.get('hash') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
53 |
name = elt.findtext('name', '') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
54 |
if name.startswith('TAG '): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
55 |
tagname = name[4:].strip() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
56 |
elif tagname is not None: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
57 |
self.tags[tagname] = node |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
58 |
tagname = None |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
59 |
self.changes[node] = elt |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
60 |
self.parents[child] = [node] |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
61 |
child = node |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
62 |
self.parents[child] = [] |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
63 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
64 |
def after(self): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
65 |
self.ui.debug('cleaning up %s\n' % self.tmppath) |
5362
4ad2a18aff42
convert: fix a few residual bugs in darcs importer
Bryan O'Sullivan <bos@serpentine.com>
parents:
5359
diff
changeset
|
66 |
shutil.rmtree(self.tmppath, ignore_errors=True) |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
67 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
68 |
def _run(self, cmd, *args, **kwargs): |
5411
d5df426bd68a
convert: fix darcs_source._run() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5362
diff
changeset
|
69 |
cmdline = ['darcs', cmd, '--repodir', kwargs.get('repodir', self.path)] |
d5df426bd68a
convert: fix darcs_source._run() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5362
diff
changeset
|
70 |
cmdline += args |
d5df426bd68a
convert: fix darcs_source._run() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5362
diff
changeset
|
71 |
cmdline = [util.shellquote(arg) for arg in cmdline] |
d5df426bd68a
convert: fix darcs_source._run() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5362
diff
changeset
|
72 |
cmdline += ['<', util.nulldev] |
5481
003d1f174fe1
Fix Windows os.popen bug with interleaved stdout/stderr output
Patrick Mezard <pmezard@gmail.com>
parents:
5412
diff
changeset
|
73 |
cmdline = ' '.join(cmdline) |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
74 |
self.ui.debug(cmdline, '\n') |
5481
003d1f174fe1
Fix Windows os.popen bug with interleaved stdout/stderr output
Patrick Mezard <pmezard@gmail.com>
parents:
5412
diff
changeset
|
75 |
return util.popen(cmdline) |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
76 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
77 |
def run(self, cmd, *args, **kwargs): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
78 |
fp = self._run(cmd, *args, **kwargs) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
79 |
output = fp.read() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
80 |
return output, fp.close() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
81 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
82 |
def checkexit(self, status, output=''): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
83 |
if status: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
84 |
if output: |
5362
4ad2a18aff42
convert: fix a few residual bugs in darcs importer
Bryan O'Sullivan <bos@serpentine.com>
parents:
5359
diff
changeset
|
85 |
self.ui.warn(_('darcs error:\n')) |
4ad2a18aff42
convert: fix a few residual bugs in darcs importer
Bryan O'Sullivan <bos@serpentine.com>
parents:
5359
diff
changeset
|
86 |
self.ui.warn(output) |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
87 |
msg = util.explain_exit(status)[0] |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
88 |
raise util.Abort(_('darcs %s') % msg) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
89 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
90 |
def xml(self, cmd, *opts): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
91 |
etree = ElementTree() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
92 |
fp = self._run(cmd, *opts) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
93 |
etree.parse(fp) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
94 |
self.checkexit(fp.close()) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
95 |
return etree.getroot() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
96 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
97 |
def getheads(self): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
98 |
return self.parents[None] |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
99 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
100 |
def getcommit(self, rev): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
101 |
elt = self.changes[rev] |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
102 |
date = util.strdate(elt.get('local_date'), '%a %b %d %H:%M:%S %Z %Y') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
103 |
desc = elt.findtext('name') + '\n' + elt.findtext('comment', '') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
104 |
return commit(author=elt.get('author'), date=util.datestr(date), |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
105 |
desc=desc.strip(), parents=self.parents[rev]) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
106 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
107 |
def pull(self, rev): |
5412
fbf40ad5a8c2
convert: fix darcs_source.pull() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5411
diff
changeset
|
108 |
output, status = self.run('pull', self.path, '--all', |
fbf40ad5a8c2
convert: fix darcs_source.pull() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5411
diff
changeset
|
109 |
'--match', 'hash %s' % rev, |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
110 |
'--no-test', '--no-posthook', |
5412
fbf40ad5a8c2
convert: fix darcs_source.pull() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5411
diff
changeset
|
111 |
'--external-merge', '/bin/false', |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
112 |
repodir=self.tmppath) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
113 |
if status: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
114 |
if output.find('We have conflicts in') == -1: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
115 |
self.checkexit(status, output) |
5412
fbf40ad5a8c2
convert: fix darcs_source.pull() under windows
Patrick Mezard <pmezard@gmail.com>
parents:
5411
diff
changeset
|
116 |
output, status = self.run('revert', '--all', repodir=self.tmppath) |
5359
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
117 |
self.checkexit(status, output) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
118 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
119 |
def getchanges(self, rev): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
120 |
self.pull(rev) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
121 |
copies = {} |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
122 |
changes = [] |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
123 |
for elt in self.changes[rev].find('summary').getchildren(): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
124 |
if elt.tag in ('add_directory', 'remove_directory'): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
125 |
continue |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
126 |
if elt.tag == 'move': |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
127 |
changes.append((elt.get('from'), rev)) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
128 |
copies[elt.get('from')] = elt.get('to') |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
129 |
else: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
130 |
changes.append((elt.text.strip(), rev)) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
131 |
changes.sort() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
132 |
self.lastrev = rev |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
133 |
return changes, copies |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
134 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
135 |
def getfile(self, name, rev): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
136 |
if rev != self.lastrev: |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
137 |
raise util.Abort(_('internal calling inconsistency')) |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
138 |
return open(os.path.join(self.tmppath, name), 'rb').read() |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
139 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
140 |
def getmode(self, name, rev): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
141 |
mode = os.lstat(os.path.join(self.tmppath, name)).st_mode |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
142 |
return (mode & 0111) and 'x' or '' |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
143 |
|
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
144 |
def gettags(self): |
6b6104430964
convert: support darcs as a source repo
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
145 |
return self.tags |