##// END OF EJS Templates
merge with crew-stable
Thomas Arendsen Hein -
r5921:549a7ebe merge default
parent child Browse files
Show More
@@ -53,11 +53,13 b' class convert_cvs(converter_source):'
53 os.chdir(self.path)
53 os.chdir(self.path)
54 id = None
54 id = None
55 state = 0
55 state = 0
56 filerevids = {}
56 for l in util.popen(cmd):
57 for l in util.popen(cmd):
57 if state == 0: # header
58 if state == 0: # header
58 if l.startswith("PatchSet"):
59 if l.startswith("PatchSet"):
59 id = l[9:-2]
60 id = l[9:-2]
60 if maxrev and int(id) > maxrev:
61 if maxrev and int(id) > maxrev:
62 # ignore everything
61 state = 3
63 state = 3
62 elif l.startswith("Date"):
64 elif l.startswith("Date"):
63 date = util.parsedate(l[6:-1], ["%Y/%m/%d %H:%M:%S"])
65 date = util.parsedate(l[6:-1], ["%Y/%m/%d %H:%M:%S"])
@@ -68,7 +70,8 b' class convert_cvs(converter_source):'
68 self.lastbranch[branch] = id
70 self.lastbranch[branch] = id
69 elif l.startswith("Ancestor branch"):
71 elif l.startswith("Ancestor branch"):
70 ancestor = l[17:-1]
72 ancestor = l[17:-1]
71 self.parent[id] = self.lastbranch[ancestor]
73 # figure out the parent later
74 self.parent[id] = None
72 elif l.startswith("Author"):
75 elif l.startswith("Author"):
73 author = self.recode(l[8:-1])
76 author = self.recode(l[8:-1])
74 elif l.startswith("Tag:") or l.startswith("Tags:"):
77 elif l.startswith("Tag:") or l.startswith("Tags:"):
@@ -77,23 +80,36 b' class convert_cvs(converter_source):'
77 if (len(t) > 1) or (t[0] and (t[0] != "(none)")):
80 if (len(t) > 1) or (t[0] and (t[0] != "(none)")):
78 self.tags.update(dict.fromkeys(t, id))
81 self.tags.update(dict.fromkeys(t, id))
79 elif l.startswith("Log:"):
82 elif l.startswith("Log:"):
83 # switch to gathering log
80 state = 1
84 state = 1
81 log = ""
85 log = ""
82 elif state == 1: # log
86 elif state == 1: # log
83 if l == "Members: \n":
87 if l == "Members: \n":
88 # switch to gathering members
84 files = {}
89 files = {}
90 oldrevs = []
85 log = self.recode(log[:-1])
91 log = self.recode(log[:-1])
86 state = 2
92 state = 2
87 else:
93 else:
94 # gather log
88 log += l
95 log += l
89 elif state == 2:
96 elif state == 2: # members
90 if l == "\n": #
97 if l == "\n": # start of next entry
91 state = 0
98 state = 0
92 p = [self.parent[id]]
99 p = [self.parent[id]]
93 if id == "1":
100 if id == "1":
94 p = []
101 p = []
95 if branch == "HEAD":
102 if branch == "HEAD":
96 branch = ""
103 branch = ""
104 if branch and p[0] == None:
105 latest = None
106 # the last changeset that contains a base
107 # file is our parent
108 for r in oldrevs:
109 latest = max(filerevids[r], latest)
110 p = [latest]
111
112 # add current commit to set
97 c = commit(author=author, date=date, parents=p,
113 c = commit(author=author, date=date, parents=p,
98 desc=log, branch=branch)
114 desc=log, branch=branch)
99 self.changeset[id] = c
115 self.changeset[id] = c
@@ -102,9 +118,14 b' class convert_cvs(converter_source):'
102 colon = l.rfind(':')
118 colon = l.rfind(':')
103 file = l[1:colon]
119 file = l[1:colon]
104 rev = l[colon+1:-2]
120 rev = l[colon+1:-2]
105 rev = rev.split("->")[1]
121 oldrev, rev = rev.split("->")
106 files[file] = rev
122 files[file] = rev
123
124 # save some information for identifying branch points
125 oldrevs.append("%s:%s" % (oldrev, file))
126 filerevids["%s:%s" % (rev, file)] = id
107 elif state == 3:
127 elif state == 3:
128 # swallow all input
108 continue
129 continue
109
130
110 self.heads = self.lastbranch.values()
131 self.heads = self.lastbranch.values()
@@ -30,6 +30,8 b' class mercurial_sink(converter_sink):'
30 if os.path.isdir(path) and len(os.listdir(path)) > 0:
30 if os.path.isdir(path) and len(os.listdir(path)) > 0:
31 try:
31 try:
32 self.repo = hg.repository(self.ui, path)
32 self.repo = hg.repository(self.ui, path)
33 if not self.repo.local():
34 raise NoRepo(_('%s is not a local Mercurial repo') % path)
33 except hg.RepoError, err:
35 except hg.RepoError, err:
34 ui.print_exc()
36 ui.print_exc()
35 raise NoRepo(err.args[0])
37 raise NoRepo(err.args[0])
@@ -37,6 +39,8 b' class mercurial_sink(converter_sink):'
37 try:
39 try:
38 ui.status(_('initializing destination %s repository\n') % path)
40 ui.status(_('initializing destination %s repository\n') % path)
39 self.repo = hg.repository(self.ui, path, create=True)
41 self.repo = hg.repository(self.ui, path, create=True)
42 if not self.repo.local():
43 raise NoRepo(_('%s is not a local Mercurial repo') % path)
40 self.created.append(path)
44 self.created.append(path)
41 except hg.RepoError, err:
45 except hg.RepoError, err:
42 ui.print_exc()
46 ui.print_exc()
@@ -646,7 +646,7 b' class svn_source(converter_source):'
646 # '2007-01-04T17:35:00.902377Z'
646 # '2007-01-04T17:35:00.902377Z'
647 date = util.parsedate(date[:19] + " UTC", ["%Y-%m-%dT%H:%M:%S"])
647 date = util.parsedate(date[:19] + " UTC", ["%Y-%m-%dT%H:%M:%S"])
648
648
649 log = message and self.recode(message)
649 log = message and self.recode(message) or ''
650 author = author and self.recode(author) or ''
650 author = author and self.recode(author) or ''
651 try:
651 try:
652 branch = self.module.split("/")[-1]
652 branch = self.module.split("/")[-1]
@@ -15,7 +15,7 b' platform-specific details from the core.'
15 from i18n import _
15 from i18n import _
16 import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil
16 import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil
17 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
17 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
18 import re, urlparse
18 import urlparse
19
19
20 try:
20 try:
21 set = set
21 set = set
@@ -71,3 +71,25 b' hg convert --filemap filemap src src-fil'
71 cat src-hg/b/c
71 cat src-hg/b/c
72 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
72 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
73
73
74 echo % commit branch
75 cd src
76 cvs -q update -r1.1 b/c
77 cvs -q tag -b branch
78 cvs -q update -r branch
79 echo d >> b/c
80 cvs -q commit -mci2 . | grep '<--' |\
81 sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g'
82 cd ..
83
84 echo % convert again
85 hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
86 cat src-hg/a
87 cat src-hg/b/c
88
89 echo % convert again with --filemap
90 hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g'
91 cat src-hg/b/c
92 hg -R src-filemap log --template '#rev# #desc# files: #files#\n'
93
94 echo "graphlog = " >> $HGRCPATH
95 hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n'
@@ -67,3 +67,43 b' 3 ci1 files: b/c'
67 2 update tags files: .hgtags
67 2 update tags files: .hgtags
68 1 ci0 files: b/c
68 1 ci0 files: b/c
69 0 Initial revision files: b/c
69 0 Initial revision files: b/c
70 % commit branch
71 U b/c
72 T a
73 T b/c
74 checking in src/b/c,v
75 % convert again
76 connecting to cvsrepo
77 scanning source...
78 sorting...
79 converting...
80 0 ci2
81 a
82 a
83 c
84 d
85 % convert again with --filemap
86 connecting to cvsrepo
87 scanning source...
88 sorting...
89 converting...
90 0 ci2
91 c
92 d
93 4 ci2 files: b/c
94 3 ci1 files: b/c
95 2 update tags files: .hgtags
96 1 ci0 files: b/c
97 0 Initial revision files: b/c
98 o 5 (branch) ci2 files: b/c
99 |
100 | o 4 () ci1 files: a b/c
101 | |
102 | o 3 () update tags files: .hgtags
103 | |
104 | o 2 () ci0 files: b/c
105 |/
106 | o 1 (INITIAL) import files:
107 |/
108 o 0 () Initial revision files: a b/c
109
General Comments 0
You need to be logged in to leave comments. Login now