Mercurial > hg
comparison hgext/convert/__init__.py @ 4765:b6a1f2c46c6c
convert extension: Add SVN converter
author | Daniel Holth <dholth@fastmail.fm> |
---|---|
date | Sun, 01 Jul 2007 23:56:11 +0200 |
parents | 8e9d3faec270 |
children | 95cbb6b74790 |
comparison
equal
deleted
inserted
replaced
4764:6a16ef0d1c7c | 4765:b6a1f2c46c6c |
---|---|
191 afile.close() | 191 afile.close() |
192 | 192 |
193 def copy(self, rev): | 193 def copy(self, rev): |
194 c = self.commitcache[rev] | 194 c = self.commitcache[rev] |
195 files = self.source.getchanges(rev) | 195 files = self.source.getchanges(rev) |
196 | |
197 do_copies = (hasattr(c, 'copies') and hasattr(self.dest, 'copyfile')) | |
196 | 198 |
197 for f, v in files: | 199 for f, v in files: |
198 try: | 200 try: |
199 data = self.source.getfile(f, v) | 201 data = self.source.getfile(f, v) |
200 except IOError, inst: | 202 except IOError, inst: |
201 self.dest.delfile(f) | 203 self.dest.delfile(f) |
202 else: | 204 else: |
203 e = self.source.getmode(f, v) | 205 e = self.source.getmode(f, v) |
204 self.dest.putfile(f, e, data) | 206 self.dest.putfile(f, e, data) |
207 if do_copies: | |
208 if f in c.copies: | |
209 # Merely marks that a copy happened. | |
210 self.dest.copyfile(c.copies[f], f) | |
211 | |
205 | 212 |
206 r = [self.map[v] for v in c.parents] | 213 r = [self.map[v] for v in c.parents] |
207 f = [f for f, v in files] | 214 f = [f for f, v in files] |
208 newnode = self.dest.putcommit(f, r, c) | 215 newnode = self.dest.putcommit(f, r, c) |
209 self.mapentry(rev, newnode) | 216 self.mapentry(rev, newnode) |
256 '''Convert a foreign SCM repository to a Mercurial one. | 263 '''Convert a foreign SCM repository to a Mercurial one. |
257 | 264 |
258 Accepted source formats: | 265 Accepted source formats: |
259 - GIT | 266 - GIT |
260 - CVS | 267 - CVS |
268 - SVN | |
261 | 269 |
262 Accepted destination formats: | 270 Accepted destination formats: |
263 - Mercurial | 271 - Mercurial |
264 | 272 |
265 If no revision is given, all revisions will be converted. Otherwise, | 273 If no revision is given, all revisions will be converted. Otherwise, |