Mercurial > hg
annotate hgext/convert/gnuarch.py @ 6436:856ae126f48c
templates: add coal web theme
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 31 Mar 2008 21:49:36 -0500 |
parents | e75aab656f46 |
children | f67d1468ac50 |
rev | line source |
---|---|
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
1 # GNU Arch support for the convert extension |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
2 |
6212 | 3 from common import NoRepo, commandline, commit, converter_source |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
4 from mercurial.i18n import _ |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
5 from mercurial import util |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
6 import os, shutil, tempfile, stat |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
7 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
8 class gnuarch_source(converter_source, commandline): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
9 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
10 class gnuarch_rev: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
11 def __init__(self, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
12 self.rev = rev |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
13 self.summary = '' |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
14 self.date = None |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
15 self.author = '' |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
16 self.add_files = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
17 self.mod_files = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
18 self.del_files = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
19 self.ren_files = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
20 self.ren_dirs = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
21 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
22 def __init__(self, ui, path, rev=None): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
23 super(gnuarch_source, self).__init__(ui, path, rev=rev) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
24 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
25 if not os.path.exists(os.path.join(path, '{arch}')): |
6078
ebc23d34102f
convert: added gnu arch (baz) tests
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6055
diff
changeset
|
26 raise NoRepo(_("%s does not look like a GNU Arch repo" % path)) |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
27 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
28 # Could use checktool, but we want to check for baz or tla. |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
29 self.execmd = None |
6083
81a8667331e8
convert: detect baz before tla
Patrick Mezard <pmezard@gmail.com>
parents:
6079
diff
changeset
|
30 if util.find_exe('baz'): |
81a8667331e8
convert: detect baz before tla
Patrick Mezard <pmezard@gmail.com>
parents:
6079
diff
changeset
|
31 self.execmd = 'baz' |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
32 else: |
6083
81a8667331e8
convert: detect baz before tla
Patrick Mezard <pmezard@gmail.com>
parents:
6079
diff
changeset
|
33 if util.find_exe('tla'): |
81a8667331e8
convert: detect baz before tla
Patrick Mezard <pmezard@gmail.com>
parents:
6079
diff
changeset
|
34 self.execmd = 'tla' |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
35 else: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
36 raise util.Abort(_('cannot find a GNU Arch tool')) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
37 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
38 commandline.__init__(self, ui, self.execmd) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
39 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
40 self.path = os.path.realpath(path) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
41 self.tmppath = None |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
42 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
43 self.treeversion = None |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
44 self.lastrev = None |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
45 self.changes = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
46 self.parents = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
47 self.tags = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
48 self.modecache = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
49 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
50 def before(self): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
51 if self.execmd == 'tla': |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
52 output = self.run0('tree-version', self.path) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
53 else: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
54 output = self.run0('tree-version', '-d', self.path) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
55 self.treeversion = output.strip() |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
56 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
57 self.ui.status(_('analyzing tree version %s...\n' % self.treeversion)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
58 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
59 # Get name of temporary directory |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
60 version = self.treeversion.split('/') |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
61 self.tmppath = os.path.join(tempfile.gettempdir(), |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
62 'hg-%s' % version[1]) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
63 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
64 # Generate parents dictionary |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
65 child = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
66 output, status = self.runlines('revisions', self.treeversion) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
67 self.checkexit(status, 'archive registered?') |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
68 for l in output: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
69 rev = l.strip() |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
70 self.changes[rev] = self.gnuarch_rev(rev) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
71 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
72 # Read author, date and summary |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
73 catlog = self.runlines0('cat-log', '-d', self.path, rev) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
74 self._parsecatlog(catlog, rev) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
75 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
76 self.parents[rev] = child |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
77 child = [rev] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
78 if rev == self.rev: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
79 break |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
80 self.parents[None] = child |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
81 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
82 def after(self): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
83 self.ui.debug(_('cleaning up %s\n' % self.tmppath)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
84 shutil.rmtree(self.tmppath, ignore_errors=True) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
85 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
86 def getheads(self): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
87 return self.parents[None] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
88 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
89 def getfile(self, name, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
90 if rev != self.lastrev: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
91 raise util.Abort(_('internal calling inconsistency')) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
92 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
93 # Raise IOError if necessary (i.e. deleted files). |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
94 if not os.path.exists(os.path.join(self.tmppath, name)): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
95 raise IOError |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
96 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
97 data, mode = self._getfile(name, rev) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
98 self.modecache[(name, rev)] = mode |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
99 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
100 return data |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
101 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
102 def getmode(self, name, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
103 return self.modecache[(name, rev)] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
104 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
105 def getchanges(self, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
106 self.modecache = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
107 self._update(rev) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
108 changes = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
109 copies = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
110 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
111 for f in self.changes[rev].add_files: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
112 changes.append((f, rev)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
113 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
114 for f in self.changes[rev].mod_files: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
115 changes.append((f, rev)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
116 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
117 for f in self.changes[rev].del_files: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
118 changes.append((f, rev)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
119 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
120 for src in self.changes[rev].ren_files: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
121 to = self.changes[rev].ren_files[src] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
122 changes.append((src, rev)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
123 changes.append((to, rev)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
124 copies[src] = to |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
125 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
126 for src in self.changes[rev].ren_dirs: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
127 to = self.changes[rev].ren_dirs[src] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
128 chgs, cps = self._rendirchanges(src, to); |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
129 changes += [(f, rev) for f in chgs] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
130 for c in cps: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
131 copies[c] = cps[c] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
132 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
133 changes.sort() |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
134 self.lastrev = rev |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
135 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
136 return changes, copies |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
137 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
138 def getcommit(self, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
139 changes = self.changes[rev] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
140 return commit(author = changes.author, date = changes.date, |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
141 desc = changes.summary, parents = self.parents[rev]) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
142 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
143 def gettags(self): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
144 return self.tags |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
145 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
146 def _execute(self, cmd, *args, **kwargs): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
147 cmdline = [self.execmd, cmd] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
148 cmdline += args |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
149 cmdline = [util.shellquote(arg) for arg in cmdline] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
150 cmdline += ['>', util.nulldev, '2>', util.nulldev] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
151 cmdline = util.quotecommand(' '.join(cmdline)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
152 self.ui.debug(cmdline, '\n') |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
153 return os.system(cmdline) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
154 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
155 def _update(self, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
156 if rev == 'base-0': |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
157 # Initialise 'base-0' revision |
6049
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
158 self._obtainrevision(rev) |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
159 else: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
160 self.ui.debug(_('applying revision %s...\n' % rev)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
161 revision = '%s--%s' % (self.treeversion, rev) |
6049
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
162 changeset, status = self.runlines('replay', '-d', self.tmppath, |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
163 revision) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
164 if status: |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
165 # Something went wrong while merging (baz or tla |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
166 # issue?), get latest revision and try from there |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
167 shutil.rmtree(self.tmppath, ignore_errors=True) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
168 self._obtainrevision(rev) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
169 else: |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
170 old_rev = self.parents[rev][0] |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
171 self.ui.debug(_('computing changeset between %s and %s...\n' \ |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
172 % (old_rev, rev))) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
173 rev_a = '%s--%s' % (self.treeversion, old_rev) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
174 rev_b = '%s--%s' % (self.treeversion, rev) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
175 self._parsechangeset(changeset, rev) |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
176 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
177 def _getfile(self, name, rev): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
178 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
179 if stat.S_ISLNK(mode): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
180 data = os.readlink(os.path.join(self.tmppath, name)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
181 mode = mode and 'l' or '' |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
182 else: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
183 data = open(os.path.join(self.tmppath, name), 'rb').read() |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
184 mode = (mode & 0111) and 'x' or '' |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
185 return data, mode |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
186 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
187 def _exclude(self, name): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
188 exclude = [ '{arch}', '.arch-ids', '.arch-inventory' ] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
189 for exc in exclude: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
190 if name.find(exc) != -1: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
191 return True |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
192 return False |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
193 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
194 def _readcontents(self, path): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
195 files = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
196 contents = os.listdir(path) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
197 while len(contents) > 0: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
198 c = contents.pop() |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
199 p = os.path.join(path, c) |
6044
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
200 # os.walk could be used, but here we avoid internal GNU |
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
201 # Arch files and directories, thus saving a lot time. |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
202 if not self._exclude(p): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
203 if os.path.isdir(p): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
204 contents += [os.path.join(c, f) for f in os.listdir(p)] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
205 else: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
206 files.append(c) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
207 return files |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
208 |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
209 def _rendirchanges(self, src, dest): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
210 changes = [] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
211 copies = {} |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
212 files = self._readcontents(os.path.join(self.tmppath, dest)) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
213 for f in files: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
214 s = os.path.join(src, f) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
215 d = os.path.join(dest, f) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
216 changes.append(s) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
217 changes.append(d) |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
218 copies[s] = d |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
219 return changes, copies |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
220 |
6049
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
221 def _obtainrevision(self, rev): |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
222 self.ui.debug(_('obtaining revision %s...\n' % rev)) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
223 revision = '%s--%s' % (self.treeversion, rev) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
224 output = self._execute('get', revision, self.tmppath) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
225 self.checkexit(output) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
226 self.ui.debug(_('analysing revision %s...\n' % rev)) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
227 files = self._readcontents(self.tmppath) |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
228 self.changes[rev].add_files += files |
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
229 |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
230 def _stripbasepath(self, path): |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
231 if path.startswith('./'): |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
232 return path[2:] |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
233 return path |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
234 |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
235 def _parsecatlog(self, data, rev): |
6044
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
236 summary = [] |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
237 for l in data: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
238 l = l.strip() |
6044
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
239 if summary: |
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
240 summary.append(l) |
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
241 elif l.startswith('Summary:'): |
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
242 summary.append(l[len('Summary: '):]) |
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
243 elif l.startswith('Standard-date:'): |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
244 date = l[len('Standard-date: '):] |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
245 strdate = util.strdate(date, '%Y-%m-%d %H:%M:%S') |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
246 self.changes[rev].date = util.datestr(strdate) |
6044
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
247 elif l.startswith('Creator:'): |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
248 self.changes[rev].author = l[len('Creator: '):] |
6044
9360a58a09e6
convert: do not skip some lines in gnu arch summaries
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6037
diff
changeset
|
249 self.changes[rev].summary = '\n'.join(summary) |
6037
dd3267698d84
convert: add full description for gnu arch revisions
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6035
diff
changeset
|
250 |
6049
348132c112cf
convert: improve gnu arch source performance and other fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6044
diff
changeset
|
251 def _parsechangeset(self, data, rev): |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
252 for l in data: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
253 l = l.strip() |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
254 # Added file (ignore added directory) |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
255 if l.startswith('A') and not l.startswith('A/'): |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
256 file = self._stripbasepath(l[1:].strip()) |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
257 if not self._exclude(file): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
258 self.changes[rev].add_files.append(file) |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
259 # Deleted file (ignore deleted directory) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
260 elif l.startswith('D') and not l.startswith('D/'): |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
261 file = self._stripbasepath(l[1:].strip()) |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
262 if not self._exclude(file): |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
263 self.changes[rev].del_files.append(file) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
264 # Modified binary file |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
265 elif l.startswith('Mb'): |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
266 file = self._stripbasepath(l[2:].strip()) |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
267 if not self._exclude(file): |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
268 self.changes[rev].mod_files.append(file) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
269 # Modified link |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
270 elif l.startswith('M->'): |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
271 file = self._stripbasepath(l[3:].strip()) |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
272 if not self._exclude(file): |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
273 self.changes[rev].mod_files.append(file) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
274 # Modified file |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
275 elif l.startswith('M'): |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
276 file = self._stripbasepath(l[1:].strip()) |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
277 if not self._exclude(file): |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
278 self.changes[rev].mod_files.append(file) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
279 # Renamed file (or link) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
280 elif l.startswith('=>'): |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
281 files = l[2:].strip().split(' ') |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
282 if len(files) == 1: |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
283 files = l[2:].strip().split('\t') |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
284 src = self._stripbasepath(files[0]) |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
285 dst = self._stripbasepath(files[1]) |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
286 if not self._exclude(src) and not self._exclude(dst): |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
287 self.changes[rev].ren_files[src] = dst |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
288 # Conversion from file to link or from link to file (modified) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
289 elif l.startswith('ch'): |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
290 file = self._stripbasepath(l[2:].strip()) |
6055
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
291 if not self._exclude(file): |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
292 self.changes[rev].mod_files.append(file) |
a3d8b1f8721d
convert: support binary files, link to files (viceversa) in gnu arch
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6049
diff
changeset
|
293 # Renamed directory |
6035
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
294 elif l.startswith('/>'): |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
295 dirs = l[2:].strip().split(' ') |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
296 if len(dirs) == 1: |
df659eb23360
convert: added GNU Arch source converter
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
diff
changeset
|
297 dirs = l[2:].strip().split('\t') |
6079
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
298 src = self._stripbasepath(dirs[0]) |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
299 dst = self._stripbasepath(dirs[1]) |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
300 if not self._exclude(src) and not self._exclude(dst): |
ea34059b89de
convert: added GNU Arch (tla) tests and related fixes
Aleix Conchillo Flaque <aleix@member.fsf.org>
parents:
6078
diff
changeset
|
301 self.changes[rev].ren_dirs[src] = dst |