Show More
@@ -0,0 +1,78 b'' | |||||
|
1 | #!/bin/bash | |||
|
2 | ||||
|
3 | "$TESTDIR/hghave" cvs || exit 80 | |||
|
4 | ||||
|
5 | cvscall() | |||
|
6 | { | |||
|
7 | cvs -f "$@" | |||
|
8 | } | |||
|
9 | ||||
|
10 | hgcat() | |||
|
11 | { | |||
|
12 | hg --cwd src-hg cat -r tip "$1" | |||
|
13 | } | |||
|
14 | ||||
|
15 | echo "[extensions]" >> $HGRCPATH | |||
|
16 | echo "convert = " >> $HGRCPATH | |||
|
17 | echo "graphlog = " >> $HGRCPATH | |||
|
18 | echo "[convert]" >> $HGRCPATH | |||
|
19 | echo "cvsps=builtin" >> $HGRCPATH | |||
|
20 | ||||
|
21 | echo % create cvs repository | |||
|
22 | mkdir cvsmaster | |||
|
23 | cd cvsmaster | |||
|
24 | export CVSROOT=`pwd` | |||
|
25 | export CVS_OPTIONS=-f | |||
|
26 | cd .. | |||
|
27 | ||||
|
28 | cvscall -q -d "$CVSROOT" init | |||
|
29 | ||||
|
30 | cvscall -q checkout -d cvsworktmp . | |||
|
31 | cd cvsworktmp | |||
|
32 | mkdir foo | |||
|
33 | cvscall -q add foo | sed -e 's/Directory .* added to the repository//g' | |||
|
34 | cd foo | |||
|
35 | echo foo > foo.txt | |||
|
36 | cvscall -q add foo.txt | |||
|
37 | cvscall -q ci -m "foo.txt" | sed 's/.*,v.*/checking in/g' | |||
|
38 | ||||
|
39 | cd ../.. | |||
|
40 | rm -rf cvsworktmp | |||
|
41 | ||||
|
42 | cvscall -q checkout -d cvswork foo | |||
|
43 | ||||
|
44 | cd cvswork | |||
|
45 | ||||
|
46 | cvscall -q rtag -b -R MYBRANCH1 foo | |||
|
47 | cvscall -q up -P -r MYBRANCH1 | |||
|
48 | echo bar > foo.txt | |||
|
49 | cvscall -q ci -m "bar" | sed 's/.*,v.*/checking in/g' | |||
|
50 | echo baz > foo.txt | |||
|
51 | cvscall -q ci -m "baz" | sed 's/.*,v.*/checking in/g' | |||
|
52 | ||||
|
53 | cvscall -q rtag -b -R -r MYBRANCH1 MYBRANCH1_2 foo | |||
|
54 | cvscall -q up -P -r MYBRANCH1_2 | |||
|
55 | ||||
|
56 | echo bazzie > foo.txt | |||
|
57 | cvscall -q ci -m "bazzie" | sed 's/.*,v.*/checking in/g' | |||
|
58 | ||||
|
59 | cvscall -q rtag -b -R MYBRANCH1_1 foo | |||
|
60 | cvscall -q up -P -r MYBRANCH1_1 | |||
|
61 | ||||
|
62 | echo quux > foo.txt | |||
|
63 | cvscall -q ci -m "quux" | sed 's/.*,v.*/checking in/g' | |||
|
64 | cvscall -q up -P -jMYBRANCH1 | sed 's/RCS file: .*,v/merging MYBRANCH1/g' | |||
|
65 | echo xyzzy > foo.txt | |||
|
66 | cvscall -q ci -m "merge" | sed 's/.*,v.*/checking in/g' | |||
|
67 | ||||
|
68 | cvscall -q up -P -A | |||
|
69 | ||||
|
70 | cvscall -q up -P -jMYBRANCH1_2 | sed 's/RCS file: .*,v/merging MYBRANCH1_2/g' | |||
|
71 | cvscall -q ci -m "merge" | sed 's/.*,v.*/checking in/g' | |||
|
72 | ||||
|
73 | REALCVS=`which cvs` | |||
|
74 | echo "for x in \$*; do if [ \"\$x\" = \"rlog\" ]; then echo \"RCS file: $CVSROOT/foo/foo.txt,v\"; cat $TESTDIR/test-convert-cvs-builtincvsps-cvsnt-mergepoints.rlog; exit 0; fi; done; $REALCVS \$*" > cvs | |||
|
75 | chmod +x cvs | |||
|
76 | PATH=.:${PATH} hg debugcvsps --parents foo | sed -e 's/Author:.*/Author:/' -e 's/Date:.*/Date:/' | |||
|
77 | ||||
|
78 | cd .. |
@@ -0,0 +1,138 b'' | |||||
|
1 | % create cvs repository | |||
|
2 | U cvsworktmp/CVSROOT/checkoutlist | |||
|
3 | U cvsworktmp/CVSROOT/commitinfo | |||
|
4 | U cvsworktmp/CVSROOT/config | |||
|
5 | U cvsworktmp/CVSROOT/cvswrappers | |||
|
6 | U cvsworktmp/CVSROOT/loginfo | |||
|
7 | U cvsworktmp/CVSROOT/modules | |||
|
8 | U cvsworktmp/CVSROOT/notify | |||
|
9 | U cvsworktmp/CVSROOT/postadmin | |||
|
10 | U cvsworktmp/CVSROOT/postproxy | |||
|
11 | U cvsworktmp/CVSROOT/posttag | |||
|
12 | U cvsworktmp/CVSROOT/postwatch | |||
|
13 | U cvsworktmp/CVSROOT/preproxy | |||
|
14 | U cvsworktmp/CVSROOT/rcsinfo | |||
|
15 | U cvsworktmp/CVSROOT/taginfo | |||
|
16 | U cvsworktmp/CVSROOT/verifymsg | |||
|
17 | ||||
|
18 | cvs add: use `cvs commit' to add this file permanently | |||
|
19 | checking in | |||
|
20 | initial revision: 1.1 | |||
|
21 | U cvswork/foo.txt | |||
|
22 | checking in | |||
|
23 | new revision: 1.1.2.1; previous revision: 1.1 | |||
|
24 | checking in | |||
|
25 | new revision: 1.1.2.2; previous revision: 1.1.2.1 | |||
|
26 | checking in | |||
|
27 | new revision: 1.1.2.2.2.1; previous revision: 1.1.2.2 | |||
|
28 | U foo.txt | |||
|
29 | checking in | |||
|
30 | new revision: 1.1.4.1; previous revision: 1.1 | |||
|
31 | rcsmerge: warning: conflicts during merge | |||
|
32 | merging MYBRANCH1 | |||
|
33 | retrieving revision 1.1 | |||
|
34 | retrieving revision 1.1.2.2 | |||
|
35 | Merging differences between 1.1 and 1.1.2.2 into foo.txt | |||
|
36 | checking in | |||
|
37 | new revision: 1.1.4.2; previous revision: 1.1.4.1 | |||
|
38 | U foo.txt | |||
|
39 | merging MYBRANCH1_2 | |||
|
40 | retrieving revision 1.1 | |||
|
41 | retrieving revision 1.1.2.2.2.1 | |||
|
42 | Merging differences between 1.1 and 1.1.2.2.2.1 into foo.txt | |||
|
43 | checking in | |||
|
44 | new revision: 1.2; previous revision: 1.1 | |||
|
45 | collecting CVS rlog | |||
|
46 | 7 log entries | |||
|
47 | creating changesets | |||
|
48 | 7 changeset entries | |||
|
49 | --------------------- | |||
|
50 | PatchSet 1 | |||
|
51 | Date: | |||
|
52 | Author: | |||
|
53 | Branch: HEAD | |||
|
54 | Tag: (none) | |||
|
55 | Log: | |||
|
56 | foo.txt | |||
|
57 | ||||
|
58 | Members: | |||
|
59 | foo.txt:INITIAL->1.1 | |||
|
60 | ||||
|
61 | --------------------- | |||
|
62 | PatchSet 2 | |||
|
63 | Date: | |||
|
64 | Author: | |||
|
65 | Branch: MYBRANCH1 | |||
|
66 | Tag: (none) | |||
|
67 | Parent: 1 | |||
|
68 | Log: | |||
|
69 | bar | |||
|
70 | ||||
|
71 | Members: | |||
|
72 | foo.txt:1.1->1.1.2.1 | |||
|
73 | ||||
|
74 | --------------------- | |||
|
75 | PatchSet 3 | |||
|
76 | Date: | |||
|
77 | Author: | |||
|
78 | Branch: MYBRANCH1 | |||
|
79 | Tag: (none) | |||
|
80 | Parent: 2 | |||
|
81 | Log: | |||
|
82 | baz | |||
|
83 | ||||
|
84 | Members: | |||
|
85 | foo.txt:1.1.2.1->1.1.2.2 | |||
|
86 | ||||
|
87 | --------------------- | |||
|
88 | PatchSet 4 | |||
|
89 | Date: | |||
|
90 | Author: | |||
|
91 | Branch: MYBRANCH1_1 | |||
|
92 | Tag: (none) | |||
|
93 | Parent: 1 | |||
|
94 | Log: | |||
|
95 | quux | |||
|
96 | ||||
|
97 | Members: | |||
|
98 | foo.txt:1.1->1.1.4.1 | |||
|
99 | ||||
|
100 | --------------------- | |||
|
101 | PatchSet 5 | |||
|
102 | Date: | |||
|
103 | Author: | |||
|
104 | Branch: MYBRANCH1_2 | |||
|
105 | Tag: (none) | |||
|
106 | Parent: 3 | |||
|
107 | Log: | |||
|
108 | bazzie | |||
|
109 | ||||
|
110 | Members: | |||
|
111 | foo.txt:1.1.2.2->1.1.2.2.2.1 | |||
|
112 | ||||
|
113 | --------------------- | |||
|
114 | PatchSet 6 | |||
|
115 | Date: | |||
|
116 | Author: | |||
|
117 | Branch: HEAD | |||
|
118 | Tag: (none) | |||
|
119 | Parents: 1,5 | |||
|
120 | Log: | |||
|
121 | merge | |||
|
122 | ||||
|
123 | Members: | |||
|
124 | foo.txt:1.1->1.2 | |||
|
125 | ||||
|
126 | --------------------- | |||
|
127 | PatchSet 7 | |||
|
128 | Date: | |||
|
129 | Author: | |||
|
130 | Branch: MYBRANCH1_1 | |||
|
131 | Tag: (none) | |||
|
132 | Parents: 4,3 | |||
|
133 | Log: | |||
|
134 | merge | |||
|
135 | ||||
|
136 | Members: | |||
|
137 | foo.txt:1.1.4.1->1.1.4.2 | |||
|
138 |
@@ -0,0 +1,42 b'' | |||||
|
1 | head: 1.2 | |||
|
2 | branch: | |||
|
3 | locks: strict | |||
|
4 | access list: | |||
|
5 | symbolic names: | |||
|
6 | MYBRANCH1_2: 1.1.2.2.0.2 | |||
|
7 | MYBRANCH1_1: 1.1.0.4 | |||
|
8 | MYBRANCH1: 1.1.0.2 | |||
|
9 | keyword substitution: kv | |||
|
10 | total revisions: 8; selected revisions: 8 | |||
|
11 | description: | |||
|
12 | ---------------------------- | |||
|
13 | revision 1.2 | |||
|
14 | date: 2009/04/02 07:00:32; author: user; state: Exp; lines: +1 -1; kopt: kv; commitid: 14d449d462903487; mergepoint: 1.1.2.2.2.1; filename: foo.txt; | |||
|
15 | merge | |||
|
16 | ---------------------------- | |||
|
17 | revision 1.1 | |||
|
18 | date: 2009/04/02 06:50:43; author: user; state: Exp; kopt: kv; commitid: 17ac49d460432d04; filename: foo.txt; | |||
|
19 | branches: 1.1.2; 1.1.4; | |||
|
20 | foo.txt | |||
|
21 | ---------------------------- | |||
|
22 | revision 1.1.4.2 | |||
|
23 | date: 2009/04/02 07:02:51; author: user; state: Exp; lines: +1 -0; kopt: kv; commitid: 170049d4631b364d; mergepoint: 1.1.2.2; filename: foo.txt; | |||
|
24 | merge | |||
|
25 | ---------------------------- | |||
|
26 | revision 1.1.4.1 | |||
|
27 | date: 2009/04/02 06:53:42; author: user; state: Exp; lines: +1 -1; kopt: kv; commitid: dc849d460f52f49; filename: foo.txt; | |||
|
28 | quux | |||
|
29 | ---------------------------- | |||
|
30 | revision 1.1.2.2 | |||
|
31 | date: 2009/04/02 06:53:20; author: user; state: Exp; lines: +1 -1; kopt: kv; commitid: 8ec49d460e02f04; filename: foo.txt; | |||
|
32 | branches: 1.1.2.2.2; | |||
|
33 | baz | |||
|
34 | ---------------------------- | |||
|
35 | revision 1.1.2.1 | |||
|
36 | date: 2009/04/02 06:52:38; author: user; state: Exp; lines: +1 -1; kopt: kv; commitid: d5049d460b62e7b; filename: foo.txt; | |||
|
37 | bar | |||
|
38 | ---------------------------- | |||
|
39 | revision 1.1.2.2.2.1 | |||
|
40 | date: 2009/04/02 06:55:42; author: user; state: Exp; lines: +1 -1; kopt: kv; commitid: 11c849d4616d30d1; filename: foo.txt; | |||
|
41 | bazzie | |||
|
42 | ============================================================================= |
@@ -34,6 +34,7 b' class logentry(object):' | |||||
34 | .revision - revision number as tuple |
|
34 | .revision - revision number as tuple | |
35 | .tags - list of tags on the file |
|
35 | .tags - list of tags on the file | |
36 | .synthetic - is this a synthetic "file ... added on ..." revision? |
|
36 | .synthetic - is this a synthetic "file ... added on ..." revision? | |
|
37 | .mergepoint- the branch that has been merged from (if present in rlog output) | |||
37 | ''' |
|
38 | ''' | |
38 | def __init__(self, **entries): |
|
39 | def __init__(self, **entries): | |
39 | self.__dict__.update(entries) |
|
40 | self.__dict__.update(entries) | |
@@ -105,7 +106,7 b' def createlog(ui, directory=None, root="' | |||||
105 | re_31 = re.compile('----------------------------$') |
|
106 | re_31 = re.compile('----------------------------$') | |
106 | re_32 = re.compile('=============================================================================$') |
|
107 | re_32 = re.compile('=============================================================================$') | |
107 | re_50 = re.compile('revision ([\\d.]+)(\s+locked by:\s+.+;)?$') |
|
108 | re_50 = re.compile('revision ([\\d.]+)(\s+locked by:\s+.+;)?$') | |
108 | re_60 = re.compile(r'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?') |
|
109 | re_60 = re.compile(r'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?(.*mergepoint:\s+([^;]+);)?') | |
109 | re_70 = re.compile('branches: (.+);$') |
|
110 | re_70 = re.compile('branches: (.+);$') | |
110 |
|
111 | |||
111 | file_added_re = re.compile(r'file [^/]+ was (initially )?added on branch') |
|
112 | file_added_re = re.compile(r'file [^/]+ was (initially )?added on branch') | |
@@ -187,6 +188,7 b' def createlog(ui, directory=None, root="' | |||||
187 |
|
188 | |||
188 | # state machine begins here |
|
189 | # state machine begins here | |
189 | tags = {} # dictionary of revisions on current file with their tags |
|
190 | tags = {} # dictionary of revisions on current file with their tags | |
|
191 | branchmap = {} # mapping between branch names and revision numbers | |||
190 | state = 0 |
|
192 | state = 0 | |
191 | store = False # set when a new record can be appended |
|
193 | store = False # set when a new record can be appended | |
192 |
|
194 | |||
@@ -244,6 +246,7 b' def createlog(ui, directory=None, root="' | |||||
244 | elif state == 2: |
|
246 | elif state == 2: | |
245 | # expect 'symbolic names' |
|
247 | # expect 'symbolic names' | |
246 | if re_20.match(line): |
|
248 | if re_20.match(line): | |
|
249 | branchmap = {} | |||
247 | state = 3 |
|
250 | state = 3 | |
248 |
|
251 | |||
249 | elif state == 3: |
|
252 | elif state == 3: | |
@@ -261,6 +264,7 b' def createlog(ui, directory=None, root="' | |||||
261 | if rev not in tags: |
|
264 | if rev not in tags: | |
262 | tags[rev] = [] |
|
265 | tags[rev] = [] | |
263 | tags[rev].append(match.group(1)) |
|
266 | tags[rev].append(match.group(1)) | |
|
267 | branchmap[match.group(1)] = match.group(2) | |||
264 |
|
268 | |||
265 | elif re_31.match(line): |
|
269 | elif re_31.match(line): | |
266 | state = 5 |
|
270 | state = 5 | |
@@ -311,6 +315,18 b' def createlog(ui, directory=None, root="' | |||||
311 | e.lines = (0, int(match.group(6))) |
|
315 | e.lines = (0, int(match.group(6))) | |
312 | else: |
|
316 | else: | |
313 | e.lines = None |
|
317 | e.lines = None | |
|
318 | ||||
|
319 | if match.group(7): # cvsnt mergepoint | |||
|
320 | myrev = match.group(8).split('.') | |||
|
321 | if len(myrev) == 2: # head | |||
|
322 | e.mergepoint = 'HEAD' | |||
|
323 | else: | |||
|
324 | myrev = '.'.join(myrev[:-2] + ['0', myrev[-2]]) | |||
|
325 | branches = [b for b in branchmap if branchmap[b] == myrev] | |||
|
326 | assert len(branches) == 1, 'unknown branch: %s' % e.mergepoint | |||
|
327 | e.mergepoint = branches[0] | |||
|
328 | else: | |||
|
329 | e.mergepoint = None | |||
314 | e.comment = [] |
|
330 | e.comment = [] | |
315 | state = 7 |
|
331 | state = 7 | |
316 |
|
332 | |||
@@ -420,6 +436,7 b' class changeset(object):' | |||||
420 | .parents - list of one or two parent changesets |
|
436 | .parents - list of one or two parent changesets | |
421 | .tags - list of tags on this changeset |
|
437 | .tags - list of tags on this changeset | |
422 | .synthetic - from synthetic revision "file ... added on branch ..." |
|
438 | .synthetic - from synthetic revision "file ... added on branch ..." | |
|
439 | .mergepoint- the branch that has been merged from (if present in rlog output) | |||
423 | ''' |
|
440 | ''' | |
424 | def __init__(self, **entries): |
|
441 | def __init__(self, **entries): | |
425 | self.__dict__.update(entries) |
|
442 | self.__dict__.update(entries) | |
@@ -448,7 +465,8 b' def createchangeset(ui, log, fuzz=60, me' | |||||
448 | (c.date[0] + c.date[1]) + fuzz) and |
|
465 | (c.date[0] + c.date[1]) + fuzz) and | |
449 | e.file not in files): |
|
466 | e.file not in files): | |
450 | c = changeset(comment=e.comment, author=e.author, |
|
467 | c = changeset(comment=e.comment, author=e.author, | |
451 |
branch=e.branch, date=e.date, entries=[] |
|
468 | branch=e.branch, date=e.date, entries=[], | |
|
469 | mergepoint=e.mergepoint) | |||
452 | changesets.append(c) |
|
470 | changesets.append(c) | |
453 | files = {} |
|
471 | files = {} | |
454 | if len(changesets) % 100 == 0: |
|
472 | if len(changesets) % 100 == 0: | |
@@ -595,6 +613,11 b' def createchangeset(ui, log, fuzz=60, me' | |||||
595 | if p is not None: |
|
613 | if p is not None: | |
596 | c.parents.append(p) |
|
614 | c.parents.append(p) | |
597 |
|
615 | |||
|
616 | if c.mergepoint: | |||
|
617 | if c.mergepoint == 'HEAD': | |||
|
618 | c.mergepoint = None | |||
|
619 | c.parents.append(changesets[branches[c.mergepoint]]) | |||
|
620 | ||||
598 | if mergefrom: |
|
621 | if mergefrom: | |
599 | m = mergefrom.search(c.comment) |
|
622 | m = mergefrom.search(c.comment) | |
600 | if m: |
|
623 | if m: |
General Comments 0
You need to be logged in to leave comments.
Login now