Mercurial > hg > hg-fastimport
comparison hgfastimport/hgimport.py @ 68:47bc97e1c46f
Drop support for Mercurial <= 1.5.
It doesn't work, and who cares anymore?
| author | Greg Ward <greg@gerg.ca> |
|---|---|
| date | Sun, 26 Jul 2015 14:38:49 -0400 |
| parents | ae32828c68d7 |
| children | 5dc3ab8142d5 |
comparison
equal
deleted
inserted
replaced
| 67:d88ce26e0946 | 68:47bc97e1c46f |
|---|---|
| 27 | 27 |
| 28 from hgext.convert import common, hg as converthg | 28 from hgext.convert import common, hg as converthg |
| 29 | 29 |
| 30 from fastimport import processor, parser | 30 from fastimport import processor, parser |
| 31 | 31 |
| 32 # convertor source objects had a getmode() method up to Mercurial 1.5, | |
| 33 # but in 1.6 it was merged with getfile() | |
| 34 HAVE_GETMODE = hasattr(converthg.mercurial_source, 'getmode') | |
| 35 | 32 |
| 36 class fastimport_source(common.converter_source): | 33 class fastimport_source(common.converter_source): |
| 37 """Interface between the fastimport processor below and Mercurial's | 34 """Interface between the fastimport processor below and Mercurial's |
| 38 normal conversion infrastructure. | 35 normal conversion infrastructure. |
| 39 """ | 36 """ |
| 57 allheads = [] | 54 allheads = [] |
| 58 for branchheads in self.processor.branchmap.values(): | 55 for branchheads in self.processor.branchmap.values(): |
| 59 allheads.extend(branchheads) | 56 allheads.extend(branchheads) |
| 60 return allheads | 57 return allheads |
| 61 | 58 |
| 62 # Mercurial <= 1.5 | 59 def getfile(self, name, fileid): |
| 63 if HAVE_GETMODE: | 60 if fileid is None: # deleted file |
| 64 def getfile(self, name, fileid): | 61 raise IOError |
| 65 """Return file contents as a string. rev is the identifier returned | 62 return (self.processor.getblob(fileid), |
| 66 by a previous call to getchanges(). | 63 self.processor.getmode(name, fileid)) |
| 67 """ | |
| 68 if fileid is None: # deleted file | |
| 69 raise IOError | |
| 70 return self.processor.getblob(fileid) | |
| 71 | |
| 72 def getmode(self, name, fileid): | |
| 73 """Return file mode, eg. '', 'x', or 'l'. rev is the identifier | |
| 74 returned by a previous call to getchanges(). | |
| 75 """ | |
| 76 return self.processor.getmode(name, fileid) | |
| 77 | |
| 78 # Mercurial >= 1.6 | |
| 79 else: | |
| 80 def getfile(self, name, fileid): | |
| 81 if fileid is None: # deleted file | |
| 82 raise IOError | |
| 83 return (self.processor.getblob(fileid), | |
| 84 self.processor.getmode(name, fileid)) | |
| 85 | 64 |
| 86 def getchanges(self, commitid): | 65 def getchanges(self, commitid): |
| 87 """Returns a tuple of (files, copies). | 66 """Returns a tuple of (files, copies). |
| 88 | 67 |
| 89 files is a sorted list of (filename, id) tuples for all files | 68 files is a sorted list of (filename, id) tuples for all files |
