author | Brendan Cully <brendan@kublai.com> |
Mon, 29 Jun 2009 09:00:37 -0700 | |
changeset 8960 | 8a5657ecdaaf |
parent 8523 | 5b7da468531b |
child 9042 | 95046688f80f |
permissions | -rwxr-xr-x |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
1 |
#!/bin/sh |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
2 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
3 |
"$TESTDIR/hghave" p4 || exit 80 |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
4 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
5 |
echo "[extensions]" >> $HGRCPATH |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
6 |
echo "convert = " >> $HGRCPATH |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
7 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
8 |
echo % create p4 depot |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
9 |
export P4ROOT=$PWD/depot |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
10 |
export P4AUDIT=$P4ROOT/audit |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
11 |
export P4JOURNAL=$P4ROOT/journal |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
12 |
export P4LOG=$P4ROOT/log |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
13 |
export P4PORT=localhost:16661 |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
14 |
export P4DEBUG=1 |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
15 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
16 |
echo % start the p4 server |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
17 |
[ ! -d $P4ROOT ] && mkdir $P4ROOT |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
18 |
p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
19 |
trap "echo % stop the p4 server ; p4 admin stop" EXIT |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
20 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
21 |
# wait for the server to initialize |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
22 |
while ! p4 ; do |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
23 |
sleep 1 |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
24 |
done >/dev/null 2>/dev/null |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
25 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
26 |
echo % create a client spec |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
27 |
export P4CLIENT=hg-p4-import |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
28 |
DEPOTPATH=//depot/test-mercurial-import/... |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
29 |
p4 client -o | sed '/^View:/,$ d' >p4client |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
30 |
echo View: >>p4client |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
31 |
echo " $DEPOTPATH //$P4CLIENT/..." >>p4client |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
32 |
p4 client -i <p4client |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
33 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
34 |
echo % populate the depot |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
35 |
echo a > a |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
36 |
mkdir b |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
37 |
echo c > b/c |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
38 |
p4 add a b/c |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
39 |
p4 submit -d initial |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
40 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
41 |
echo % change some files |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
42 |
p4 edit a |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
43 |
echo aa >> a |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
44 |
p4 submit -d "change a" |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
45 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
46 |
p4 edit b/c |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
47 |
echo cc >> b/c |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
48 |
p4 submit -d "change b/c" |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
49 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
50 |
echo % convert |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
51 |
hg convert -s p4 $DEPOTPATH dst |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
8063
diff
changeset
|
52 |
hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
53 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
54 |
echo % change some files |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
55 |
p4 edit a b/c |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
56 |
echo aaa >> a |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
57 |
echo ccc >> b/c |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
58 |
p4 submit -d "change a b/c" |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
59 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
60 |
echo % convert again |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
61 |
hg convert -s p4 $DEPOTPATH dst |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
8063
diff
changeset
|
62 |
hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
63 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
64 |
echo % interesting names |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
65 |
echo dddd > "d d" |
8063
ee8d9b93b316
convert/p4: win32 fixes
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
66 |
mkdir " e" |
ee8d9b93b316
convert/p4: win32 fixes
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
67 |
echo fff >" e/ f" |
ee8d9b93b316
convert/p4: win32 fixes
Patrick Mezard <pmezard@gmail.com>
parents:
7823
diff
changeset
|
68 |
p4 add "d d" " e/ f" |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
69 |
p4 submit -d "add d e f" |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
70 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
71 |
echo % convert again |
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
72 |
hg convert -s p4 $DEPOTPATH dst |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
8063
diff
changeset
|
73 |
hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' |
7823
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
74 |
|
11efa41037e2
convert: Perforce source for conversion to Mercurial
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
75 |