Show More
@@ -17,7 +17,11 b' class converter_source(object):' | |||||
17 | def __init__(self, ui, path, rev=None): |
|
17 | def __init__(self, ui, path, rev=None): | |
18 | """Initialize conversion source (or raise NoRepo("message") |
|
18 | """Initialize conversion source (or raise NoRepo("message") | |
19 | exception if path is not a valid repository)""" |
|
19 | exception if path is not a valid repository)""" | |
20 | pass |
|
20 | self.ui = ui | |
|
21 | self.path = path | |||
|
22 | self.rev = rev | |||
|
23 | ||||
|
24 | self.encoding = 'utf-8' | |||
21 |
|
25 | |||
22 | def getheads(self): |
|
26 | def getheads(self): | |
23 | """Return a list of this repository's heads""" |
|
27 | """Return a list of this repository's heads""" | |
@@ -48,7 +52,7 b' class converter_source(object):' | |||||
48 |
|
52 | |||
49 | def recode(self, s, encoding=None): |
|
53 | def recode(self, s, encoding=None): | |
50 | if not encoding: |
|
54 | if not encoding: | |
51 |
encoding = |
|
55 | encoding = self.encoding or 'utf-8' | |
52 |
|
56 | |||
53 | try: |
|
57 | try: | |
54 | return s.decode(encoding).encode("utf-8") |
|
58 | return s.decode(encoding).encode("utf-8") |
@@ -9,9 +9,6 b' class convert_cvs(converter_source):' | |||||
9 | def __init__(self, ui, path, rev=None): |
|
9 | def __init__(self, ui, path, rev=None): | |
10 | super(convert_cvs, self).__init__(ui, path, rev=rev) |
|
10 | super(convert_cvs, self).__init__(ui, path, rev=rev) | |
11 |
|
11 | |||
12 | self.path = path |
|
|||
13 | self.ui = ui |
|
|||
14 | self.rev = rev |
|
|||
15 | cvs = os.path.join(path, "CVS") |
|
12 | cvs = os.path.join(path, "CVS") | |
16 | if not os.path.exists(cvs): |
|
13 | if not os.path.exists(cvs): | |
17 | raise NoRepo("couldn't open CVS repo %s" % path) |
|
14 | raise NoRepo("couldn't open CVS repo %s" % path) |
@@ -15,11 +15,7 b' class convert_git(converter_source):' | |||||
15 | path += "/.git" |
|
15 | path += "/.git" | |
16 | if not os.path.exists(path + "/objects"): |
|
16 | if not os.path.exists(path + "/objects"): | |
17 | raise NoRepo("couldn't open GIT repo %s" % path) |
|
17 | raise NoRepo("couldn't open GIT repo %s" % path) | |
18 |
|
||||
19 | self.path = path |
|
18 | self.path = path | |
20 | self.ui = ui |
|
|||
21 | self.rev = rev |
|
|||
22 | self.encoding = 'utf-8' |
|
|||
23 |
|
19 | |||
24 | def getheads(self): |
|
20 | def getheads(self): | |
25 | if not self.rev: |
|
21 | if not self.rev: |
@@ -86,7 +86,6 b' class convert_svn(converter_source):' | |||||
86 | ui.warn(msg) |
|
86 | ui.warn(msg) | |
87 | raise NoRepo(msg) |
|
87 | raise NoRepo(msg) | |
88 |
|
88 | |||
89 | self.ui = ui |
|
|||
90 | self.encoding = locale.getpreferredencoding() |
|
89 | self.encoding = locale.getpreferredencoding() | |
91 | latest = None |
|
90 | latest = None | |
92 | if rev: |
|
91 | if rev: | |
@@ -123,9 +122,9 b' class convert_svn(converter_source):' | |||||
123 |
|
122 | |||
124 | self.last_changed = self.latest(self.module, latest) |
|
123 | self.last_changed = self.latest(self.module, latest) | |
125 |
|
124 | |||
126 | self.head = self.rev(self.last_changed) |
|
125 | self.head = self.revid(self.last_changed) | |
127 |
|
126 | |||
128 | def rev(self, revnum, module=None): |
|
127 | def revid(self, revnum, module=None): | |
129 | if not module: |
|
128 | if not module: | |
130 | module = self.module |
|
129 | module = self.module | |
131 | return (u"svn:%s%s@%s" % (self.uuid, module, revnum)).decode(self.encoding) |
|
130 | return (u"svn:%s%s@%s" % (self.uuid, module, revnum)).decode(self.encoding) | |
@@ -227,7 +226,7 b' class convert_svn(converter_source):' | |||||
227 | copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. |
|
226 | copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. | |
228 | copies = {} |
|
227 | copies = {} | |
229 | entries = [] |
|
228 | entries = [] | |
230 | rev = self.rev(revnum) |
|
229 | rev = self.revid(revnum) | |
231 | parents = [] |
|
230 | parents = [] | |
232 | try: |
|
231 | try: | |
233 | branch = self.module.split("/")[-1] |
|
232 | branch = self.module.split("/")[-1] | |
@@ -245,7 +244,7 b' class convert_svn(converter_source):' | |||||
245 | # ent.copyfrom_rev may not be the actual last revision |
|
244 | # ent.copyfrom_rev may not be the actual last revision | |
246 | prev = self.latest(ent.copyfrom_path, ent.copyfrom_rev) |
|
245 | prev = self.latest(ent.copyfrom_path, ent.copyfrom_rev) | |
247 | self.modulemap[prev] = ent.copyfrom_path |
|
246 | self.modulemap[prev] = ent.copyfrom_path | |
248 | parents = [self.rev(prev, ent.copyfrom_path)] |
|
247 | parents = [self.revid(prev, ent.copyfrom_path)] | |
249 | self.ui.note('found parent of branch %s at %d: %s\n' % \ |
|
248 | self.ui.note('found parent of branch %s at %d: %s\n' % \ | |
250 | (self.module, prev, ent.copyfrom_path)) |
|
249 | (self.module, prev, ent.copyfrom_path)) | |
251 | else: |
|
250 | else: | |
@@ -465,13 +464,13 b' class convert_svn(converter_source):' | |||||
465 | if 'branches' in paths and 'trunk' in paths: |
|
464 | if 'branches' in paths and 'trunk' in paths: | |
466 | self.module += '/trunk' |
|
465 | self.module += '/trunk' | |
467 | lt = self.latest(self.module, self.last_changed) |
|
466 | lt = self.latest(self.module, self.last_changed) | |
468 | self.head = self.rev(lt) |
|
467 | self.head = self.revid(lt) | |
469 | self.heads = [self.head] |
|
468 | self.heads = [self.head] | |
470 | branches = svn.client.ls(rpath + '/branches', optrev, False, self.ctx) |
|
469 | branches = svn.client.ls(rpath + '/branches', optrev, False, self.ctx) | |
471 | for branch in branches.keys(): |
|
470 | for branch in branches.keys(): | |
472 | module = '/branches/' + branch |
|
471 | module = '/branches/' + branch | |
473 | brevnum = self.latest(module, self.last_changed) |
|
472 | brevnum = self.latest(module, self.last_changed) | |
474 | brev = self.rev(brevnum, module) |
|
473 | brev = self.revid(brevnum, module) | |
475 | self.ui.note('found branch %s at %d\n' % (branch, brevnum)) |
|
474 | self.ui.note('found branch %s at %d\n' % (branch, brevnum)) | |
476 | self.heads.append(brev) |
|
475 | self.heads.append(brev) | |
477 | else: |
|
476 | else: | |
@@ -540,7 +539,7 b' class convert_svn(converter_source):' | |||||
540 | source = ent.copyfrom_path |
|
539 | source = ent.copyfrom_path | |
541 | rev = ent.copyfrom_rev |
|
540 | rev = ent.copyfrom_rev | |
542 | tag = path.split('/', 2)[2] |
|
541 | tag = path.split('/', 2)[2] | |
543 | tags[tag] = self.rev(rev, module=source) |
|
542 | tags[tag] = self.revid(rev, module=source) | |
544 |
|
543 | |||
545 | start = self.revnum(self.head) |
|
544 | start = self.revnum(self.head) | |
546 | try: |
|
545 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now