Show More
@@ -1,126 +1,129 | |||||
1 | Test applying context diffs |
|
1 | Test applying context diffs | |
2 |
|
2 | |||
3 | $ cat > writepatterns.py <<EOF |
|
3 | $ cat > writepatterns.py <<EOF | |
4 | > import sys |
|
4 | > import sys | |
5 | > |
|
5 | > | |
6 | > path = sys.argv[1] |
|
6 | > path = sys.argv[1] | |
7 | > lasteol = sys.argv[2] == '1' |
|
7 | > lasteol = sys.argv[2] == '1' | |
8 | > patterns = sys.argv[3:] |
|
8 | > patterns = sys.argv[3:] | |
9 | > |
|
9 | > | |
10 | > fp = open(path, 'wb') |
|
10 | > fp = open(path, 'wb') | |
11 | > for i, pattern in enumerate(patterns): |
|
11 | > for i, pattern in enumerate(patterns): | |
12 | > count = int(pattern[0:-1]) |
|
12 | > count = int(pattern[0:-1]) | |
13 | > char = pattern[-1].encode('utf8') + b'\n' |
|
13 | > char = pattern[-1].encode('utf8') + b'\n' | |
14 | > if not lasteol and i == len(patterns) - 1: |
|
14 | > if not lasteol and i == len(patterns) - 1: | |
15 | > fp.write((char*count)[:-1]) |
|
15 | > fp.write((char*count)[:-1]) | |
16 | > else: |
|
16 | > else: | |
17 | > fp.write(char*count) |
|
17 | > fp.write(char*count) | |
18 | > fp.close() |
|
18 | > fp.close() | |
19 | > EOF |
|
19 | > EOF | |
20 | $ cat > cat.py <<EOF |
|
20 | $ cat > cat.py <<EOF | |
21 | > import sys |
|
21 | > import sys | |
22 | > sys.stdout.write(repr(open(sys.argv[1], 'rb').read()) + '\n') |
|
22 | > from mercurial import pycompat | |
|
23 | > from mercurial.utils import stringutil | |||
|
24 | > pycompat.stdout.write(b'%s\n' | |||
|
25 | > % stringutil.pprint(open(sys.argv[1], 'rb').read())) | |||
23 | > EOF |
|
26 | > EOF | |
24 |
|
27 | |||
25 | Initialize the test repository |
|
28 | Initialize the test repository | |
26 |
|
29 | |||
27 | $ hg init repo |
|
30 | $ hg init repo | |
28 | $ cd repo |
|
31 | $ cd repo | |
29 | $ "$PYTHON" ../writepatterns.py a 0 5A 1B 5C 1D |
|
32 | $ "$PYTHON" ../writepatterns.py a 0 5A 1B 5C 1D | |
30 | $ "$PYTHON" ../writepatterns.py b 1 1A 1B |
|
33 | $ "$PYTHON" ../writepatterns.py b 1 1A 1B | |
31 | $ "$PYTHON" ../writepatterns.py c 1 5A |
|
34 | $ "$PYTHON" ../writepatterns.py c 1 5A | |
32 | $ "$PYTHON" ../writepatterns.py d 1 5A 1B |
|
35 | $ "$PYTHON" ../writepatterns.py d 1 5A 1B | |
33 | $ hg add |
|
36 | $ hg add | |
34 | adding a |
|
37 | adding a | |
35 | adding b |
|
38 | adding b | |
36 | adding c |
|
39 | adding c | |
37 | adding d |
|
40 | adding d | |
38 | $ hg ci -m addfiles |
|
41 | $ hg ci -m addfiles | |
39 |
|
42 | |||
40 | Add file, missing a last end of line |
|
43 | Add file, missing a last end of line | |
41 |
|
44 | |||
42 | $ hg import --no-commit - <<EOF |
|
45 | $ hg import --no-commit - <<EOF | |
43 | > *** /dev/null 2010-10-16 18:05:49.000000000 +0200 |
|
46 | > *** /dev/null 2010-10-16 18:05:49.000000000 +0200 | |
44 | > --- b/newnoeol 2010-10-16 18:23:26.000000000 +0200 |
|
47 | > --- b/newnoeol 2010-10-16 18:23:26.000000000 +0200 | |
45 | > *************** |
|
48 | > *************** | |
46 | > *** 0 **** |
|
49 | > *** 0 **** | |
47 | > --- 1,2 ---- |
|
50 | > --- 1,2 ---- | |
48 | > + a |
|
51 | > + a | |
49 | > + b |
|
52 | > + b | |
50 | > \ No newline at end of file |
|
53 | > \ No newline at end of file | |
51 | > *** a/a Sat Oct 16 16:35:51 2010 |
|
54 | > *** a/a Sat Oct 16 16:35:51 2010 | |
52 | > --- b/a Sat Oct 16 16:35:51 2010 |
|
55 | > --- b/a Sat Oct 16 16:35:51 2010 | |
53 | > *************** |
|
56 | > *************** | |
54 | > *** 3,12 **** |
|
57 | > *** 3,12 **** | |
55 | > A |
|
58 | > A | |
56 | > A |
|
59 | > A | |
57 | > A |
|
60 | > A | |
58 | > ! B |
|
61 | > ! B | |
59 | > C |
|
62 | > C | |
60 | > C |
|
63 | > C | |
61 | > C |
|
64 | > C | |
62 | > C |
|
65 | > C | |
63 | > C |
|
66 | > C | |
64 | > ! D |
|
67 | > ! D | |
65 | > \ No newline at end of file |
|
68 | > \ No newline at end of file | |
66 | > --- 3,13 ---- |
|
69 | > --- 3,13 ---- | |
67 | > A |
|
70 | > A | |
68 | > A |
|
71 | > A | |
69 | > A |
|
72 | > A | |
70 | > ! E |
|
73 | > ! E | |
71 | > C |
|
74 | > C | |
72 | > C |
|
75 | > C | |
73 | > C |
|
76 | > C | |
74 | > C |
|
77 | > C | |
75 | > C |
|
78 | > C | |
76 | > ! F |
|
79 | > ! F | |
77 | > ! F |
|
80 | > ! F | |
78 | > |
|
81 | > | |
79 | > *** a/b 2010-10-16 18:40:38.000000000 +0200 |
|
82 | > *** a/b 2010-10-16 18:40:38.000000000 +0200 | |
80 | > --- /dev/null 2010-10-16 18:05:49.000000000 +0200 |
|
83 | > --- /dev/null 2010-10-16 18:05:49.000000000 +0200 | |
81 | > *************** |
|
84 | > *************** | |
82 | > *** 1,2 **** |
|
85 | > *** 1,2 **** | |
83 | > - A |
|
86 | > - A | |
84 | > - B |
|
87 | > - B | |
85 | > --- 0 ---- |
|
88 | > --- 0 ---- | |
86 | > *** a/c Sat Oct 16 21:34:26 2010 |
|
89 | > *** a/c Sat Oct 16 21:34:26 2010 | |
87 | > --- b/c Sat Oct 16 21:34:27 2010 |
|
90 | > --- b/c Sat Oct 16 21:34:27 2010 | |
88 | > *************** |
|
91 | > *************** | |
89 | > *** 3,5 **** |
|
92 | > *** 3,5 **** | |
90 | > --- 3,7 ---- |
|
93 | > --- 3,7 ---- | |
91 | > A |
|
94 | > A | |
92 | > A |
|
95 | > A | |
93 | > A |
|
96 | > A | |
94 | > + B |
|
97 | > + B | |
95 | > + B |
|
98 | > + B | |
96 | > *** a/d Sat Oct 16 21:47:20 2010 |
|
99 | > *** a/d Sat Oct 16 21:47:20 2010 | |
97 | > --- b/d Sat Oct 16 21:47:22 2010 |
|
100 | > --- b/d Sat Oct 16 21:47:22 2010 | |
98 | > *************** |
|
101 | > *************** | |
99 | > *** 2,6 **** |
|
102 | > *** 2,6 **** | |
100 | > A |
|
103 | > A | |
101 | > A |
|
104 | > A | |
102 | > A |
|
105 | > A | |
103 | > - A |
|
106 | > - A | |
104 | > - B |
|
107 | > - B | |
105 | > --- 2,4 ---- |
|
108 | > --- 2,4 ---- | |
106 | > EOF |
|
109 | > EOF | |
107 | applying patch from stdin |
|
110 | applying patch from stdin | |
108 | $ hg st |
|
111 | $ hg st | |
109 | M a |
|
112 | M a | |
110 | M c |
|
113 | M c | |
111 | M d |
|
114 | M d | |
112 | A newnoeol |
|
115 | A newnoeol | |
113 | R b |
|
116 | R b | |
114 |
|
117 | |||
115 | What's in a |
|
118 | What's in a | |
116 |
|
119 | |||
117 | $ "$PYTHON" ../cat.py a |
|
120 | $ "$PYTHON" ../cat.py a | |
118 | 'A\nA\nA\nA\nA\nE\nC\nC\nC\nC\nC\nF\nF\n' |
|
121 | 'A\nA\nA\nA\nA\nE\nC\nC\nC\nC\nC\nF\nF\n' | |
119 | $ "$PYTHON" ../cat.py newnoeol |
|
122 | $ "$PYTHON" ../cat.py newnoeol | |
120 | 'a\nb' |
|
123 | 'a\nb' | |
121 | $ "$PYTHON" ../cat.py c |
|
124 | $ "$PYTHON" ../cat.py c | |
122 | 'A\nA\nA\nA\nA\nB\nB\n' |
|
125 | 'A\nA\nA\nA\nA\nB\nB\n' | |
123 | $ "$PYTHON" ../cat.py d |
|
126 | $ "$PYTHON" ../cat.py d | |
124 | 'A\nA\nA\nA\n' |
|
127 | 'A\nA\nA\nA\n' | |
125 |
|
128 | |||
126 | $ cd .. |
|
129 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now