##// END OF EJS Templates
mercurial_source: add --filemap support
Alexis S. L. Carvalho -
r5379:d3e51dc8 default
parent child Browse files
Show More
@@ -0,0 +1,124 b''
1 #!/bin/sh
2
3 HGMERGE=true; export HGMERGE
4
5 echo '[extensions]' >> $HGRCPATH
6 echo 'hgext.graphlog =' >> $HGRCPATH
7 echo 'hgext.convert =' >> $HGRCPATH
8
9 glog()
10 {
11 hg glog --template '#rev# "#desc#" files: #files#\n' "$@"
12 }
13
14 hg init source
15 cd source
16
17 echo foo > foo
18 echo baz > baz
19 mkdir dir
20 echo dir/file >> dir/file
21 echo dir/file2 >> dir/file2
22 hg ci -d '0 0' -qAm '0: add foo baz dir/'
23
24 echo bar > bar
25 echo quux > quux
26 hg copy foo copied
27 hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied'
28
29 echo >> foo
30 hg ci -d '2 0' -m '2: change foo'
31
32 hg up -qC 1
33 echo >> bar
34 echo >> quux
35 hg ci -d '3 0' -m '3: change bar quux'
36
37 hg up -qC 2
38 hg merge -qr 3
39 echo >> bar
40 echo >> baz
41 hg ci -d '4 0' -m '4: first merge; change bar baz'
42
43 echo >> bar
44 echo 1 >> baz
45 echo >> quux
46 hg ci -d '5 0' -m '5: change bar baz quux'
47
48 hg up -qC 4
49 echo >> foo
50 echo 2 >> baz
51 hg ci -d '6 0' -m '6: change foo baz'
52
53 hg up -qC 5
54 hg merge -qr 6
55 echo >> bar
56 hg ci -d '7 0' -m '7: second merge; change bar'
57
58 echo >> foo
59 hg ci -m '8: change foo'
60
61 glog
62
63 echo '% final file versions in this repo:'
64 hg manifest --debug
65 hg debugrename copied
66 echo
67
68 cd ..
69
70 splitrepo()
71 {
72 msg="$1"
73 files="$2"
74 opts=$3
75 echo "% $files: $msg"
76 prefix=`echo "$files" | sed -e 's/ /-/g'`
77 fmap="$prefix.fmap"
78 repo="$prefix.repo"
79 for i in $files; do
80 echo "include $i" >> "$fmap"
81 done
82 hg -q convert $opts --filemap "$fmap" --datesort source "$repo"
83 glog -R "$repo"
84 hg -R "$repo" manifest --debug
85 }
86
87 splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo
88
89 splitrepo 'merges are not merges anymore' bar
90
91 splitrepo '1st merge is not a merge anymore; 2nd still is' baz
92
93 splitrepo 'we add additional merges when they are interesting' 'foo quux'
94
95 splitrepo 'partial conversion' 'bar quux' '-r 3'
96 splitrepo 'complete the partial conversion' 'bar quux'
97
98 rm -r foo.repo
99 splitrepo 'partial conversion' 'foo' '-r 3'
100 splitrepo 'complete the partial conversion' 'foo'
101
102 splitrepo 'copied file; source not included in new repo' copied
103 hg --cwd copied.repo debugrename copied
104
105 splitrepo 'copied file; source included in new repo' 'foo copied'
106 hg --cwd foo-copied.repo debugrename copied
107
108 cat > renames.fmap <<EOF
109 include dir
110 exclude dir/file2
111 rename dir dir2
112 include foo
113 include copied
114 rename foo foo2
115 rename copied copied2
116 EOF
117 hg -q convert --filemap renames.fmap --datesort source renames.repo
118 glog -R renames.repo
119 hg -R renames.repo manifest --debug
120 hg --cwd renames.repo debugrename copied2
121 echo 'copied:'
122 hg --cwd source cat copied
123 echo 'copied2:'
124 hg --cwd renames.repo cat copied2
@@ -0,0 +1,154 b''
1 @ 8 "8: change foo" files: foo
2 |
3 o 7 "7: second merge; change bar" files: bar baz
4 |\
5 | o 6 "6: change foo baz" files: baz foo
6 | |
7 o | 5 "5: change bar baz quux" files: bar baz quux
8 |/
9 o 4 "4: first merge; change bar baz" files: bar baz
10 |\
11 | o 3 "3: change bar quux" files: bar quux
12 | |
13 o | 2 "2: change foo" files: foo
14 |/
15 o 1 "1: add bar quux; copy foo to copied" files: bar copied quux
16 |
17 o 0 "0: add foo baz dir/" files: baz dir/file dir/file2 foo
18
19 % final file versions in this repo:
20 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
21 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz
22 6ca237634e1f6bee1b6db94292fb44f092a25842 644 copied
23 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir/file
24 75e6d3f8328f5f6ace6bf10b98df793416a09dca 644 dir/file2
25 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
26 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
27 copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
28
29 % foo: skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd
30 o 3 "8: change foo" files: foo
31 |
32 o 2 "6: change foo baz" files: foo
33 |
34 o 1 "2: change foo" files: foo
35 |
36 o 0 "0: add foo baz dir/" files: foo
37
38 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
39 % bar: merges are not merges anymore
40 o 4 "7: second merge; change bar" files: bar
41 |
42 o 3 "5: change bar baz quux" files: bar
43 |
44 o 2 "4: first merge; change bar baz" files: bar
45 |
46 o 1 "3: change bar quux" files: bar
47 |
48 o 0 "1: add bar quux; copy foo to copied" files: bar
49
50 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
51 % baz: 1st merge is not a merge anymore; 2nd still is
52 o 4 "7: second merge; change bar" files: baz
53 |\
54 | o 3 "6: change foo baz" files: baz
55 | |
56 o | 2 "5: change bar baz quux" files: baz
57 |/
58 o 1 "4: first merge; change bar baz" files: baz
59 |
60 o 0 "0: add foo baz dir/" files: baz
61
62 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz
63 % foo quux: we add additional merges when they are interesting
64 o 8 "8: change foo" files: foo
65 |
66 o 7 "7: second merge; change bar" files:
67 |\
68 | o 6 "6: change foo baz" files: foo
69 | |
70 o | 5 "5: change bar baz quux" files: quux
71 |/
72 o 4 "4: first merge; change bar baz" files:
73 |\
74 | o 3 "3: change bar quux" files: quux
75 | |
76 o | 2 "2: change foo" files: foo
77 |/
78 o 1 "1: add bar quux; copy foo to copied" files: quux
79 |
80 o 0 "0: add foo baz dir/" files: foo
81
82 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
83 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
84 % bar quux: partial conversion
85 o 1 "3: change bar quux" files: bar quux
86 |
87 o 0 "1: add bar quux; copy foo to copied" files: bar quux
88
89 b79105bedc55102f394e90a789c9c380117c1b4a 644 bar
90 db0421cc6b685a458c8d86c7d5c004f94429ea23 644 quux
91 % bar quux: complete the partial conversion
92 o 4 "7: second merge; change bar" files: bar
93 |
94 o 3 "5: change bar baz quux" files: bar quux
95 |
96 o 2 "4: first merge; change bar baz" files: bar
97 |
98 o 1 "3: change bar quux" files: bar quux
99 |
100 o 0 "1: add bar quux; copy foo to copied" files: bar quux
101
102 9463f52fe115e377cf2878d4fc548117211063f2 644 bar
103 bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux
104 % foo: partial conversion
105 o 0 "0: add foo baz dir/" files: foo
106
107 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
108 % foo: complete the partial conversion
109 o 3 "8: change foo" files: foo
110 |
111 o 2 "6: change foo baz" files: foo
112 |
113 o 1 "2: change foo" files: foo
114 |
115 o 0 "0: add foo baz dir/" files: foo
116
117 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
118 % copied: copied file; source not included in new repo
119 o 0 "1: add bar quux; copy foo to copied" files: copied
120
121 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 copied
122 copied not renamed
123 % foo copied: copied file; source included in new repo
124 o 4 "8: change foo" files: foo
125 |
126 o 3 "6: change foo baz" files: foo
127 |
128 o 2 "2: change foo" files: foo
129 |
130 o 1 "1: add bar quux; copy foo to copied" files: copied
131 |
132 o 0 "0: add foo baz dir/" files: foo
133
134 6ca237634e1f6bee1b6db94292fb44f092a25842 644 copied
135 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo
136 copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
137 o 4 "8: change foo" files: foo2
138 |
139 o 3 "6: change foo baz" files: foo2
140 |
141 o 2 "2: change foo" files: foo2
142 |
143 o 1 "1: add bar quux; copy foo to copied" files: copied2
144 |
145 o 0 "0: add foo baz dir/" files: dir2/file foo2
146
147 e5e3d520be9be45937d0b06b004fadcd6c221fa2 644 copied2
148 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir2/file
149 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo2
150 copied2 renamed from foo2:2ed2a3912a0b24502043eae84ee4b279c18b90dd
151 copied:
152 foo
153 copied2:
154 foo
@@ -1,228 +1,243 b''
1 # hg backend for convert extension
1 # hg backend for convert extension
2
2
3 # Note for hg->hg conversion: Old versions of Mercurial didn't trim
3 # Note for hg->hg conversion: Old versions of Mercurial didn't trim
4 # the whitespace from the ends of commit messages, but new versions
4 # the whitespace from the ends of commit messages, but new versions
5 # do. Changesets created by those older versions, then converted, may
5 # do. Changesets created by those older versions, then converted, may
6 # thus have different hashes for changesets that are otherwise
6 # thus have different hashes for changesets that are otherwise
7 # identical.
7 # identical.
8
8
9
9
10 import os, time
10 import os, time
11 from mercurial.i18n import _
11 from mercurial.i18n import _
12 from mercurial.node import *
12 from mercurial.node import *
13 from mercurial import hg, lock, revlog, util
13 from mercurial import hg, lock, revlog, util
14
14
15 from common import NoRepo, commit, converter_source, converter_sink
15 from common import NoRepo, commit, converter_source, converter_sink
16
16
17 class mercurial_sink(converter_sink):
17 class mercurial_sink(converter_sink):
18 def __init__(self, ui, path):
18 def __init__(self, ui, path):
19 self.path = path
19 self.path = path
20 self.ui = ui
20 self.ui = ui
21 self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
21 self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
22 self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
22 self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
23 self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
23 self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
24 self.lastbranch = None
24 self.lastbranch = None
25 try:
25 try:
26 self.repo = hg.repository(self.ui, path)
26 self.repo = hg.repository(self.ui, path)
27 except:
27 except:
28 raise NoRepo("could not open hg repo %s as sink" % path)
28 raise NoRepo("could not open hg repo %s as sink" % path)
29 self.lock = None
29 self.lock = None
30 self.wlock = None
30 self.wlock = None
31 self.filemapmode = False
31 self.filemapmode = False
32
32
33 def before(self):
33 def before(self):
34 self.wlock = self.repo.wlock()
34 self.wlock = self.repo.wlock()
35 self.lock = self.repo.lock()
35 self.lock = self.repo.lock()
36 self.repo.dirstate.clear()
36 self.repo.dirstate.clear()
37
37
38 def after(self):
38 def after(self):
39 self.repo.dirstate.invalidate()
39 self.repo.dirstate.invalidate()
40 self.lock = None
40 self.lock = None
41 self.wlock = None
41 self.wlock = None
42
42
43 def revmapfile(self):
43 def revmapfile(self):
44 return os.path.join(self.path, ".hg", "shamap")
44 return os.path.join(self.path, ".hg", "shamap")
45
45
46 def authorfile(self):
46 def authorfile(self):
47 return os.path.join(self.path, ".hg", "authormap")
47 return os.path.join(self.path, ".hg", "authormap")
48
48
49 def getheads(self):
49 def getheads(self):
50 h = self.repo.changelog.heads()
50 h = self.repo.changelog.heads()
51 return [ hex(x) for x in h ]
51 return [ hex(x) for x in h ]
52
52
53 def putfile(self, f, e, data):
53 def putfile(self, f, e, data):
54 self.repo.wwrite(f, data, e)
54 self.repo.wwrite(f, data, e)
55 if f not in self.repo.dirstate:
55 if f not in self.repo.dirstate:
56 self.repo.dirstate.normallookup(f)
56 self.repo.dirstate.normallookup(f)
57
57
58 def copyfile(self, source, dest):
58 def copyfile(self, source, dest):
59 self.repo.copy(source, dest)
59 self.repo.copy(source, dest)
60
60
61 def delfile(self, f):
61 def delfile(self, f):
62 try:
62 try:
63 util.unlink(self.repo.wjoin(f))
63 util.unlink(self.repo.wjoin(f))
64 #self.repo.remove([f])
64 #self.repo.remove([f])
65 except OSError:
65 except OSError:
66 pass
66 pass
67
67
68 def setbranch(self, branch, pbranch, parents):
68 def setbranch(self, branch, pbranch, parents):
69 if (not self.clonebranches) or (branch == self.lastbranch):
69 if (not self.clonebranches) or (branch == self.lastbranch):
70 return
70 return
71
71
72 self.lastbranch = branch
72 self.lastbranch = branch
73 self.after()
73 self.after()
74 if not branch:
74 if not branch:
75 branch = 'default'
75 branch = 'default'
76 if not pbranch:
76 if not pbranch:
77 pbranch = 'default'
77 pbranch = 'default'
78
78
79 branchpath = os.path.join(self.path, branch)
79 branchpath = os.path.join(self.path, branch)
80 try:
80 try:
81 self.repo = hg.repository(self.ui, branchpath)
81 self.repo = hg.repository(self.ui, branchpath)
82 except:
82 except:
83 if not parents:
83 if not parents:
84 self.repo = hg.repository(self.ui, branchpath, create=True)
84 self.repo = hg.repository(self.ui, branchpath, create=True)
85 else:
85 else:
86 self.ui.note(_('cloning branch %s to %s\n') % (pbranch, branch))
86 self.ui.note(_('cloning branch %s to %s\n') % (pbranch, branch))
87 hg.clone(self.ui, os.path.join(self.path, pbranch),
87 hg.clone(self.ui, os.path.join(self.path, pbranch),
88 branchpath, rev=parents, update=False,
88 branchpath, rev=parents, update=False,
89 stream=True)
89 stream=True)
90 self.repo = hg.repository(self.ui, branchpath)
90 self.repo = hg.repository(self.ui, branchpath)
91
91
92 def putcommit(self, files, parents, commit):
92 def putcommit(self, files, parents, commit):
93 seen = {}
93 seen = {}
94 pl = []
94 pl = []
95 for p in parents:
95 for p in parents:
96 if p not in seen:
96 if p not in seen:
97 pl.append(p)
97 pl.append(p)
98 seen[p] = 1
98 seen[p] = 1
99 parents = pl
99 parents = pl
100 nparents = len(parents)
100 nparents = len(parents)
101 if self.filemapmode and nparents == 1:
101 if self.filemapmode and nparents == 1:
102 m1node = self.repo.changelog.read(bin(parents[0]))[0]
102 m1node = self.repo.changelog.read(bin(parents[0]))[0]
103 parent = parents[0]
103 parent = parents[0]
104
104
105 if len(parents) < 2: parents.append("0" * 40)
105 if len(parents) < 2: parents.append("0" * 40)
106 if len(parents) < 2: parents.append("0" * 40)
106 if len(parents) < 2: parents.append("0" * 40)
107 p2 = parents.pop(0)
107 p2 = parents.pop(0)
108
108
109 text = commit.desc
109 text = commit.desc
110 extra = {}
110 extra = {}
111 if self.branchnames and commit.branch:
111 if self.branchnames and commit.branch:
112 extra['branch'] = commit.branch
112 extra['branch'] = commit.branch
113 if commit.rev:
113 if commit.rev:
114 extra['convert_revision'] = commit.rev
114 extra['convert_revision'] = commit.rev
115
115
116 while parents:
116 while parents:
117 p1 = p2
117 p1 = p2
118 p2 = parents.pop(0)
118 p2 = parents.pop(0)
119 a = self.repo.rawcommit(files, text, commit.author, commit.date,
119 a = self.repo.rawcommit(files, text, commit.author, commit.date,
120 bin(p1), bin(p2), extra=extra)
120 bin(p1), bin(p2), extra=extra)
121 self.repo.dirstate.clear()
121 self.repo.dirstate.clear()
122 text = "(octopus merge fixup)\n"
122 text = "(octopus merge fixup)\n"
123 p2 = hg.hex(self.repo.changelog.tip())
123 p2 = hg.hex(self.repo.changelog.tip())
124
124
125 if self.filemapmode and nparents == 1:
125 if self.filemapmode and nparents == 1:
126 man = self.repo.manifest
126 man = self.repo.manifest
127 mnode = self.repo.changelog.read(bin(p2))[0]
127 mnode = self.repo.changelog.read(bin(p2))[0]
128 if not man.cmp(m1node, man.revision(mnode)):
128 if not man.cmp(m1node, man.revision(mnode)):
129 self.repo.rollback()
129 self.repo.rollback()
130 self.repo.dirstate.clear()
130 self.repo.dirstate.clear()
131 return parent
131 return parent
132 return p2
132 return p2
133
133
134 def puttags(self, tags):
134 def puttags(self, tags):
135 try:
135 try:
136 old = self.repo.wfile(".hgtags").read()
136 old = self.repo.wfile(".hgtags").read()
137 oldlines = old.splitlines(1)
137 oldlines = old.splitlines(1)
138 oldlines.sort()
138 oldlines.sort()
139 except:
139 except:
140 oldlines = []
140 oldlines = []
141
141
142 k = tags.keys()
142 k = tags.keys()
143 k.sort()
143 k.sort()
144 newlines = []
144 newlines = []
145 for tag in k:
145 for tag in k:
146 newlines.append("%s %s\n" % (tags[tag], tag))
146 newlines.append("%s %s\n" % (tags[tag], tag))
147
147
148 newlines.sort()
148 newlines.sort()
149
149
150 if newlines != oldlines:
150 if newlines != oldlines:
151 self.ui.status("updating tags\n")
151 self.ui.status("updating tags\n")
152 f = self.repo.wfile(".hgtags", "w")
152 f = self.repo.wfile(".hgtags", "w")
153 f.write("".join(newlines))
153 f.write("".join(newlines))
154 f.close()
154 f.close()
155 if not oldlines: self.repo.add([".hgtags"])
155 if not oldlines: self.repo.add([".hgtags"])
156 date = "%s 0" % int(time.mktime(time.gmtime()))
156 date = "%s 0" % int(time.mktime(time.gmtime()))
157 extra = {}
157 extra = {}
158 if self.tagsbranch != 'default':
158 if self.tagsbranch != 'default':
159 extra['branch'] = self.tagsbranch
159 extra['branch'] = self.tagsbranch
160 try:
160 try:
161 tagparent = self.repo.changectx(self.tagsbranch).node()
161 tagparent = self.repo.changectx(self.tagsbranch).node()
162 except hg.RepoError, inst:
162 except hg.RepoError, inst:
163 tagparent = nullid
163 tagparent = nullid
164 self.repo.rawcommit([".hgtags"], "update tags", "convert-repo",
164 self.repo.rawcommit([".hgtags"], "update tags", "convert-repo",
165 date, tagparent, nullid)
165 date, tagparent, nullid)
166 return hex(self.repo.changelog.tip())
166 return hex(self.repo.changelog.tip())
167
167
168 def setfilemapmode(self, active):
168 def setfilemapmode(self, active):
169 self.filemapmode = active
169 self.filemapmode = active
170
170
171 class mercurial_source(converter_source):
171 class mercurial_source(converter_source):
172 def __init__(self, ui, path, rev=None):
172 def __init__(self, ui, path, rev=None):
173 converter_source.__init__(self, ui, path, rev)
173 converter_source.__init__(self, ui, path, rev)
174 try:
174 try:
175 self.repo = hg.repository(self.ui, path)
175 self.repo = hg.repository(self.ui, path)
176 except:
176 except:
177 raise NoRepo("could not open hg repo %s as source" % path)
177 raise NoRepo("could not open hg repo %s as source" % path)
178 self.lastrev = None
178 self.lastrev = None
179 self.lastctx = None
179 self.lastctx = None
180 self._changescache = None
180
181
181 def changectx(self, rev):
182 def changectx(self, rev):
182 if self.lastrev != rev:
183 if self.lastrev != rev:
183 self.lastctx = self.repo.changectx(rev)
184 self.lastctx = self.repo.changectx(rev)
184 self.lastrev = rev
185 self.lastrev = rev
185 return self.lastctx
186 return self.lastctx
186
187
187 def getheads(self):
188 def getheads(self):
188 if self.rev:
189 if self.rev:
189 return [hex(self.repo.changectx(self.rev).node())]
190 return [hex(self.repo.changectx(self.rev).node())]
190 else:
191 else:
191 return [hex(node) for node in self.repo.heads()]
192 return [hex(node) for node in self.repo.heads()]
192
193
193 def getfile(self, name, rev):
194 def getfile(self, name, rev):
194 try:
195 try:
195 return self.changectx(rev).filectx(name).data()
196 return self.changectx(rev).filectx(name).data()
196 except revlog.LookupError, err:
197 except revlog.LookupError, err:
197 raise IOError(err)
198 raise IOError(err)
198
199
199 def getmode(self, name, rev):
200 def getmode(self, name, rev):
200 m = self.changectx(rev).manifest()
201 m = self.changectx(rev).manifest()
201 return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '')
202 return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '')
202
203
203 def getchanges(self, rev):
204 def getchanges(self, rev):
204 ctx = self.changectx(rev)
205 ctx = self.changectx(rev)
205 m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3]
206 if self._changescache and self._changescache[0] == rev:
207 m, a, r = self._changescache[1]
208 else:
209 m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3]
206 changes = [(name, rev) for name in m + a + r]
210 changes = [(name, rev) for name in m + a + r]
207 changes.sort()
211 changes.sort()
208 return (changes, self.getcopies(ctx, m + a))
212 return (changes, self.getcopies(ctx, m + a))
209
213
210 def getcopies(self, ctx, files):
214 def getcopies(self, ctx, files):
211 copies = {}
215 copies = {}
212 for name in files:
216 for name in files:
213 try:
217 try:
214 copies[name] = ctx.filectx(name).renamed()[0]
218 copies[name] = ctx.filectx(name).renamed()[0]
215 except TypeError:
219 except TypeError:
216 pass
220 pass
217 return copies
221 return copies
218
222
219 def getcommit(self, rev):
223 def getcommit(self, rev):
220 ctx = self.changectx(rev)
224 ctx = self.changectx(rev)
221 parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid]
225 parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid]
222 return commit(author=ctx.user(), date=util.datestr(ctx.date()),
226 return commit(author=ctx.user(), date=util.datestr(ctx.date()),
223 desc=ctx.description(), parents=parents,
227 desc=ctx.description(), parents=parents,
224 branch=ctx.branch())
228 branch=ctx.branch())
225
229
226 def gettags(self):
230 def gettags(self):
227 tags = [t for t in self.repo.tagslist() if t[0] != 'tip']
231 tags = [t for t in self.repo.tagslist() if t[0] != 'tip']
228 return dict([(name, hex(node)) for name, node in tags])
232 return dict([(name, hex(node)) for name, node in tags])
233
234 def getchangedfiles(self, rev, i):
235 ctx = self.changectx(rev)
236 i = i or 0
237 changes = self.repo.status(ctx.parents()[i].node(), ctx.node())[:3]
238
239 if i == 0:
240 self._changescache = (rev, changes)
241
242 return changes[0] + changes[1] + changes[2]
243
General Comments 0
You need to be logged in to leave comments. Login now