Show More
@@ -1,75 +1,75 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" p4 || exit 80 |
|
3 | "$TESTDIR/hghave" p4 || exit 80 | |
4 |
|
4 | |||
5 | echo "[extensions]" >> $HGRCPATH |
|
5 | echo "[extensions]" >> $HGRCPATH | |
6 | echo "convert = " >> $HGRCPATH |
|
6 | echo "convert = " >> $HGRCPATH | |
7 |
|
7 | |||
8 | echo % create p4 depot |
|
8 | echo % create p4 depot | |
9 |
P4ROOT= |
|
9 | P4ROOT=`pwd`/depot; export P4ROOT | |
10 | P4AUDIT=$P4ROOT/audit; export P4AUDIT |
|
10 | P4AUDIT=$P4ROOT/audit; export P4AUDIT | |
11 | P4JOURNAL=$P4ROOT/journal; export P4JOURNAL |
|
11 | P4JOURNAL=$P4ROOT/journal; export P4JOURNAL | |
12 | P4LOG=$P4ROOT/log; export P4LOG |
|
12 | P4LOG=$P4ROOT/log; export P4LOG | |
13 | P4PORT=localhost:16661; export P4PORT |
|
13 | P4PORT=localhost:16661; export P4PORT | |
14 | P4DEBUG=1; export P4DEBUG |
|
14 | P4DEBUG=1; export P4DEBUG | |
15 |
|
15 | |||
16 | echo % start the p4 server |
|
16 | echo % start the p4 server | |
17 | [ ! -d $P4ROOT ] && mkdir $P4ROOT |
|
17 | [ ! -d $P4ROOT ] && mkdir $P4ROOT | |
18 | p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & |
|
18 | p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr & | |
19 | trap "echo % stop the p4 server ; p4 admin stop" EXIT |
|
19 | trap "echo % stop the p4 server ; p4 admin stop" EXIT | |
20 |
|
20 | |||
21 | # wait for the server to initialize |
|
21 | # wait for the server to initialize | |
22 | while ! p4 ; do |
|
22 | while ! p4 ; do | |
23 | sleep 1 |
|
23 | sleep 1 | |
24 | done >/dev/null 2>/dev/null |
|
24 | done >/dev/null 2>/dev/null | |
25 |
|
25 | |||
26 | echo % create a client spec |
|
26 | echo % create a client spec | |
27 | P4CLIENT=hg-p4-import; export P4CLIENT |
|
27 | P4CLIENT=hg-p4-import; export P4CLIENT | |
28 | DEPOTPATH=//depot/test-mercurial-import/... |
|
28 | DEPOTPATH=//depot/test-mercurial-import/... | |
29 | p4 client -o | sed '/^View:/,$ d' >p4client |
|
29 | p4 client -o | sed '/^View:/,$ d' >p4client | |
30 | echo View: >>p4client |
|
30 | echo View: >>p4client | |
31 | echo " $DEPOTPATH //$P4CLIENT/..." >>p4client |
|
31 | echo " $DEPOTPATH //$P4CLIENT/..." >>p4client | |
32 | p4 client -i <p4client |
|
32 | p4 client -i <p4client | |
33 |
|
33 | |||
34 | echo % populate the depot |
|
34 | echo % populate the depot | |
35 | echo a > a |
|
35 | echo a > a | |
36 | mkdir b |
|
36 | mkdir b | |
37 | echo c > b/c |
|
37 | echo c > b/c | |
38 | p4 add a b/c |
|
38 | p4 add a b/c | |
39 | p4 submit -d initial |
|
39 | p4 submit -d initial | |
40 |
|
40 | |||
41 | echo % change some files |
|
41 | echo % change some files | |
42 | p4 edit a |
|
42 | p4 edit a | |
43 | echo aa >> a |
|
43 | echo aa >> a | |
44 | p4 submit -d "change a" |
|
44 | p4 submit -d "change a" | |
45 |
|
45 | |||
46 | p4 edit b/c |
|
46 | p4 edit b/c | |
47 | echo cc >> b/c |
|
47 | echo cc >> b/c | |
48 | p4 submit -d "change b/c" |
|
48 | p4 submit -d "change b/c" | |
49 |
|
49 | |||
50 | echo % convert |
|
50 | echo % convert | |
51 | hg convert -s p4 $DEPOTPATH dst |
|
51 | hg convert -s p4 $DEPOTPATH dst | |
52 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' |
|
52 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' | |
53 |
|
53 | |||
54 | echo % change some files |
|
54 | echo % change some files | |
55 | p4 edit a b/c |
|
55 | p4 edit a b/c | |
56 | echo aaa >> a |
|
56 | echo aaa >> a | |
57 | echo ccc >> b/c |
|
57 | echo ccc >> b/c | |
58 | p4 submit -d "change a b/c" |
|
58 | p4 submit -d "change a b/c" | |
59 |
|
59 | |||
60 | echo % convert again |
|
60 | echo % convert again | |
61 | hg convert -s p4 $DEPOTPATH dst |
|
61 | hg convert -s p4 $DEPOTPATH dst | |
62 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' |
|
62 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' | |
63 |
|
63 | |||
64 | echo % interesting names |
|
64 | echo % interesting names | |
65 | echo dddd > "d d" |
|
65 | echo dddd > "d d" | |
66 | mkdir " e" |
|
66 | mkdir " e" | |
67 | echo fff >" e/ f" |
|
67 | echo fff >" e/ f" | |
68 | p4 add "d d" " e/ f" |
|
68 | p4 add "d d" " e/ f" | |
69 | p4 submit -d "add d e f" |
|
69 | p4 submit -d "add d e f" | |
70 |
|
70 | |||
71 | echo % convert again |
|
71 | echo % convert again | |
72 | hg convert -s p4 $DEPOTPATH dst |
|
72 | hg convert -s p4 $DEPOTPATH dst | |
73 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' |
|
73 | hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n' | |
74 |
|
74 | |||
75 |
|
75 |
@@ -1,35 +1,35 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | cat > engine.py << EOF |
|
3 | cat > engine.py << EOF | |
4 |
|
4 | |||
5 | from mercurial import templater |
|
5 | from mercurial import templater | |
6 |
|
6 | |||
7 | class mytemplater(object): |
|
7 | class mytemplater(object): | |
8 | def __init__(self, loader, filters, defaults): |
|
8 | def __init__(self, loader, filters, defaults): | |
9 | self.loader = loader |
|
9 | self.loader = loader | |
10 |
|
10 | |||
11 | def process(self, t, map): |
|
11 | def process(self, t, map): | |
12 | tmpl = self.loader(t) |
|
12 | tmpl = self.loader(t) | |
13 | for k, v in map.iteritems(): |
|
13 | for k, v in map.iteritems(): | |
14 | v = templater.stringify(v) |
|
14 | v = templater.stringify(v) | |
15 | tmpl = tmpl.replace('{{%s}}' % k, v) |
|
15 | tmpl = tmpl.replace('{{%s}}' % k, v) | |
16 | yield tmpl |
|
16 | yield tmpl | |
17 |
|
17 | |||
18 | templater.engines['my'] = mytemplater |
|
18 | templater.engines['my'] = mytemplater | |
19 | EOF |
|
19 | EOF | |
20 |
|
20 | |||
21 | hg init test |
|
21 | hg init test | |
22 | echo '[extensions]' > test/.hg/hgrc |
|
22 | echo '[extensions]' > test/.hg/hgrc | |
23 |
echo "engine = |
|
23 | echo "engine = `pwd`/engine.py" >> test/.hg/hgrc | |
24 |
|
24 | |||
25 | cd test |
|
25 | cd test | |
26 | cat > mymap << EOF |
|
26 | cat > mymap << EOF | |
27 | changeset = my:changeset.txt |
|
27 | changeset = my:changeset.txt | |
28 | EOF |
|
28 | EOF | |
29 |
|
29 | |||
30 | cat > changeset.txt << EOF |
|
30 | cat > changeset.txt << EOF | |
31 | {{rev}} {{node}} {{author}} |
|
31 | {{rev}} {{node}} {{author}} | |
32 | EOF |
|
32 | EOF | |
33 |
|
33 | |||
34 | hg ci -Ama |
|
34 | hg ci -Ama | |
35 | hg log --style=./mymap |
|
35 | hg log --style=./mymap |
General Comments 0
You need to be logged in to leave comments.
Login now