Show More
@@ -1,305 +1,290 | |||
|
1 | 1 | # hg backend for convert extension |
|
2 | 2 | |
|
3 | 3 | # Notes for hg->hg conversion: |
|
4 | 4 | # |
|
5 | 5 | # * Old versions of Mercurial didn't trim the whitespace from the ends |
|
6 | 6 | # of commit messages, but new versions do. Changesets created by |
|
7 | 7 | # those older versions, then converted, may thus have different |
|
8 | 8 | # hashes for changesets that are otherwise identical. |
|
9 | 9 | # |
|
10 | 10 | # * By default, the source revision is stored in the converted |
|
11 | 11 | # revision. This will cause the converted revision to have a |
|
12 | 12 | # different identity than the source. To avoid this, use the |
|
13 | 13 | # following option: "--config convert.hg.saverev=false" |
|
14 | 14 | |
|
15 | 15 | |
|
16 | 16 | import os, time |
|
17 | 17 | from mercurial.i18n import _ |
|
18 | 18 | from mercurial.repo import RepoError |
|
19 | 19 | from mercurial.node import bin, hex, nullid |
|
20 | from mercurial import hg, revlog, util | |
|
20 | from mercurial import hg, revlog, util, context | |
|
21 | 21 | |
|
22 | 22 | from common import NoRepo, commit, converter_source, converter_sink |
|
23 | 23 | |
|
24 | 24 | class mercurial_sink(converter_sink): |
|
25 | 25 | def __init__(self, ui, path): |
|
26 | 26 | converter_sink.__init__(self, ui, path) |
|
27 | 27 | self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True) |
|
28 | 28 | self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False) |
|
29 | 29 | self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default') |
|
30 | 30 | self.lastbranch = None |
|
31 | 31 | if os.path.isdir(path) and len(os.listdir(path)) > 0: |
|
32 | 32 | try: |
|
33 | 33 | self.repo = hg.repository(self.ui, path) |
|
34 | 34 | if not self.repo.local(): |
|
35 | 35 | raise NoRepo(_('%s is not a local Mercurial repo') % path) |
|
36 | 36 | except RepoError, err: |
|
37 | 37 | ui.print_exc() |
|
38 | 38 | raise NoRepo(err.args[0]) |
|
39 | 39 | else: |
|
40 | 40 | try: |
|
41 | 41 | ui.status(_('initializing destination %s repository\n') % path) |
|
42 | 42 | self.repo = hg.repository(self.ui, path, create=True) |
|
43 | 43 | if not self.repo.local(): |
|
44 | 44 | raise NoRepo(_('%s is not a local Mercurial repo') % path) |
|
45 | 45 | self.created.append(path) |
|
46 | 46 | except RepoError, err: |
|
47 | 47 | ui.print_exc() |
|
48 | 48 | raise NoRepo("could not create hg repo %s as sink" % path) |
|
49 | 49 | self.lock = None |
|
50 | 50 | self.wlock = None |
|
51 | 51 | self.filemapmode = False |
|
52 | 52 | |
|
53 | 53 | def before(self): |
|
54 | 54 | self.ui.debug(_('run hg sink pre-conversion action\n')) |
|
55 | 55 | self.wlock = self.repo.wlock() |
|
56 | 56 | self.lock = self.repo.lock() |
|
57 | self.repo.dirstate.clear() | |
|
58 | 57 | |
|
59 | 58 | def after(self): |
|
60 | 59 | self.ui.debug(_('run hg sink post-conversion action\n')) |
|
61 | self.repo.dirstate.invalidate() | |
|
62 | 60 | self.lock = None |
|
63 | 61 | self.wlock = None |
|
64 | 62 | |
|
65 | 63 | def revmapfile(self): |
|
66 | 64 | return os.path.join(self.path, ".hg", "shamap") |
|
67 | 65 | |
|
68 | 66 | def authorfile(self): |
|
69 | 67 | return os.path.join(self.path, ".hg", "authormap") |
|
70 | 68 | |
|
71 | 69 | def getheads(self): |
|
72 | 70 | h = self.repo.changelog.heads() |
|
73 | 71 | return [ hex(x) for x in h ] |
|
74 | 72 | |
|
75 | 73 | def setbranch(self, branch, pbranches): |
|
76 | 74 | if not self.clonebranches: |
|
77 | 75 | return |
|
78 | 76 | |
|
79 | 77 | setbranch = (branch != self.lastbranch) |
|
80 | 78 | self.lastbranch = branch |
|
81 | 79 | if not branch: |
|
82 | 80 | branch = 'default' |
|
83 | 81 | pbranches = [(b[0], b[1] and b[1] or 'default') for b in pbranches] |
|
84 | 82 | pbranch = pbranches and pbranches[0][1] or 'default' |
|
85 | 83 | |
|
86 | 84 | branchpath = os.path.join(self.path, branch) |
|
87 | 85 | if setbranch: |
|
88 | 86 | self.after() |
|
89 | 87 | try: |
|
90 | 88 | self.repo = hg.repository(self.ui, branchpath) |
|
91 | 89 | except: |
|
92 | 90 | self.repo = hg.repository(self.ui, branchpath, create=True) |
|
93 | 91 | self.before() |
|
94 | 92 | |
|
95 | 93 | # pbranches may bring revisions from other branches (merge parents) |
|
96 | 94 | # Make sure we have them, or pull them. |
|
97 | 95 | missings = {} |
|
98 | 96 | for b in pbranches: |
|
99 | 97 | try: |
|
100 | 98 | self.repo.lookup(b[0]) |
|
101 | 99 | except: |
|
102 | 100 | missings.setdefault(b[1], []).append(b[0]) |
|
103 | 101 | |
|
104 | 102 | if missings: |
|
105 | 103 | self.after() |
|
106 | 104 | for pbranch, heads in missings.iteritems(): |
|
107 | 105 | pbranchpath = os.path.join(self.path, pbranch) |
|
108 | 106 | prepo = hg.repository(self.ui, pbranchpath) |
|
109 | 107 | self.ui.note(_('pulling from %s into %s\n') % (pbranch, branch)) |
|
110 | 108 | self.repo.pull(prepo, [prepo.lookup(h) for h in heads]) |
|
111 | 109 | self.before() |
|
112 | 110 | |
|
113 | 111 | def putcommit(self, files, copies, parents, commit, source): |
|
114 | # Apply changes to working copy | |
|
115 | for f, v in files: | |
|
116 | try: | |
|
117 | data = source.getfile(f, v) | |
|
118 | except IOError, inst: | |
|
119 | try: | |
|
120 | util.unlink(self.repo.wjoin(f)) | |
|
121 | except OSError: | |
|
122 | pass | |
|
123 | else: | |
|
124 | e = source.getmode(f, v) | |
|
125 | self.repo.wwrite(f, data, e) | |
|
126 | if f not in self.repo.dirstate: | |
|
127 | self.repo.dirstate.normallookup(f) | |
|
128 | if f in copies: | |
|
129 | self.repo.copy(copies[f], f) | |
|
130 | files = [f[0] for f in files] | |
|
131 | 112 | |
|
132 | seen = {} | |
|
113 | files = dict(files) | |
|
114 | def getfilectx(repo, memctx, f): | |
|
115 | v = files[f] | |
|
116 | data = source.getfile(f, v) | |
|
117 | e = source.getmode(f, v) | |
|
118 | return context.memfilectx(f, data, 'l' in e, 'x' in e, copies.get(f)) | |
|
119 | ||
|
133 | 120 | pl = [] |
|
134 | 121 | for p in parents: |
|
135 |
if p not in |
|
|
122 | if p not in pl: | |
|
136 | 123 | pl.append(p) |
|
137 | seen[p] = 1 | |
|
138 | 124 | parents = pl |
|
139 | 125 | nparents = len(parents) |
|
140 | 126 | if self.filemapmode and nparents == 1: |
|
141 | 127 | m1node = self.repo.changelog.read(bin(parents[0]))[0] |
|
142 | 128 | parent = parents[0] |
|
143 | 129 | |
|
144 | 130 | if len(parents) < 2: parents.append("0" * 40) |
|
145 | 131 | if len(parents) < 2: parents.append("0" * 40) |
|
146 | 132 | p2 = parents.pop(0) |
|
147 | 133 | |
|
148 | 134 | text = commit.desc |
|
149 | 135 | extra = commit.extra.copy() |
|
150 | 136 | if self.branchnames and commit.branch: |
|
151 | 137 | extra['branch'] = commit.branch |
|
152 | 138 | if commit.rev: |
|
153 | 139 | extra['convert_revision'] = commit.rev |
|
154 | 140 | |
|
155 | 141 | while parents: |
|
156 | 142 | p1 = p2 |
|
157 | 143 | p2 = parents.pop(0) |
|
158 | a = self.repo.rawcommit(files, text, commit.author, commit.date, | |
|
159 |
|
|
|
160 |
self.repo. |
|
|
144 | ctx = context.memctx(self.repo, (p1, p2), text, files.keys(), getfilectx, | |
|
145 | commit.author, commit.date, extra) | |
|
146 | a = self.repo.commitctx(ctx) | |
|
161 | 147 | text = "(octopus merge fixup)\n" |
|
162 | 148 | p2 = hex(self.repo.changelog.tip()) |
|
163 | 149 | |
|
164 | 150 | if self.filemapmode and nparents == 1: |
|
165 | 151 | man = self.repo.manifest |
|
166 | 152 | mnode = self.repo.changelog.read(bin(p2))[0] |
|
167 | 153 | if not man.cmp(m1node, man.revision(mnode)): |
|
168 | 154 | self.repo.rollback() |
|
169 | self.repo.dirstate.clear() | |
|
170 | 155 | return parent |
|
171 | 156 | return p2 |
|
172 | 157 | |
|
173 | 158 | def puttags(self, tags): |
|
174 | try: | |
|
175 | old = self.repo.wfile(".hgtags").read() | |
|
176 | oldlines = old.splitlines(1) | |
|
177 | oldlines.sort() | |
|
178 | except: | |
|
179 | oldlines = [] | |
|
159 | try: | |
|
160 | parentctx = self.repo.changectx(self.tagsbranch) | |
|
161 | tagparent = parentctx.node() | |
|
162 | except RepoError, inst: | |
|
163 | parentctx = None | |
|
164 | tagparent = nullid | |
|
180 | 165 | |
|
181 |
|
|
|
182 | k.sort() | |
|
183 | newlines = [] | |
|
184 | for tag in k: | |
|
185 | newlines.append("%s %s\n" % (tags[tag], tag)) | |
|
186 | ||
|
187 | newlines.sort() | |
|
166 | try: | |
|
167 | old = parentctx.filectx(".hgtags").data() | |
|
168 | oldlines = old.splitlines(1) | |
|
169 | oldlines.sort() | |
|
170 | except: | |
|
171 | oldlines = [] | |
|
188 | 172 | |
|
189 | if newlines != oldlines: | |
|
190 | self.ui.status("updating tags\n") | |
|
191 | f = self.repo.wfile(".hgtags", "w") | |
|
192 | f.write("".join(newlines)) | |
|
193 |
|
|
|
194 | if not oldlines: self.repo.add([".hgtags"]) | |
|
195 | date = "%s 0" % int(time.mktime(time.gmtime())) | |
|
196 | extra = {} | |
|
197 | if self.tagsbranch != 'default': | |
|
198 | extra['branch'] = self.tagsbranch | |
|
199 | try: | |
|
200 | tagparent = self.repo.changectx(self.tagsbranch).node() | |
|
201 | except RepoError, inst: | |
|
202 | tagparent = nullid | |
|
203 | self.repo.rawcommit([".hgtags"], "update tags", "convert-repo", | |
|
204 |
|
|
|
205 | return hex(self.repo.changelog.tip()) | |
|
173 | newlines = [("%s %s\n" % (tags[tag], tag)) for tag in tags.keys()] | |
|
174 | newlines.sort() | |
|
175 | ||
|
176 | if newlines == oldlines: | |
|
177 | return None | |
|
178 | data = "".join(newlines) | |
|
179 | ||
|
180 | def getfilectx(repo, memctx, f): | |
|
181 | return context.memfilectx(f, data, False, False, None) | |
|
182 | ||
|
183 | self.ui.status("updating tags\n") | |
|
184 | date = "%s 0" % int(time.mktime(time.gmtime())) | |
|
185 | extra = {'branch': self.tagsbranch} | |
|
186 | ctx = context.memctx(self.repo, (tagparent, None), "update tags", | |
|
187 | [".hgtags"], getfilectx, "convert-repo", date, | |
|
188 | extra) | |
|
189 | self.repo.commitctx(ctx) | |
|
190 | return hex(self.repo.changelog.tip()) | |
|
206 | 191 | |
|
207 | 192 | def setfilemapmode(self, active): |
|
208 | 193 | self.filemapmode = active |
|
209 | 194 | |
|
210 | 195 | class mercurial_source(converter_source): |
|
211 | 196 | def __init__(self, ui, path, rev=None): |
|
212 | 197 | converter_source.__init__(self, ui, path, rev) |
|
213 | 198 | self.saverev = ui.configbool('convert', 'hg.saverev', True) |
|
214 | 199 | try: |
|
215 | 200 | self.repo = hg.repository(self.ui, path) |
|
216 | 201 | # try to provoke an exception if this isn't really a hg |
|
217 | 202 | # repo, but some other bogus compatible-looking url |
|
218 | 203 | if not self.repo.local(): |
|
219 | 204 | raise RepoError() |
|
220 | 205 | except RepoError: |
|
221 | 206 | ui.print_exc() |
|
222 | 207 | raise NoRepo("%s is not a local Mercurial repo" % path) |
|
223 | 208 | self.lastrev = None |
|
224 | 209 | self.lastctx = None |
|
225 | 210 | self._changescache = None |
|
226 | 211 | self.convertfp = None |
|
227 | 212 | |
|
228 | 213 | def changectx(self, rev): |
|
229 | 214 | if self.lastrev != rev: |
|
230 | 215 | self.lastctx = self.repo.changectx(rev) |
|
231 | 216 | self.lastrev = rev |
|
232 | 217 | return self.lastctx |
|
233 | 218 | |
|
234 | 219 | def getheads(self): |
|
235 | 220 | if self.rev: |
|
236 | 221 | return [hex(self.repo.changectx(self.rev).node())] |
|
237 | 222 | else: |
|
238 | 223 | return [hex(node) for node in self.repo.heads()] |
|
239 | 224 | |
|
240 | 225 | def getfile(self, name, rev): |
|
241 | 226 | try: |
|
242 | 227 | return self.changectx(rev).filectx(name).data() |
|
243 | 228 | except revlog.LookupError, err: |
|
244 | 229 | raise IOError(err) |
|
245 | 230 | |
|
246 | 231 | def getmode(self, name, rev): |
|
247 | 232 | m = self.changectx(rev).manifest() |
|
248 | 233 | return (m.execf(name) and 'x' or '') + (m.linkf(name) and 'l' or '') |
|
249 | 234 | |
|
250 | 235 | def getchanges(self, rev): |
|
251 | 236 | ctx = self.changectx(rev) |
|
252 | 237 | if self._changescache and self._changescache[0] == rev: |
|
253 | 238 | m, a, r = self._changescache[1] |
|
254 | 239 | else: |
|
255 | 240 | m, a, r = self.repo.status(ctx.parents()[0].node(), ctx.node())[:3] |
|
256 | 241 | changes = [(name, rev) for name in m + a + r] |
|
257 | 242 | changes.sort() |
|
258 | 243 | return (changes, self.getcopies(ctx, m + a)) |
|
259 | 244 | |
|
260 | 245 | def getcopies(self, ctx, files): |
|
261 | 246 | copies = {} |
|
262 | 247 | for name in files: |
|
263 | 248 | try: |
|
264 | 249 | copies[name] = ctx.filectx(name).renamed()[0] |
|
265 | 250 | except TypeError: |
|
266 | 251 | pass |
|
267 | 252 | return copies |
|
268 | 253 | |
|
269 | 254 | def getcommit(self, rev): |
|
270 | 255 | ctx = self.changectx(rev) |
|
271 | 256 | parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid] |
|
272 | 257 | if self.saverev: |
|
273 | 258 | crev = rev |
|
274 | 259 | else: |
|
275 | 260 | crev = None |
|
276 | 261 | return commit(author=ctx.user(), date=util.datestr(ctx.date()), |
|
277 | 262 | desc=ctx.description(), rev=crev, parents=parents, |
|
278 | 263 | branch=ctx.branch(), extra=ctx.extra()) |
|
279 | 264 | |
|
280 | 265 | def gettags(self): |
|
281 | 266 | tags = [t for t in self.repo.tagslist() if t[0] != 'tip'] |
|
282 | 267 | return dict([(name, hex(node)) for name, node in tags]) |
|
283 | 268 | |
|
284 | 269 | def getchangedfiles(self, rev, i): |
|
285 | 270 | ctx = self.changectx(rev) |
|
286 | 271 | i = i or 0 |
|
287 | 272 | changes = self.repo.status(ctx.parents()[i].node(), ctx.node())[:3] |
|
288 | 273 | |
|
289 | 274 | if i == 0: |
|
290 | 275 | self._changescache = (rev, changes) |
|
291 | 276 | |
|
292 | 277 | return changes[0] + changes[1] + changes[2] |
|
293 | 278 | |
|
294 | 279 | def converted(self, rev, destrev): |
|
295 | 280 | if self.convertfp is None: |
|
296 | 281 | self.convertfp = open(os.path.join(self.path, '.hg', 'shamap'), |
|
297 | 282 | 'a') |
|
298 | 283 | self.convertfp.write('%s %s\n' % (destrev, rev)) |
|
299 | 284 | self.convertfp.flush() |
|
300 | 285 | |
|
301 | 286 | def before(self): |
|
302 | 287 | self.ui.debug(_('run hg source pre-conversion action\n')) |
|
303 | 288 | |
|
304 | 289 | def after(self): |
|
305 | 290 | self.ui.debug(_('run hg source post-conversion action\n')) |
@@ -1,96 +1,101 | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | "$TESTDIR/hghave" cvs cvsps || exit 80 |
|
4 | 4 | |
|
5 | 5 | cvscall() |
|
6 | 6 | { |
|
7 | 7 | cvs -f $@ |
|
8 | 8 | } |
|
9 | 9 | |
|
10 | hgcat() | |
|
11 | { | |
|
12 | hg --cwd src-hg cat -r tip "$1" | |
|
13 | } | |
|
14 | ||
|
10 | 15 | echo "[extensions]" >> $HGRCPATH |
|
11 | 16 | echo "convert = " >> $HGRCPATH |
|
12 | 17 | |
|
13 | 18 | echo % create cvs repository |
|
14 | 19 | mkdir cvsrepo |
|
15 | 20 | cd cvsrepo |
|
16 | 21 | export CVSROOT=`pwd` |
|
17 | 22 | export CVS_OPTIONS=-f |
|
18 | 23 | cd .. |
|
19 | 24 | |
|
20 | 25 | cvscall -q -d "$CVSROOT" init |
|
21 | 26 | |
|
22 | 27 | echo % create source directory |
|
23 | 28 | mkdir src-temp |
|
24 | 29 | cd src-temp |
|
25 | 30 | echo a > a |
|
26 | 31 | mkdir b |
|
27 | 32 | cd b |
|
28 | 33 | echo c > c |
|
29 | 34 | cd .. |
|
30 | 35 | |
|
31 | 36 | echo % import source directory |
|
32 | 37 | cvscall -q import -m import src INITIAL start |
|
33 | 38 | cd .. |
|
34 | 39 | |
|
35 | 40 | echo % checkout source directory |
|
36 | 41 | cvscall -q checkout src |
|
37 | 42 | |
|
38 | 43 | echo % commit a new revision changing b/c |
|
39 | 44 | cd src |
|
40 | 45 | sleep 1 |
|
41 | 46 | echo c >> b/c |
|
42 | 47 | cvscall -q commit -mci0 . | grep '<--' |\ |
|
43 | 48 | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
44 | 49 | cd .. |
|
45 | 50 | |
|
46 | 51 | echo % convert fresh repo |
|
47 | 52 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
48 | cat src-hg/a | |
|
49 |
cat |
|
|
53 | hgcat a | |
|
54 | hgcat b/c | |
|
50 | 55 | |
|
51 | 56 | echo % convert fresh repo with --filemap |
|
52 | 57 | echo include b/c > filemap |
|
53 | 58 | hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
54 |
cat |
|
|
59 | hgcat b/c | |
|
55 | 60 | hg -R src-filemap log --template '#rev# #desc# files: #files#\n' |
|
56 | 61 | |
|
57 | 62 | echo % commit new file revisions |
|
58 | 63 | cd src |
|
59 | 64 | echo a >> a |
|
60 | 65 | echo c >> b/c |
|
61 | 66 | cvscall -q commit -mci1 . | grep '<--' |\ |
|
62 | 67 | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
63 | 68 | cd .. |
|
64 | 69 | |
|
65 | 70 | echo % convert again |
|
66 | 71 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
67 | cat src-hg/a | |
|
68 |
cat |
|
|
72 | hgcat a | |
|
73 | hgcat b/c | |
|
69 | 74 | |
|
70 | 75 | echo % convert again with --filemap |
|
71 | 76 | hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
72 |
cat |
|
|
77 | hgcat b/c | |
|
73 | 78 | hg -R src-filemap log --template '#rev# #desc# files: #files#\n' |
|
74 | 79 | |
|
75 | 80 | echo % commit branch |
|
76 | 81 | cd src |
|
77 | 82 | cvs -q update -r1.1 b/c |
|
78 | 83 | cvs -q tag -b branch |
|
79 | 84 | cvs -q update -r branch |
|
80 | 85 | echo d >> b/c |
|
81 | 86 | cvs -q commit -mci2 . | grep '<--' |\ |
|
82 | 87 | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
83 | 88 | cd .. |
|
84 | 89 | |
|
85 | 90 | echo % convert again |
|
86 | 91 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
87 | cat src-hg/a | |
|
88 |
cat |
|
|
92 | hgcat a | |
|
93 | hgcat b/c | |
|
89 | 94 | |
|
90 | 95 | echo % convert again with --filemap |
|
91 | 96 | hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
92 |
cat |
|
|
97 | hgcat b/c | |
|
93 | 98 | hg -R src-filemap log --template '#rev# #desc# files: #files#\n' |
|
94 | 99 | |
|
95 | 100 | echo "graphlog = " >> $HGRCPATH |
|
96 | 101 | hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n' |
@@ -1,99 +1,104 | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | "$TESTDIR/hghave" cvs || exit 80 |
|
4 | 4 | |
|
5 | 5 | cvscall() |
|
6 | 6 | { |
|
7 | 7 | cvs -f "$@" |
|
8 | 8 | } |
|
9 | 9 | |
|
10 | hgcat() | |
|
11 | { | |
|
12 | hg --cwd src-hg cat -r tip "$1" | |
|
13 | } | |
|
14 | ||
|
10 | 15 | echo "[extensions]" >> $HGRCPATH |
|
11 | 16 | echo "convert = " >> $HGRCPATH |
|
12 | 17 | echo "graphlog = " >> $HGRCPATH |
|
13 | 18 | echo "[convert]" >> $HGRCPATH |
|
14 | 19 | echo "cvsps=builtin" >> $HGRCPATH |
|
15 | 20 | |
|
16 | 21 | echo % create cvs repository |
|
17 | 22 | mkdir cvsrepo |
|
18 | 23 | cd cvsrepo |
|
19 | 24 | export CVSROOT=`pwd` |
|
20 | 25 | export CVS_OPTIONS=-f |
|
21 | 26 | cd .. |
|
22 | 27 | |
|
23 | 28 | cvscall -q -d "$CVSROOT" init |
|
24 | 29 | |
|
25 | 30 | echo % create source directory |
|
26 | 31 | mkdir src-temp |
|
27 | 32 | cd src-temp |
|
28 | 33 | echo a > a |
|
29 | 34 | mkdir b |
|
30 | 35 | cd b |
|
31 | 36 | echo c > c |
|
32 | 37 | cd .. |
|
33 | 38 | |
|
34 | 39 | echo % import source directory |
|
35 | 40 | cvscall -q import -m import src INITIAL start |
|
36 | 41 | cd .. |
|
37 | 42 | |
|
38 | 43 | echo % checkout source directory |
|
39 | 44 | cvscall -q checkout src |
|
40 | 45 | |
|
41 | 46 | echo % commit a new revision changing b/c |
|
42 | 47 | cd src |
|
43 | 48 | sleep 1 |
|
44 | 49 | echo c >> b/c |
|
45 | 50 | cvscall -q commit -mci0 . | grep '<--' |\ |
|
46 | 51 | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
47 | 52 | cd .. |
|
48 | 53 | |
|
49 | 54 | echo % convert fresh repo |
|
50 | 55 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
51 | cat src-hg/a | |
|
52 |
cat |
|
|
56 | hgcat a | |
|
57 | hgcat b/c | |
|
53 | 58 | |
|
54 | 59 | echo % convert fresh repo with --filemap |
|
55 | 60 | echo include b/c > filemap |
|
56 | 61 | hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
57 |
cat |
|
|
62 | hgcat b/c | |
|
58 | 63 | hg -R src-filemap log --template '#rev# #desc# files: #files#\n' |
|
59 | 64 | |
|
60 | 65 | echo % commit new file revisions |
|
61 | 66 | cd src |
|
62 | 67 | echo a >> a |
|
63 | 68 | echo c >> b/c |
|
64 | 69 | cvscall -q commit -mci1 . | grep '<--' |\ |
|
65 | 70 | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
66 | 71 | cd .. |
|
67 | 72 | |
|
68 | 73 | echo % convert again |
|
69 | 74 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
70 | cat src-hg/a | |
|
71 |
cat |
|
|
75 | hgcat a | |
|
76 | hgcat b/c | |
|
72 | 77 | |
|
73 | 78 | echo % convert again with --filemap |
|
74 | 79 | hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
75 |
cat |
|
|
80 | hgcat b/c | |
|
76 | 81 | hg -R src-filemap log --template '#rev# #desc# files: #files#\n' |
|
77 | 82 | |
|
78 | 83 | echo % commit branch |
|
79 | 84 | cd src |
|
80 | 85 | cvs -q update -r1.1 b/c |
|
81 | 86 | cvs -q tag -b branch |
|
82 | 87 | cvs -q update -r branch |
|
83 | 88 | echo d >> b/c |
|
84 | 89 | cvs -q commit -mci2 . | grep '<--' |\ |
|
85 | 90 | sed -e 's:.*src/\(.*\),v.*:checking in src/\1,v:g' |
|
86 | 91 | cd .. |
|
87 | 92 | |
|
88 | 93 | echo % convert again |
|
89 | 94 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
90 | cat src-hg/a | |
|
91 |
cat |
|
|
95 | hgcat a | |
|
96 | hgcat b/c | |
|
92 | 97 | |
|
93 | 98 | echo % convert again with --filemap |
|
94 | 99 | hg convert --filemap filemap src src-filemap | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' |
|
95 |
cat |
|
|
100 | hgcat b/c | |
|
96 | 101 | hg -R src-filemap log --template '#rev# #desc# files: #files#\n' |
|
97 | 102 | |
|
98 | 103 | echo "graphlog = " >> $HGRCPATH |
|
99 | 104 | hg -R src-hg glog --template '#rev# (#branches#) #desc# files: #files#\n' |
@@ -1,139 +1,138 | |||
|
1 | 1 | % create cvs repository |
|
2 | 2 | % create source directory |
|
3 | 3 | % import source directory |
|
4 | 4 | N src/a |
|
5 | 5 | N src/b/c |
|
6 | 6 | |
|
7 | 7 | No conflicts created by this import |
|
8 | 8 | |
|
9 | 9 | % checkout source directory |
|
10 | 10 | U src/a |
|
11 | 11 | U src/b/c |
|
12 | 12 | % commit a new revision changing b/c |
|
13 | 13 | checking in src/b/c,v |
|
14 | 14 | % convert fresh repo |
|
15 | 15 | initializing destination src-hg repository |
|
16 | 16 | using builtin cvsps |
|
17 | 17 | collecting CVS rlog |
|
18 | 18 | 5 log entries |
|
19 | 19 | creating changesets |
|
20 | 20 | 3 changeset entries |
|
21 | 21 | connecting to cvsrepo |
|
22 | 22 | scanning source... |
|
23 | 23 | sorting... |
|
24 | 24 | converting... |
|
25 | 25 | 2 Initial revision |
|
26 | 26 | 1 import |
|
27 | 27 | 0 ci0 |
|
28 | 28 | updating tags |
|
29 | 29 | a |
|
30 | 30 | c |
|
31 | 31 | c |
|
32 | 32 | % convert fresh repo with --filemap |
|
33 | 33 | initializing destination src-filemap repository |
|
34 | 34 | using builtin cvsps |
|
35 | 35 | collecting CVS rlog |
|
36 | 36 | 5 log entries |
|
37 | 37 | creating changesets |
|
38 | 38 | 3 changeset entries |
|
39 | 39 | connecting to cvsrepo |
|
40 | 40 | scanning source... |
|
41 | 41 | sorting... |
|
42 | 42 | converting... |
|
43 | 43 | 2 Initial revision |
|
44 | 44 | 1 import |
|
45 | 45 | rolling back last transaction |
|
46 | 46 | 0 ci0 |
|
47 | 47 | updating tags |
|
48 | 48 | c |
|
49 | 49 | c |
|
50 | 50 | 2 update tags files: .hgtags |
|
51 | 51 | 1 ci0 files: b/c |
|
52 | 52 | 0 Initial revision files: b/c |
|
53 | 53 | % commit new file revisions |
|
54 | 54 | checking in src/a,v |
|
55 | 55 | checking in src/b/c,v |
|
56 | 56 | % convert again |
|
57 | 57 | using builtin cvsps |
|
58 | 58 | collecting CVS rlog |
|
59 | 59 | 7 log entries |
|
60 | 60 | creating changesets |
|
61 | 61 | 4 changeset entries |
|
62 | 62 | connecting to cvsrepo |
|
63 | 63 | scanning source... |
|
64 | 64 | sorting... |
|
65 | 65 | converting... |
|
66 | 66 | 0 ci1 |
|
67 | 67 | a |
|
68 | 68 | a |
|
69 | 69 | c |
|
70 | 70 | c |
|
71 | 71 | c |
|
72 | 72 | % convert again with --filemap |
|
73 | 73 | using builtin cvsps |
|
74 | 74 | collecting CVS rlog |
|
75 | 75 | 7 log entries |
|
76 | 76 | creating changesets |
|
77 | 77 | 4 changeset entries |
|
78 | 78 | connecting to cvsrepo |
|
79 | 79 | scanning source... |
|
80 | 80 | sorting... |
|
81 | 81 | converting... |
|
82 | 82 | 0 ci1 |
|
83 | 83 | c |
|
84 | 84 | c |
|
85 | 85 | c |
|
86 | 86 | 3 ci1 files: b/c |
|
87 | 87 | 2 update tags files: .hgtags |
|
88 | 88 | 1 ci0 files: b/c |
|
89 | 89 | 0 Initial revision files: b/c |
|
90 | 90 | % commit branch |
|
91 | 91 | U b/c |
|
92 | 92 | T a |
|
93 | 93 | T b/c |
|
94 | 94 | checking in src/b/c,v |
|
95 | 95 | % convert again |
|
96 | 96 | using builtin cvsps |
|
97 | 97 | collecting CVS rlog |
|
98 | 98 | 8 log entries |
|
99 | 99 | creating changesets |
|
100 | 100 | 5 changeset entries |
|
101 | 101 | connecting to cvsrepo |
|
102 | 102 | scanning source... |
|
103 | 103 | sorting... |
|
104 | 104 | converting... |
|
105 | 105 | 0 ci2 |
|
106 | 106 | a |
|
107 | a | |
|
108 | 107 | c |
|
109 | 108 | d |
|
110 | 109 | % convert again with --filemap |
|
111 | 110 | using builtin cvsps |
|
112 | 111 | collecting CVS rlog |
|
113 | 112 | 8 log entries |
|
114 | 113 | creating changesets |
|
115 | 114 | 5 changeset entries |
|
116 | 115 | connecting to cvsrepo |
|
117 | 116 | scanning source... |
|
118 | 117 | sorting... |
|
119 | 118 | converting... |
|
120 | 119 | 0 ci2 |
|
121 | 120 | c |
|
122 | 121 | d |
|
123 | 122 | 4 ci2 files: b/c |
|
124 | 123 | 3 ci1 files: b/c |
|
125 | 124 | 2 update tags files: .hgtags |
|
126 | 125 | 1 ci0 files: b/c |
|
127 | 126 | 0 Initial revision files: b/c |
|
128 | 127 | o 5 (branch) ci2 files: b/c |
|
129 | 128 | | |
|
130 | 129 | | o 4 () ci1 files: a b/c |
|
131 | 130 | | | |
|
132 | 131 | | o 3 () update tags files: .hgtags |
|
133 | 132 | | | |
|
134 | 133 | | o 2 () ci0 files: b/c |
|
135 | 134 | |/ |
|
136 | 135 | | o 1 (INITIAL) import files: |
|
137 | 136 | |/ |
|
138 | 137 | o 0 () Initial revision files: a b/c |
|
139 | 138 |
@@ -1,109 +1,108 | |||
|
1 | 1 | % create cvs repository |
|
2 | 2 | % create source directory |
|
3 | 3 | % import source directory |
|
4 | 4 | N src/a |
|
5 | 5 | N src/b/c |
|
6 | 6 | |
|
7 | 7 | No conflicts created by this import |
|
8 | 8 | |
|
9 | 9 | % checkout source directory |
|
10 | 10 | U src/a |
|
11 | 11 | U src/b/c |
|
12 | 12 | % commit a new revision changing b/c |
|
13 | 13 | checking in src/b/c,v |
|
14 | 14 | % convert fresh repo |
|
15 | 15 | initializing destination src-hg repository |
|
16 | 16 | connecting to cvsrepo |
|
17 | 17 | scanning source... |
|
18 | 18 | sorting... |
|
19 | 19 | converting... |
|
20 | 20 | 2 Initial revision |
|
21 | 21 | 1 import |
|
22 | 22 | 0 ci0 |
|
23 | 23 | updating tags |
|
24 | 24 | a |
|
25 | 25 | c |
|
26 | 26 | c |
|
27 | 27 | % convert fresh repo with --filemap |
|
28 | 28 | initializing destination src-filemap repository |
|
29 | 29 | connecting to cvsrepo |
|
30 | 30 | scanning source... |
|
31 | 31 | sorting... |
|
32 | 32 | converting... |
|
33 | 33 | 2 Initial revision |
|
34 | 34 | 1 import |
|
35 | 35 | rolling back last transaction |
|
36 | 36 | 0 ci0 |
|
37 | 37 | updating tags |
|
38 | 38 | c |
|
39 | 39 | c |
|
40 | 40 | 2 update tags files: .hgtags |
|
41 | 41 | 1 ci0 files: b/c |
|
42 | 42 | 0 Initial revision files: b/c |
|
43 | 43 | % commit new file revisions |
|
44 | 44 | checking in src/a,v |
|
45 | 45 | checking in src/b/c,v |
|
46 | 46 | % convert again |
|
47 | 47 | connecting to cvsrepo |
|
48 | 48 | scanning source... |
|
49 | 49 | sorting... |
|
50 | 50 | converting... |
|
51 | 51 | 0 ci1 |
|
52 | 52 | a |
|
53 | 53 | a |
|
54 | 54 | c |
|
55 | 55 | c |
|
56 | 56 | c |
|
57 | 57 | % convert again with --filemap |
|
58 | 58 | connecting to cvsrepo |
|
59 | 59 | scanning source... |
|
60 | 60 | sorting... |
|
61 | 61 | converting... |
|
62 | 62 | 0 ci1 |
|
63 | 63 | c |
|
64 | 64 | c |
|
65 | 65 | c |
|
66 | 66 | 3 ci1 files: b/c |
|
67 | 67 | 2 update tags files: .hgtags |
|
68 | 68 | 1 ci0 files: b/c |
|
69 | 69 | 0 Initial revision files: b/c |
|
70 | 70 | % commit branch |
|
71 | 71 | U b/c |
|
72 | 72 | T a |
|
73 | 73 | T b/c |
|
74 | 74 | checking in src/b/c,v |
|
75 | 75 | % convert again |
|
76 | 76 | connecting to cvsrepo |
|
77 | 77 | scanning source... |
|
78 | 78 | sorting... |
|
79 | 79 | converting... |
|
80 | 80 | 0 ci2 |
|
81 | 81 | a |
|
82 | a | |
|
83 | 82 | c |
|
84 | 83 | d |
|
85 | 84 | % convert again with --filemap |
|
86 | 85 | connecting to cvsrepo |
|
87 | 86 | scanning source... |
|
88 | 87 | sorting... |
|
89 | 88 | converting... |
|
90 | 89 | 0 ci2 |
|
91 | 90 | c |
|
92 | 91 | d |
|
93 | 92 | 4 ci2 files: b/c |
|
94 | 93 | 3 ci1 files: b/c |
|
95 | 94 | 2 update tags files: .hgtags |
|
96 | 95 | 1 ci0 files: b/c |
|
97 | 96 | 0 Initial revision files: b/c |
|
98 | 97 | o 5 (branch) ci2 files: b/c |
|
99 | 98 | | |
|
100 | 99 | | o 4 () ci1 files: a b/c |
|
101 | 100 | | | |
|
102 | 101 | | o 3 () update tags files: .hgtags |
|
103 | 102 | | | |
|
104 | 103 | | o 2 () ci0 files: b/c |
|
105 | 104 | |/ |
|
106 | 105 | | o 1 (INITIAL) import files: |
|
107 | 106 | |/ |
|
108 | 107 | o 0 () Initial revision files: a b/c |
|
109 | 108 |
General Comments 0
You need to be logged in to leave comments.
Login now