Show More
@@ -0,0 +1,50 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | "$TESTDIR/hghave" cvs cvsps || exit 80 | |||
|
4 | ||||
|
5 | echo "[extensions]" >> $HGRCPATH | |||
|
6 | echo "convert = " >> $HGRCPATH | |||
|
7 | ||||
|
8 | echo % create cvs repository | |||
|
9 | mkdir cvsrepo | |||
|
10 | cd cvsrepo | |||
|
11 | export CVSROOT=`pwd` | |||
|
12 | cd .. | |||
|
13 | ||||
|
14 | cvs -q -d "$CVSROOT" init | |||
|
15 | ||||
|
16 | echo % create source directory | |||
|
17 | mkdir src-temp | |||
|
18 | cd src-temp | |||
|
19 | echo a > a | |||
|
20 | mkdir b | |||
|
21 | cd b | |||
|
22 | echo c > c | |||
|
23 | cd .. | |||
|
24 | ||||
|
25 | echo % import source directory | |||
|
26 | cvs -q import -m import src INITIAL start | |||
|
27 | cd .. | |||
|
28 | ||||
|
29 | echo % checkout source directory | |||
|
30 | cvs -q checkout src | |||
|
31 | ||||
|
32 | echo % convert fresh repo | |||
|
33 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' | |||
|
34 | cat src-hg/a | |||
|
35 | cat src-hg/b/c | |||
|
36 | ||||
|
37 | echo % commit new file revisions | |||
|
38 | cd src | |||
|
39 | echo a >> a | |||
|
40 | echo c >> b/c | |||
|
41 | cvs -q commit -mci1 . | sed -e 's:.*src/\(.*\),v:src/\1,v:g' | |||
|
42 | cd .. | |||
|
43 | ||||
|
44 | echo % convert again | |||
|
45 | hg convert src src-hg | sed -e 's/connecting to.*cvsrepo/connecting to cvsrepo/g' | |||
|
46 | cat src-hg/a | |||
|
47 | cat src-hg/b/c | |||
|
48 | ||||
|
49 | ||||
|
50 |
@@ -0,0 +1,43 b'' | |||||
|
1 | % create cvs repository | |||
|
2 | % create source directory | |||
|
3 | % import source directory | |||
|
4 | N src/a | |||
|
5 | N src/b/c | |||
|
6 | ||||
|
7 | No conflicts created by this import | |||
|
8 | ||||
|
9 | % checkout source directory | |||
|
10 | U src/a | |||
|
11 | U src/b/c | |||
|
12 | % convert fresh repo | |||
|
13 | initializing destination src-hg repository | |||
|
14 | connecting to cvsrepo | |||
|
15 | scanning source... | |||
|
16 | sorting... | |||
|
17 | converting... | |||
|
18 | 1 Initial revision | |||
|
19 | 0 import | |||
|
20 | updating tags | |||
|
21 | a | |||
|
22 | c | |||
|
23 | % commit new file revisions | |||
|
24 | Checking in a; | |||
|
25 | src/a,v <-- a | |||
|
26 | new revision: 1.2; previous revision: 1.1 | |||
|
27 | done | |||
|
28 | Checking in b/c; | |||
|
29 | src/b/c,v <-- c | |||
|
30 | new revision: 1.2; previous revision: 1.1 | |||
|
31 | done | |||
|
32 | % convert again | |||
|
33 | destination src-hg is a Mercurial repository | |||
|
34 | connecting to cvsrepo | |||
|
35 | scanning source... | |||
|
36 | sorting... | |||
|
37 | converting... | |||
|
38 | 0 ci1 | |||
|
39 | updating tags | |||
|
40 | a | |||
|
41 | a | |||
|
42 | c | |||
|
43 | c |
@@ -40,9 +40,10 b' class convert_cvs(converter_source):' | |||||
40 | try: |
|
40 | try: | |
41 | # date |
|
41 | # date | |
42 | util.parsedate(self.rev, ['%Y/%m/%d %H:%M:%S']) |
|
42 | util.parsedate(self.rev, ['%Y/%m/%d %H:%M:%S']) | |
43 |
cmd = "%s |
|
43 | cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev) | |
44 | except util.Abort: |
|
44 | except util.Abort: | |
45 | raise util.Abort('revision %s is not a patchset number or date' % self.rev) |
|
45 | raise util.Abort('revision %s is not a patchset number or date' % self.rev) | |
|
46 | cmd += " 2>&1" | |||
46 |
|
47 | |||
47 | d = os.getcwd() |
|
48 | d = os.getcwd() | |
48 | try: |
|
49 | try: | |
@@ -166,7 +167,8 b' class convert_cvs(converter_source):' | |||||
166 | if root.startswith(":ext:"): |
|
167 | if root.startswith(":ext:"): | |
167 | root = root[5:] |
|
168 | root = root[5:] | |
168 | m = re.match(r'(?:([^@:/]+)@)?([^:/]+):?(.*)', root) |
|
169 | m = re.match(r'(?:([^@:/]+)@)?([^:/]+):?(.*)', root) | |
169 | if not m: |
|
170 | # Do not take Windows path "c:\foo\bar" for a connection strings | |
|
171 | if os.path.isdir(root) or not m: | |||
170 | conntype = "local" |
|
172 | conntype = "local" | |
171 | else: |
|
173 | else: | |
172 | conntype = "rsh" |
|
174 | conntype = "rsh" | |
@@ -180,7 +182,10 b' class convert_cvs(converter_source):' | |||||
180 | else: |
|
182 | else: | |
181 | cmd = [rsh, host] + cmd |
|
183 | cmd = [rsh, host] + cmd | |
182 |
|
184 | |||
183 | self.writep, self.readp = os.popen2(cmd) |
|
185 | # popen2 does not support argument lists under Windows | |
|
186 | cmd = [util.shellquote(arg) for arg in cmd] | |||
|
187 | cmd = util.quotecommand(' '.join(cmd)) | |||
|
188 | self.writep, self.readp = os.popen2(cmd, 'b') | |||
184 |
|
189 | |||
185 | self.realroot = root |
|
190 | self.realroot = root | |
186 |
|
191 | |||
@@ -206,7 +211,7 b' class convert_cvs(converter_source):' | |||||
206 | raise IOError |
|
211 | raise IOError | |
207 |
|
212 | |||
208 | args = ("-N -P -kk -r %s --" % rev).split() |
|
213 | args = ("-N -P -kk -r %s --" % rev).split() | |
209 |
args.append( |
|
214 | args.append(self.cvsrepo + '/' + name) | |
210 | for x in args: |
|
215 | for x in args: | |
211 | self.writep.write("Argument %s\n" % x) |
|
216 | self.writep.write("Argument %s\n" % x) | |
212 | self.writep.write("Directory .\n%s\nco\n" % self.realroot) |
|
217 | self.writep.write("Directory .\n%s\nco\n" % self.realroot) |
@@ -11,7 +11,7 b' import tempfile' | |||||
11 |
|
11 | |||
12 | tempprefix = 'hg-hghave-' |
|
12 | tempprefix = 'hg-hghave-' | |
13 |
|
13 | |||
14 | def matchoutput(cmd, regexp): |
|
14 | def matchoutput(cmd, regexp, ignorestatus=False): | |
15 | """Return True if cmd executes successfully and its output |
|
15 | """Return True if cmd executes successfully and its output | |
16 | is matched by the supplied regular expression. |
|
16 | is matched by the supplied regular expression. | |
17 | """ |
|
17 | """ | |
@@ -19,7 +19,7 b' def matchoutput(cmd, regexp):' | |||||
19 | fh = os.popen(cmd) |
|
19 | fh = os.popen(cmd) | |
20 | s = fh.read() |
|
20 | s = fh.read() | |
21 | ret = fh.close() |
|
21 | ret = fh.close() | |
22 | return ret is None and r.search(s) |
|
22 | return (ignorestatus or ret is None) and r.search(s) | |
23 |
|
23 | |||
24 | def has_symlink(): |
|
24 | def has_symlink(): | |
25 | return hasattr(os, "symlink") |
|
25 | return hasattr(os, "symlink") | |
@@ -27,6 +27,12 b' def has_symlink():' | |||||
27 | def has_fifo(): |
|
27 | def has_fifo(): | |
28 | return hasattr(os, "mkfifo") |
|
28 | return hasattr(os, "mkfifo") | |
29 |
|
29 | |||
|
30 | def has_cvs(): | |||
|
31 | return matchoutput('cvs --version 2>&1', r'Concurrent Versions System') | |||
|
32 | ||||
|
33 | def has_cvsps(): | |||
|
34 | return matchoutput('cvsps -h -q 2>&1', r'cvsps version', True) | |||
|
35 | ||||
30 | def has_executablebit(): |
|
36 | def has_executablebit(): | |
31 | fd, path = tempfile.mkstemp(prefix=tempprefix) |
|
37 | fd, path = tempfile.mkstemp(prefix=tempprefix) | |
32 | os.close(fd) |
|
38 | os.close(fd) | |
@@ -77,6 +83,8 b' def has_svn_bindings():' | |||||
77 | return False |
|
83 | return False | |
78 |
|
84 | |||
79 | checks = { |
|
85 | checks = { | |
|
86 | "cvs": (has_cvs, "cvs client"), | |||
|
87 | "cvsps": (has_cvsps, "cvsps utility"), | |||
80 | "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), |
|
88 | "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"), | |
81 | "execbit": (has_executablebit, "executable bit"), |
|
89 | "execbit": (has_executablebit, "executable bit"), | |
82 | "git": (has_git, "git command line client"), |
|
90 | "git": (has_git, "git command line client"), |
General Comments 0
You need to be logged in to leave comments.
Login now