##// END OF EJS Templates
...
Matt Mackall -
r2298:4be9a79b merge default
parent child Browse files
Show More
@@ -0,0 +1,54 b''
1 #!/bin/sh
2
3 hg init test
4 cd test
5 echo 0 > afile
6 hg add afile
7 hg commit -m "0.0" -d "1000000 0"
8 echo 1 >> afile
9 hg commit -m "0.1" -d "1000000 0"
10 echo 2 >> afile
11 hg commit -m "0.2" -d "1000000 0"
12 echo 3 >> afile
13 hg commit -m "0.3" -d "1000000 0"
14 hg update -C 0
15 echo 1 >> afile
16 hg commit -m "1.1" -d "1000000 0"
17 echo 2 >> afile
18 hg commit -m "1.2" -d "1000000 0"
19 echo "a line" > fred
20 echo 3 >> afile
21 hg add fred
22 hg commit -m "1.3" -d "1000000 0"
23 hg mv afile adifferentfile
24 hg commit -m "1.3m" -d "1000000 0"
25 hg update -C 3
26 hg mv afile anotherfile
27 hg commit -m "0.3m" -d "1000000 0"
28 hg verify
29 cd ..
30 hg init empty
31 hg -R test bundle full.hg empty
32 hg -R test unbundle full.hg
33 hg -R empty unbundle full.hg
34 hg -R empty heads
35 hg -R empty verify
36
37 rm -rf empty
38 hg init empty
39 cd empty
40 hg -R bundle://../full.hg log
41 #doesn't work (yet ?)
42 #hg -R bundle://../full.hg verify
43 hg pull bundle://../full.hg
44 cd ..
45
46 rm -rf empty
47 hg init empty
48 hg clone -r 3 test partial
49 hg clone partial partial2
50 cd partial
51 hg -R bundle://../full.hg log
52 hg incoming bundle://../full.hg
53 hg -R bundle://../full.hg outgoing ../partial2
54 cd ..
@@ -0,0 +1,203 b''
1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
3 checking changesets
4 checking manifests
5 crosschecking files in changesets and manifests
6 checking files
7 4 files, 9 changesets, 7 total revisions
8 searching for changes
9 adding changesets
10 adding manifests
11 adding file changes
12 added 0 changesets with 0 changes to 4 files
13 (run 'hg update' to get a working copy)
14 adding changesets
15 adding manifests
16 adding file changes
17 added 9 changesets with 7 changes to 4 files (+1 heads)
18 (run 'hg heads' to see heads, 'hg merge' to merge)
19 changeset: 8:836ac62537ab
20 tag: tip
21 parent: 3:ac69c658229d
22 user: test
23 date: Mon Jan 12 13:46:40 1970 +0000
24 summary: 0.3m
25
26 changeset: 7:80fe151401c2
27 user: test
28 date: Mon Jan 12 13:46:40 1970 +0000
29 summary: 1.3m
30
31 checking changesets
32 checking manifests
33 crosschecking files in changesets and manifests
34 checking files
35 4 files, 9 changesets, 7 total revisions
36 changeset: 8:836ac62537ab
37 tag: tip
38 parent: 3:ac69c658229d
39 user: test
40 date: Mon Jan 12 13:46:40 1970 +0000
41 summary: 0.3m
42
43 changeset: 7:80fe151401c2
44 user: test
45 date: Mon Jan 12 13:46:40 1970 +0000
46 summary: 1.3m
47
48 changeset: 6:1e3f6b843bd6
49 user: test
50 date: Mon Jan 12 13:46:40 1970 +0000
51 summary: 1.3
52
53 changeset: 5:024e4e7df376
54 user: test
55 date: Mon Jan 12 13:46:40 1970 +0000
56 summary: 1.2
57
58 changeset: 4:5f4f3ceb285e
59 parent: 0:5649c9d34dd8
60 user: test
61 date: Mon Jan 12 13:46:40 1970 +0000
62 summary: 1.1
63
64 changeset: 3:ac69c658229d
65 user: test
66 date: Mon Jan 12 13:46:40 1970 +0000
67 summary: 0.3
68
69 changeset: 2:d62976ca1e50
70 user: test
71 date: Mon Jan 12 13:46:40 1970 +0000
72 summary: 0.2
73
74 changeset: 1:10b2180f755b
75 user: test
76 date: Mon Jan 12 13:46:40 1970 +0000
77 summary: 0.1
78
79 changeset: 0:5649c9d34dd8
80 user: test
81 date: Mon Jan 12 13:46:40 1970 +0000
82 summary: 0.0
83
84 pulling from bundle://../full.hg
85 requesting all changes
86 adding changesets
87 adding manifests
88 adding file changes
89 added 9 changesets with 7 changes to 4 files (+1 heads)
90 (run 'hg heads' to see heads, 'hg merge' to merge)
91 requesting all changes
92 adding changesets
93 adding manifests
94 adding file changes
95 added 4 changesets with 4 changes to 1 files
96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 changeset: 8:836ac62537ab
99 tag: tip
100 parent: 3:ac69c658229d
101 user: test
102 date: Mon Jan 12 13:46:40 1970 +0000
103 summary: 0.3m
104
105 changeset: 7:80fe151401c2
106 user: test
107 date: Mon Jan 12 13:46:40 1970 +0000
108 summary: 1.3m
109
110 changeset: 6:1e3f6b843bd6
111 user: test
112 date: Mon Jan 12 13:46:40 1970 +0000
113 summary: 1.3
114
115 changeset: 5:024e4e7df376
116 user: test
117 date: Mon Jan 12 13:46:40 1970 +0000
118 summary: 1.2
119
120 changeset: 4:5f4f3ceb285e
121 parent: 0:5649c9d34dd8
122 user: test
123 date: Mon Jan 12 13:46:40 1970 +0000
124 summary: 1.1
125
126 changeset: 3:ac69c658229d
127 user: test
128 date: Mon Jan 12 13:46:40 1970 +0000
129 summary: 0.3
130
131 changeset: 2:d62976ca1e50
132 user: test
133 date: Mon Jan 12 13:46:40 1970 +0000
134 summary: 0.2
135
136 changeset: 1:10b2180f755b
137 user: test
138 date: Mon Jan 12 13:46:40 1970 +0000
139 summary: 0.1
140
141 changeset: 0:5649c9d34dd8
142 user: test
143 date: Mon Jan 12 13:46:40 1970 +0000
144 summary: 0.0
145
146 searching for changes
147 changeset: 4:5f4f3ceb285e
148 parent: 0:5649c9d34dd8
149 user: test
150 date: Mon Jan 12 13:46:40 1970 +0000
151 summary: 1.1
152
153 changeset: 5:024e4e7df376
154 user: test
155 date: Mon Jan 12 13:46:40 1970 +0000
156 summary: 1.2
157
158 changeset: 6:1e3f6b843bd6
159 user: test
160 date: Mon Jan 12 13:46:40 1970 +0000
161 summary: 1.3
162
163 changeset: 7:80fe151401c2
164 user: test
165 date: Mon Jan 12 13:46:40 1970 +0000
166 summary: 1.3m
167
168 changeset: 8:836ac62537ab
169 tag: tip
170 parent: 3:ac69c658229d
171 user: test
172 date: Mon Jan 12 13:46:40 1970 +0000
173 summary: 0.3m
174
175 searching for changes
176 changeset: 4:5f4f3ceb285e
177 parent: 0:5649c9d34dd8
178 user: test
179 date: Mon Jan 12 13:46:40 1970 +0000
180 summary: 1.1
181
182 changeset: 5:024e4e7df376
183 user: test
184 date: Mon Jan 12 13:46:40 1970 +0000
185 summary: 1.2
186
187 changeset: 6:1e3f6b843bd6
188 user: test
189 date: Mon Jan 12 13:46:40 1970 +0000
190 summary: 1.3
191
192 changeset: 7:80fe151401c2
193 user: test
194 date: Mon Jan 12 13:46:40 1970 +0000
195 summary: 1.3m
196
197 changeset: 8:836ac62537ab
198 tag: tip
199 parent: 3:ac69c658229d
200 user: test
201 date: Mon Jan 12 13:46:40 1970 +0000
202 summary: 0.3m
203
@@ -0,0 +1,72 b''
1 #!/bin/sh
2
3 hg init a
4 cd a
5 echo a > a
6 hg ci -A -d'1 0' -m a
7
8 cd ..
9
10 hg init b
11 cd b
12 echo b > b
13 hg ci -A -d'1 0' -m b
14
15 cd ..
16
17 hg clone a c
18 cd c
19 hg pull -f ../b
20 HGMERGE=merge hg merge
21
22 cd ..
23
24 echo %% -R/--repository
25 hg -R a tip
26 hg --repository b tip
27
28 echo %% abbrev of long option
29 hg --repo c tip
30
31 echo %% --cwd
32 hg --cwd a parents
33
34 echo %% -y/--noninteractive - just be sure it is parsed
35 hg --cwd a tip -q --noninteractive
36 hg --cwd a tip -q -y
37
38 echo %% -q/--quiet
39 hg -R a -q tip
40 hg -R b -q tip
41 hg -R c --quiet parents
42
43 echo %% -v/--verbose
44 hg --cwd c head -v
45 hg --cwd b tip --verbose
46
47 echo %% --config
48 hg --cwd c --config paths.quuxfoo=bar paths | grep -q quuxfoo && echo quuxfoo
49 hg --cwd c --config '' tip -q
50 hg --cwd c --config a.b tip -q
51 hg --cwd c --config a tip -q
52 hg --cwd c --config a.= tip -q
53 hg --cwd c --config .b= tip -q
54
55 echo %% --debug
56 hg --cwd c log --debug
57
58 echo %% --traceback
59 hg --cwd c --config x --traceback tip 2>&1 | grep -i 'traceback'
60
61 echo %% --time
62 hg --cwd a --time tip 2>&1 | grep '^Time:' | sed 's/[0-9][0-9]*/x/g'
63
64 echo %% --version
65 hg --version -q | sed 's/version [a-f0-9+]*/version xxx/'
66
67 echo %% -h/--help
68 hg -h
69 hg --help
70
71 echo %% not tested: --debugger
72
@@ -0,0 +1,205 b''
1 adding a
2 adding b
3 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4 pulling from ../b
5 searching for changes
6 warning: repository is unrelated
7 adding changesets
8 adding manifests
9 adding file changes
10 added 1 changesets with 1 changes to 1 files (+1 heads)
11 (run 'hg heads' to see heads, 'hg merge' to merge)
12 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
13 (branch merge, don't forget to commit)
14 %% -R/--repository
15 changeset: 0:8580ff50825a
16 tag: tip
17 user: test
18 date: Thu Jan 01 00:00:01 1970 +0000
19 summary: a
20
21 changeset: 0:b6c483daf290
22 tag: tip
23 user: test
24 date: Thu Jan 01 00:00:01 1970 +0000
25 summary: b
26
27 %% abbrev of long option
28 changeset: 1:b6c483daf290
29 tag: tip
30 user: test
31 date: Thu Jan 01 00:00:01 1970 +0000
32 summary: b
33
34 %% --cwd
35 changeset: 0:8580ff50825a
36 tag: tip
37 user: test
38 date: Thu Jan 01 00:00:01 1970 +0000
39 summary: a
40
41 %% -y/--noninteractive - just be sure it is parsed
42 0:8580ff50825a
43 0:8580ff50825a
44 %% -q/--quiet
45 0:8580ff50825a
46 0:b6c483daf290
47 0:8580ff50825a
48 1:b6c483daf290
49 %% -v/--verbose
50 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
51 tag: tip
52 user: test
53 date: Thu Jan 01 00:00:01 1970 +0000
54 files: b
55 description:
56 b
57
58
59 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
60 user: test
61 date: Thu Jan 01 00:00:01 1970 +0000
62 files: a
63 description:
64 a
65
66
67 changeset: 0:b6c483daf2907ce5825c0bb50f5716226281cc1a
68 tag: tip
69 user: test
70 date: Thu Jan 01 00:00:01 1970 +0000
71 files: b
72 description:
73 b
74
75
76 %% --config
77 quuxfoo
78 abort: malformed --config option:
79 abort: malformed --config option: a.b
80 abort: malformed --config option: a
81 abort: malformed --config option: a.=
82 abort: malformed --config option: .b=
83 %% --debug
84 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
85 tag: tip
86 parent: -1:0000000000000000000000000000000000000000
87 parent: -1:0000000000000000000000000000000000000000
88 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
89 user: test
90 date: Thu Jan 01 00:00:01 1970 +0000
91 files+: b
92 description:
93 b
94
95
96 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
97 parent: -1:0000000000000000000000000000000000000000
98 parent: -1:0000000000000000000000000000000000000000
99 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
100 user: test
101 date: Thu Jan 01 00:00:01 1970 +0000
102 files+: a
103 description:
104 a
105
106
107 %% --traceback
108 %% --time
109 Time: real x.x secs (user x.x+x.x sys x.x+x.x)
110 %% --version
111 Mercurial Distributed SCM (version xxx)
112 %% -h/--help
113 Mercurial Distributed SCM
114
115 list of commands (use "hg help -v" to show aliases and global options):
116
117 add add the specified files on the next commit
118 annotate show changeset information per file line
119 archive create unversioned archive of a repository revision
120 backout reverse effect of earlier changeset
121 bundle create a changegroup file
122 cat output the latest or given revisions of files
123 clone make a copy of an existing repository
124 commit commit the specified files or all outstanding changes
125 copy mark files as copied for the next commit
126 diff diff repository (or selected files)
127 export dump the header and diffs for one or more changesets
128 grep search for a pattern in specified files and revisions
129 heads show current repository heads
130 help show help for a given command or all commands
131 identify print information about the working copy
132 import import an ordered set of patches
133 incoming show new changesets found in source
134 init create a new repository in the given directory
135 locate locate files matching specific patterns
136 log show revision history of entire repository or files
137 manifest output the latest or given revision of the project manifest
138 merge Merge working directory with another revision
139 outgoing show changesets not found in destination
140 parents show the parents of the working dir or revision
141 paths show definition of symbolic path names
142 pull pull changes from the specified source
143 push push changes to the specified destination
144 recover roll back an interrupted transaction
145 remove remove the specified files on the next commit
146 rename rename files; equivalent of copy + remove
147 revert revert files or dirs to their states as of some revision
148 rollback roll back the last transaction in this repository
149 root print the root (top) of the current working dir
150 serve export the repository via HTTP
151 status show changed files in the working directory
152 tag add a tag for the current tip or a given revision
153 tags list repository tags
154 tip show the tip revision
155 unbundle apply a changegroup file
156 update update or merge working directory
157 verify verify the integrity of the repository
158 version output version and copyright information
159 Mercurial Distributed SCM
160
161 list of commands (use "hg help -v" to show aliases and global options):
162
163 add add the specified files on the next commit
164 annotate show changeset information per file line
165 archive create unversioned archive of a repository revision
166 backout reverse effect of earlier changeset
167 bundle create a changegroup file
168 cat output the latest or given revisions of files
169 clone make a copy of an existing repository
170 commit commit the specified files or all outstanding changes
171 copy mark files as copied for the next commit
172 diff diff repository (or selected files)
173 export dump the header and diffs for one or more changesets
174 grep search for a pattern in specified files and revisions
175 heads show current repository heads
176 help show help for a given command or all commands
177 identify print information about the working copy
178 import import an ordered set of patches
179 incoming show new changesets found in source
180 init create a new repository in the given directory
181 locate locate files matching specific patterns
182 log show revision history of entire repository or files
183 manifest output the latest or given revision of the project manifest
184 merge Merge working directory with another revision
185 outgoing show changesets not found in destination
186 parents show the parents of the working dir or revision
187 paths show definition of symbolic path names
188 pull pull changes from the specified source
189 push push changes to the specified destination
190 recover roll back an interrupted transaction
191 remove remove the specified files on the next commit
192 rename rename files; equivalent of copy + remove
193 revert revert files or dirs to their states as of some revision
194 rollback roll back the last transaction in this repository
195 root print the root (top) of the current working dir
196 serve export the repository via HTTP
197 status show changed files in the working directory
198 tag add a tag for the current tip or a given revision
199 tags list repository tags
200 tip show the tip revision
201 unbundle apply a changegroup file
202 update update or merge working directory
203 verify verify the integrity of the repository
204 version output version and copyright information
205 %% not tested: --debugger
@@ -0,0 +1,46 b''
1 #!/bin/sh
2
3 mkdir test
4 cd test
5 hg init
6 for i in 0 1 2 3 4 5 6 7 8; do
7 echo $i >> foo
8 hg commit -A -m $i -d "1000000 0"
9 done
10 hg verify
11 hg serve -p 20059 -d --pid-file=hg.pid
12 cd ..
13
14 hg init new
15 # http incoming
16 http_proxy= hg -R new incoming http://localhost:20059/
17 # local incoming
18 hg -R new incoming test
19
20 # test with --bundle
21 http_proxy= hg -R new incoming --bundle test.hg http://localhost:20059/
22 hg -R new incoming --bundle test2.hg test
23
24 # test the resulting bundles
25 hg init temp
26 hg init temp2
27 hg -R temp unbundle test.hg
28 hg -R temp2 unbundle test2.hg
29 hg -R temp tip
30 hg -R temp2 tip
31
32 rm -rf temp temp2 new
33
34 # test outgoing
35 hg clone test test-dev
36 cd test-dev
37 for i in 9 10 11 12 13; do
38 echo $i >> foo
39 hg commit -A -m $i -d "1000000 0"
40 done
41 hg verify
42 cd ..
43 hg -R test-dev outgoing test
44 http_proxy= hg -R test-dev outgoing http://localhost:20059/
45
46 kill `cat test/hg.pid`
@@ -0,0 +1,272 b''
1 adding foo
2 checking changesets
3 checking manifests
4 crosschecking files in changesets and manifests
5 checking files
6 1 files, 9 changesets, 9 total revisions
7 changeset: 0:9cb21d99fe27
8 user: test
9 date: Mon Jan 12 13:46:40 1970 +0000
10 summary: 0
11
12 changeset: 1:d717f5dfad6a
13 user: test
14 date: Mon Jan 12 13:46:40 1970 +0000
15 summary: 1
16
17 changeset: 2:c0d6b86da426
18 user: test
19 date: Mon Jan 12 13:46:40 1970 +0000
20 summary: 2
21
22 changeset: 3:dfacbd43b3fe
23 user: test
24 date: Mon Jan 12 13:46:40 1970 +0000
25 summary: 3
26
27 changeset: 4:1f3a964b6022
28 user: test
29 date: Mon Jan 12 13:46:40 1970 +0000
30 summary: 4
31
32 changeset: 5:c028bcc7a28a
33 user: test
34 date: Mon Jan 12 13:46:40 1970 +0000
35 summary: 5
36
37 changeset: 6:a0c0095f3389
38 user: test
39 date: Mon Jan 12 13:46:40 1970 +0000
40 summary: 6
41
42 changeset: 7:d4be65f4e891
43 user: test
44 date: Mon Jan 12 13:46:40 1970 +0000
45 summary: 7
46
47 changeset: 8:92b83e334ef8
48 tag: tip
49 user: test
50 date: Mon Jan 12 13:46:40 1970 +0000
51 summary: 8
52
53 changeset: 0:9cb21d99fe27
54 user: test
55 date: Mon Jan 12 13:46:40 1970 +0000
56 summary: 0
57
58 changeset: 1:d717f5dfad6a
59 user: test
60 date: Mon Jan 12 13:46:40 1970 +0000
61 summary: 1
62
63 changeset: 2:c0d6b86da426
64 user: test
65 date: Mon Jan 12 13:46:40 1970 +0000
66 summary: 2
67
68 changeset: 3:dfacbd43b3fe
69 user: test
70 date: Mon Jan 12 13:46:40 1970 +0000
71 summary: 3
72
73 changeset: 4:1f3a964b6022
74 user: test
75 date: Mon Jan 12 13:46:40 1970 +0000
76 summary: 4
77
78 changeset: 5:c028bcc7a28a
79 user: test
80 date: Mon Jan 12 13:46:40 1970 +0000
81 summary: 5
82
83 changeset: 6:a0c0095f3389
84 user: test
85 date: Mon Jan 12 13:46:40 1970 +0000
86 summary: 6
87
88 changeset: 7:d4be65f4e891
89 user: test
90 date: Mon Jan 12 13:46:40 1970 +0000
91 summary: 7
92
93 changeset: 8:92b83e334ef8
94 tag: tip
95 user: test
96 date: Mon Jan 12 13:46:40 1970 +0000
97 summary: 8
98
99 changeset: 0:9cb21d99fe27
100 user: test
101 date: Mon Jan 12 13:46:40 1970 +0000
102 summary: 0
103
104 changeset: 1:d717f5dfad6a
105 user: test
106 date: Mon Jan 12 13:46:40 1970 +0000
107 summary: 1
108
109 changeset: 2:c0d6b86da426
110 user: test
111 date: Mon Jan 12 13:46:40 1970 +0000
112 summary: 2
113
114 changeset: 3:dfacbd43b3fe
115 user: test
116 date: Mon Jan 12 13:46:40 1970 +0000
117 summary: 3
118
119 changeset: 4:1f3a964b6022
120 user: test
121 date: Mon Jan 12 13:46:40 1970 +0000
122 summary: 4
123
124 changeset: 5:c028bcc7a28a
125 user: test
126 date: Mon Jan 12 13:46:40 1970 +0000
127 summary: 5
128
129 changeset: 6:a0c0095f3389
130 user: test
131 date: Mon Jan 12 13:46:40 1970 +0000
132 summary: 6
133
134 changeset: 7:d4be65f4e891
135 user: test
136 date: Mon Jan 12 13:46:40 1970 +0000
137 summary: 7
138
139 changeset: 8:92b83e334ef8
140 tag: tip
141 user: test
142 date: Mon Jan 12 13:46:40 1970 +0000
143 summary: 8
144
145 changeset: 0:9cb21d99fe27
146 user: test
147 date: Mon Jan 12 13:46:40 1970 +0000
148 summary: 0
149
150 changeset: 1:d717f5dfad6a
151 user: test
152 date: Mon Jan 12 13:46:40 1970 +0000
153 summary: 1
154
155 changeset: 2:c0d6b86da426
156 user: test
157 date: Mon Jan 12 13:46:40 1970 +0000
158 summary: 2
159
160 changeset: 3:dfacbd43b3fe
161 user: test
162 date: Mon Jan 12 13:46:40 1970 +0000
163 summary: 3
164
165 changeset: 4:1f3a964b6022
166 user: test
167 date: Mon Jan 12 13:46:40 1970 +0000
168 summary: 4
169
170 changeset: 5:c028bcc7a28a
171 user: test
172 date: Mon Jan 12 13:46:40 1970 +0000
173 summary: 5
174
175 changeset: 6:a0c0095f3389
176 user: test
177 date: Mon Jan 12 13:46:40 1970 +0000
178 summary: 6
179
180 changeset: 7:d4be65f4e891
181 user: test
182 date: Mon Jan 12 13:46:40 1970 +0000
183 summary: 7
184
185 changeset: 8:92b83e334ef8
186 tag: tip
187 user: test
188 date: Mon Jan 12 13:46:40 1970 +0000
189 summary: 8
190
191 adding changesets
192 adding manifests
193 adding file changes
194 added 9 changesets with 9 changes to 1 files
195 (run 'hg update' to get a working copy)
196 adding changesets
197 adding manifests
198 adding file changes
199 added 9 changesets with 9 changes to 1 files
200 (run 'hg update' to get a working copy)
201 changeset: 8:92b83e334ef8
202 tag: tip
203 user: test
204 date: Mon Jan 12 13:46:40 1970 +0000
205 summary: 8
206
207 changeset: 8:92b83e334ef8
208 tag: tip
209 user: test
210 date: Mon Jan 12 13:46:40 1970 +0000
211 summary: 8
212
213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 checking changesets
215 checking manifests
216 crosschecking files in changesets and manifests
217 checking files
218 1 files, 14 changesets, 14 total revisions
219 searching for changes
220 changeset: 9:3741c3ad1096
221 user: test
222 date: Mon Jan 12 13:46:40 1970 +0000
223 summary: 9
224
225 changeset: 10:de4143c8d9a5
226 user: test
227 date: Mon Jan 12 13:46:40 1970 +0000
228 summary: 10
229
230 changeset: 11:0e1c188b9a7a
231 user: test
232 date: Mon Jan 12 13:46:40 1970 +0000
233 summary: 11
234
235 changeset: 12:251354d0fdd3
236 user: test
237 date: Mon Jan 12 13:46:40 1970 +0000
238 summary: 12
239
240 changeset: 13:bdaadd969642
241 tag: tip
242 user: test
243 date: Mon Jan 12 13:46:40 1970 +0000
244 summary: 13
245
246 searching for changes
247 changeset: 9:3741c3ad1096
248 user: test
249 date: Mon Jan 12 13:46:40 1970 +0000
250 summary: 9
251
252 changeset: 10:de4143c8d9a5
253 user: test
254 date: Mon Jan 12 13:46:40 1970 +0000
255 summary: 10
256
257 changeset: 11:0e1c188b9a7a
258 user: test
259 date: Mon Jan 12 13:46:40 1970 +0000
260 summary: 11
261
262 changeset: 12:251354d0fdd3
263 user: test
264 date: Mon Jan 12 13:46:40 1970 +0000
265 summary: 12
266
267 changeset: 13:bdaadd969642
268 tag: tip
269 user: test
270 date: Mon Jan 12 13:46:40 1970 +0000
271 summary: 13
272
@@ -0,0 +1,52 b''
1 #!/bin/sh
2 #
3 # revlog.parseindex must be able to parse the index file even if
4 # an index entry is split between two 64k blocks. The ideal test
5 # would be to create an index file with inline data where
6 # 64k < size < 64k + 64 (64k is the size of the read buffer, 64 is
7 # the size of an index entry) and with an index entry starting right
8 # before the 64k block boundary, and try to read it.
9 #
10 # We approximate that by reducing the read buffer to 1 byte.
11 #
12
13 hg init a
14 cd a
15 echo abc > foo
16 hg add foo
17 hg commit -m 'add foo' -d '1000000 0'
18
19 echo >> foo
20 hg commit -m 'change foo' -d '1000001 0'
21 hg log -r 0:
22
23 cat >> test.py << EOF
24 from mercurial import changelog, util
25 from mercurial.node import *
26
27 class singlebyteread(object):
28 def __init__(self, real):
29 self.real = real
30
31 def read(self, size=-1):
32 if size == 65536:
33 size = 1
34 return self.real.read(size)
35
36 def __getattr__(self, key):
37 return getattr(self.real, key)
38
39 def opener(*args):
40 o = util.opener(*args)
41 def wrapper(*a):
42 f = o(*a)
43 return singlebyteread(f)
44 return wrapper
45
46 cl = changelog.changelog(opener('.hg'))
47 print cl.count(), 'revisions:'
48 for r in xrange(cl.count()):
49 print short(cl.node(r))
50 EOF
51
52 python test.py
@@ -0,0 +1,14 b''
1 changeset: 0:9c2cf2b35aa7
2 user: test
3 date: Mon Jan 12 13:46:40 1970 +0000
4 summary: add foo
5
6 changeset: 1:3756a9556b89
7 tag: tip
8 user: test
9 date: Mon Jan 12 13:46:41 1970 +0000
10 summary: change foo
11
12 2 revisions:
13 9c2cf2b35aa7
14 3756a9556b89
@@ -196,6 +196,7 b' proc parsecommit {id contents listed old'
196 }
196 }
197 foreach line [split $contents "\n"] {
197 foreach line [split $contents "\n"] {
198 if {$inhdr} {
198 if {$inhdr} {
199 set line [split $line]
199 if {$line == {}} {
200 if {$line == {}} {
200 set inhdr 0
201 set inhdr 0
201 } else {
202 } else {
@@ -203,11 +204,11 b' proc parsecommit {id contents listed old'
203 if {$tag == "author"} {
204 if {$tag == "author"} {
204 set x [expr {[llength $line] - 2}]
205 set x [expr {[llength $line] - 2}]
205 set audate [lindex $line $x]
206 set audate [lindex $line $x]
206 set auname [lrange $line 1 [expr {$x - 1}]]
207 set auname [join [lrange $line 1 [expr {$x - 1}]]]
207 } elseif {$tag == "committer"} {
208 } elseif {$tag == "committer"} {
208 set x [expr {[llength $line] - 2}]
209 set x [expr {[llength $line] - 2}]
209 set comdate [lindex $line $x]
210 set comdate [lindex $line $x]
210 set comname [lrange $line 1 [expr {$x - 1}]]
211 set comname [join [lrange $line 1 [expr {$x - 1}]]]
211 }
212 }
212 }
213 }
213 } else {
214 } else {
@@ -14,7 +14,7 b''
14 </head>
14 </head>
15
15
16 <body>
16 <body>
17 <h1>Mercurial version 0.8.1 for Windows</h1>
17 <h1>Mercurial version 0.9 for Windows</h1>
18
18
19 <p>Welcome to Mercurial for Windows!</p>
19 <p>Welcome to Mercurial for Windows!</p>
20
20
@@ -4,7 +4,7 b''
4 [Setup]
4 [Setup]
5 AppCopyright=Copyright 2005, 2006 Matt Mackall and others
5 AppCopyright=Copyright 2005, 2006 Matt Mackall and others
6 AppName=Mercurial
6 AppName=Mercurial
7 AppVerName=Mercurial version 0.8.1
7 AppVerName=Mercurial version 0.9
8 InfoAfterFile=contrib/win32/postinstall.txt
8 InfoAfterFile=contrib/win32/postinstall.txt
9 LicenseFile=COPYING
9 LicenseFile=COPYING
10 ShowLanguageDialog=yes
10 ShowLanguageDialog=yes
@@ -14,10 +14,10 b' AppSupportURL=http://www.selenic.com/mer'
14 AppUpdatesURL=http://www.selenic.com/mercurial
14 AppUpdatesURL=http://www.selenic.com/mercurial
15 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
15 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
16 AppContact=mercurial@selenic.com
16 AppContact=mercurial@selenic.com
17 OutputBaseFilename=Mercurial-0.8.1
17 OutputBaseFilename=Mercurial-0.9
18 DefaultDirName={sd}\Mercurial
18 DefaultDirName={sd}\Mercurial
19 SourceDir=C:\hg\hg-release
19 SourceDir=C:\hg\hg-release
20 VersionInfoVersion=0.8.1
20 VersionInfoVersion=0.9
21 VersionInfoDescription=Mercurial distributed SCM
21 VersionInfoDescription=Mercurial distributed SCM
22 VersionInfoCopyright=Copyright 2005, 2006 Matt Mackall and others
22 VersionInfoCopyright=Copyright 2005, 2006 Matt Mackall and others
23 VersionInfoCompany=Matt Mackall and others
23 VersionInfoCompany=Matt Mackall and others
@@ -4,10 +4,47 b' Welcome to Mercurial for Windows!'
4 For configuration and usage directions, please read the ReadMe.html
4 For configuration and usage directions, please read the ReadMe.html
5 file that comes with this package.
5 file that comes with this package.
6
6
7
8 Release Notes
7 Release Notes
9 -------------
8 -------------
10
9
10 2006-05-10 v0.9
11
12 * Major changes between Mercurial 0.8.1 and 0.9:
13
14 - The repository file format has been improved.
15 - This has resulted in an average 40% reduction in disk space usage.
16 - The new format (called RevlogNG) is now the default.
17 - Mercurial works perfectly with both the old and new repository
18 file formats. It can transfer changes transparently between
19 repositories of either format.
20 - To use the new repository format, simply use `hg clone --pull` to
21 clone an existing repository.
22 - Note: Versions 0.8.1 and earlier of Mercurial cannot read
23 RevlogNG repositories directly, but they can `clone`, `pull`
24 from, and `push` to servers that are serving RevlogNG
25 repositories.
26 - Memory usage has been improved by over 50% for many common operations.
27 - Substantial performance improvements on large repositories.
28 - New commands:
29 - 'archive' - generate a directory tree snapshot, tarball, or zip
30 file of a revision
31 - Deprecated commands:
32 - 'addremove' - replaced by 'add' and 'remove --after'
33 - 'forget' - replaced by 'revert'
34 - 'undo' - replaced by 'rollback'
35 - New extensions:
36 - Bugzilla integration hook
37 - Email notification hook
38 - Nested repositories are now supported. Mercurial will not recurse
39 into a subdirectory that contains a '.hg' directory. It is treated
40 as a separate repository.
41 - The standalone web server, 'hg serve', is now threaded, so it can
42 talk to multiple clients at a time.
43 - The web server can now display a "message of the day".
44 - Support added for hooks written in Python.
45 - Many improvements and clarifications to built-in help.
46
47
11 2006-04-07 v0.8.1
48 2006-04-07 v0.8.1
12
49
13 * Major changes from 0.8 to 0.8.1:
50 * Major changes from 0.8 to 0.8.1:
@@ -135,6 +135,20 b' email::'
135 from;;
135 from;;
136 Optional. Email address to use in "From" header and SMTP envelope
136 Optional. Email address to use in "From" header and SMTP envelope
137 of outgoing messages.
137 of outgoing messages.
138 method;;
139 Optional. Method to use to send email messages. If value is
140 "smtp" (default), use SMTP (see section "[mail]" for
141 configuration). Otherwise, use as name of program to run that
142 acts like sendmail (takes "-f" option for sender, list of
143 recipients on command line, message on stdin). Normally, setting
144 this to "sendmail" or "/usr/sbin/sendmail" is enough to use
145 sendmail to send messages.
146
147 Email example:
148
149 [email]
150 from = Joseph User <joe.user@example.com>
151 method = /usr/sbin/sendmail
138
152
139 extensions::
153 extensions::
140 Mercurial has an extension mechanism for adding new features. To
154 Mercurial has an extension mechanism for adding new features. To
@@ -219,15 +233,24 b' hooks::'
219 commit to proceed. Non-zero status will cause the transaction to
233 commit to proceed. Non-zero status will cause the transaction to
220 be rolled back. ID of changeset is in $HG_NODE. Parent changeset
234 be rolled back. ID of changeset is in $HG_NODE. Parent changeset
221 IDs are in $HG_PARENT1 and $HG_PARENT2.
235 IDs are in $HG_PARENT1 and $HG_PARENT2.
236 preupdate;;
237 Run before updating the working directory. Exit status 0 allows
238 the update to proceed. Non-zero status will prevent the update.
239 Changeset ID of first new parent is in $HG_PARENT1. If merge, ID
240 of second new parent is in $HG_PARENT2.
222 tag;;
241 tag;;
223 Run after a tag is created. ID of tagged changeset is in
242 Run after a tag is created. ID of tagged changeset is in
224 $HG_NODE. Name of tag is in $HG_TAG. Tag is local if
243 $HG_NODE. Name of tag is in $HG_TAG. Tag is local if
225 $HG_LOCAL=1, in repo if $HG_LOCAL=0.
244 $HG_LOCAL=1, in repo if $HG_LOCAL=0.
245 update;;
246 Run after updating the working directory. Changeset ID of first
247 new parent is in $HG_PARENT1. If merge, ID of second new parent
248 is in $HG_PARENT2. If update succeeded, $HG_ERROR=0. If update
249 failed (e.g. because conflicts not resolved), $HG_ERROR=1.
226
250
227 In earlier releases, the names of hook environment variables did not
251 Note: In earlier releases, the names of hook environment variables
228 have a "HG_" prefix. These unprefixed names are still provided in
252 did not have a "HG_" prefix. The old unprefixed names are no longer
229 the environment for backwards compatibility, but their use is
253 provided in the environment.
230 deprecated, and they will be removed in a future release.
231
254
232 The syntax for Python hooks is as follows:
255 The syntax for Python hooks is as follows:
233
256
@@ -279,7 +302,15 b' smtp::'
279 paths::
302 paths::
280 Assigns symbolic names to repositories. The left side is the
303 Assigns symbolic names to repositories. The left side is the
281 symbolic name, and the right gives the directory or URL that is the
304 symbolic name, and the right gives the directory or URL that is the
282 location of the repository.
305 location of the repository. Default paths can be declared by
306 setting the following entries.
307 default;;
308 Directory or URL to use when pulling if no source is specified.
309 Default is set to repository from which the current repository
310 was cloned.
311 default-push;;
312 Optional. Directory or URL to use when pushing if no destination
313 is specified.
283
314
284 ui::
315 ui::
285 User interface controls.
316 User interface controls.
@@ -281,7 +281,8 b' class queue:'
281 message = '\n'.join(message)
281 message = '\n'.join(message)
282
282
283 try:
283 try:
284 f = os.popen("patch -p1 --no-backup-if-mismatch < '%s'" % (pf))
284 pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
285 f = os.popen("%s -p1 --no-backup-if-mismatch < '%s'" % (pp, pf))
285 except:
286 except:
286 self.ui.warn("patch failed, unable to continue (try -v)\n")
287 self.ui.warn("patch failed, unable to continue (try -v)\n")
287 err = 1
288 err = 1
@@ -228,14 +228,13 b' class notifier(object):'
228 mail = self.ui.sendmail()
228 mail = self.ui.sendmail()
229 mail.sendmail(templater.email(msg['From']), self.subs, msgtext)
229 mail.sendmail(templater.email(msg['From']), self.subs, msgtext)
230
230
231 def diff(self, node):
231 def diff(self, node, ref):
232 maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
232 maxdiff = int(self.ui.config('notify', 'maxdiff', 300))
233 if maxdiff == 0:
233 if maxdiff == 0:
234 return
234 return
235 fp = templater.stringio()
235 fp = templater.stringio()
236 prev = self.repo.changelog.parents(node)[0]
236 prev = self.repo.changelog.parents(node)[0]
237 commands.dodiff(fp, self.ui, self.repo, prev,
237 commands.dodiff(fp, self.ui, self.repo, prev, ref)
238 self.repo.changelog.tip())
239 difflines = fp.getvalue().splitlines(1)
238 difflines = fp.getvalue().splitlines(1)
240 if maxdiff > 0 and len(difflines) > maxdiff:
239 if maxdiff > 0 and len(difflines) > maxdiff:
241 self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
240 self.sio.write(_('\ndiffs (truncated from %d to %d lines):\n\n') %
@@ -260,8 +259,9 b' def hook(ui, repo, hooktype, node=None, '
260 count = end - start
259 count = end - start
261 for rev in xrange(start, end):
260 for rev in xrange(start, end):
262 n.node(repo.changelog.node(rev))
261 n.node(repo.changelog.node(rev))
262 n.diff(node, repo.changelog.tip())
263 else:
263 else:
264 count = 1
264 count = 1
265 n.node(node)
265 n.node(node)
266 n.diff(node)
266 n.diff(node, node)
267 n.send(node, count)
267 n.send(node, count)
@@ -254,8 +254,6 b' def patchbomb(ui, repo, *revs, **opts):'
254 else:
254 else:
255 ui.status('Sending ', m['Subject'], ' ...\n')
255 ui.status('Sending ', m['Subject'], ' ...\n')
256 mail.sendmail(sender, to + cc, m.as_string(0))
256 mail.sendmail(sender, to + cc, m.as_string(0))
257 if not opts['test'] and not opts['mbox']:
258 mail.close()
259
257
260 cmdtable = {
258 cmdtable = {
261 'email':
259 'email':
@@ -13,7 +13,7 b' of the GNU General Public License, incor'
13 from node import *
13 from node import *
14 from i18n import gettext as _
14 from i18n import gettext as _
15 from demandload import demandload
15 from demandload import demandload
16 demandload(globals(), "changegroup util os struct")
16 demandload(globals(), "changegroup util os struct bz2 tempfile")
17
17
18 import localrepo, changelog, manifest, filelog, revlog
18 import localrepo, changelog, manifest, filelog, revlog
19
19
@@ -50,7 +50,7 b' class bundlerevlog(revlog.revlog):'
50 continue
50 continue
51 for p in (p1, p2):
51 for p in (p1, p2):
52 if not p in self.nodemap:
52 if not p in self.nodemap:
53 raise RevlogError(_("unknown parent %s") % short(p1))
53 raise revlog.RevlogError(_("unknown parent %s") % short(p1))
54 if linkmapper is None:
54 if linkmapper is None:
55 link = n
55 link = n
56 else:
56 else:
@@ -76,12 +76,12 b' class bundlerevlog(revlog.revlog):'
76 return False
76 return False
77 return rev in self.basemap
77 return rev in self.basemap
78 def bundlebase(self, rev): return self.basemap[rev]
78 def bundlebase(self, rev): return self.basemap[rev]
79 def chunk(self, rev, df=None):
79 def chunk(self, rev, df=None, cachelen=4096):
80 # Warning: in case of bundle, the diff is against bundlebase,
80 # Warning: in case of bundle, the diff is against bundlebase,
81 # not against rev - 1
81 # not against rev - 1
82 # XXX: could use some caching
82 # XXX: could use some caching
83 if not self.bundle(rev):
83 if not self.bundle(rev):
84 return revlog.revlog.chunk(self, rev)
84 return revlog.revlog.chunk(self, rev, df, cachelen)
85 self.bundlefile.seek(self.start(rev))
85 self.bundlefile.seek(self.start(rev))
86 return self.bundlefile.read(self.length(rev))
86 return self.bundlefile.read(self.length(rev))
87
87
@@ -123,8 +123,8 b' class bundlerevlog(revlog.revlog):'
123
123
124 p1, p2 = self.parents(node)
124 p1, p2 = self.parents(node)
125 if node != revlog.hash(text, p1, p2):
125 if node != revlog.hash(text, p1, p2):
126 raise RevlogError(_("integrity check failed on %s:%d")
126 raise revlog.RevlogError(_("integrity check failed on %s:%d")
127 % (self.datafile, self.rev(node)))
127 % (self.datafile, self.rev(node)))
128
128
129 self.cache = (node, self.rev(node), text)
129 self.cache = (node, self.rev(node), text)
130 return text
130 return text
@@ -159,19 +159,38 b' class bundlefilelog(bundlerevlog, filelo'
159 class bundlerepository(localrepo.localrepository):
159 class bundlerepository(localrepo.localrepository):
160 def __init__(self, ui, path, bundlename):
160 def __init__(self, ui, path, bundlename):
161 localrepo.localrepository.__init__(self, ui, path)
161 localrepo.localrepository.__init__(self, ui, path)
162 f = open(bundlename, "rb")
162 self.tempfile = None
163 s = util.fstat(f)
163 self.bundlefile = open(bundlename, "rb")
164 self.bundlefile = f
165 header = self.bundlefile.read(6)
164 header = self.bundlefile.read(6)
166 if not header.startswith("HG"):
165 if not header.startswith("HG"):
167 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
166 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
168 elif not header.startswith("HG10"):
167 elif not header.startswith("HG10"):
169 raise util.Abort(_("%s: unknown bundle version") % bundlename)
168 raise util.Abort(_("%s: unknown bundle version") % bundlename)
170 elif header == "HG10BZ":
169 elif header == "HG10BZ":
171 raise util.Abort(_("%s: compressed bundle not supported")
170 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
172 % bundlename)
171 suffix=".hg10un", dir=self.path)
172 self.tempfile = temp
173 fptemp = os.fdopen(fdtemp, 'wb')
174 def generator(f):
175 zd = bz2.BZ2Decompressor()
176 zd.decompress("BZ")
177 for chunk in f:
178 yield zd.decompress(chunk)
179 gen = generator(util.filechunkiter(self.bundlefile, 4096))
180
181 try:
182 fptemp.write("HG10UN")
183 for chunk in gen:
184 fptemp.write(chunk)
185 finally:
186 fptemp.close()
187 self.bundlefile.close()
188
189 self.bundlefile = open(self.tempfile, "rb")
190 # seek right after the header
191 self.bundlefile.seek(6)
173 elif header == "HG10UN":
192 elif header == "HG10UN":
174 # uncompressed bundle supported
193 # nothing to do
175 pass
194 pass
176 else:
195 else:
177 raise util.Abort(_("%s: unknown bundle compression type")
196 raise util.Abort(_("%s: unknown bundle compression type")
@@ -205,3 +224,9 b' class bundlerepository(localrepo.localre'
205 def close(self):
224 def close(self):
206 """Close assigned bundle file immediately."""
225 """Close assigned bundle file immediately."""
207 self.bundlefile.close()
226 self.bundlefile.close()
227
228 def __del__(self):
229 if not self.bundlefile.closed:
230 self.bundlefile.close()
231 if self.tempfile is not None:
232 os.unlink(self.tempfile)
@@ -756,13 +756,20 b' def archive(ui, repo, dest, **opts):'
756 def backout(ui, repo, rev, **opts):
756 def backout(ui, repo, rev, **opts):
757 '''reverse effect of earlier changeset
757 '''reverse effect of earlier changeset
758
758
759 Commit the backed out changes as a new changeset.
759 Commit the backed out changes as a new changeset. The new
760 changeset is a child of the backed out changeset.
760
761
761 If you back out a changeset other than the tip, a new head is
762 If you back out a changeset other than the tip, a new head is
762 created. The --merge option remembers the parent of the working
763 created. This head is the parent of the working directory. If
763 directory before starting the backout, then merges the new head
764 you back out an old changeset, your working directory will appear
764 with it afterwards, to save you from doing this by hand. The
765 old after the backout. You should merge the backout changeset
765 result of this merge is not committed, as for a normal merge.'''
766 with another head.
767
768 The --merge option remembers the parent of the working directory
769 before starting the backout, then merges the new head with that
770 changeset afterwards. This saves you from doing the merge by
771 hand. The result of this merge is not committed, as for a normal
772 merge.'''
766
773
767 bail_if_changed(repo)
774 bail_if_changed(repo)
768 op1, op2 = repo.dirstate.parents()
775 op1, op2 = repo.dirstate.parents()
@@ -782,6 +789,7 b' def backout(ui, repo, rev, **opts):'
782 commit_opts['addremove'] = False
789 commit_opts['addremove'] = False
783 if not commit_opts['message'] and not commit_opts['logfile']:
790 if not commit_opts['message'] and not commit_opts['logfile']:
784 commit_opts['message'] = _("Backed out changeset %s") % (hex(node))
791 commit_opts['message'] = _("Backed out changeset %s") % (hex(node))
792 commit_opts['force_editor'] = True
785 commit(ui, repo, **commit_opts)
793 commit(ui, repo, **commit_opts)
786 def nice(node):
794 def nice(node):
787 return '%d:%s' % (repo.changelog.rev(node), short(node))
795 return '%d:%s' % (repo.changelog.rev(node), short(node))
@@ -789,7 +797,7 b' def backout(ui, repo, rev, **opts):'
789 (nice(repo.changelog.tip()), nice(node)))
797 (nice(repo.changelog.tip()), nice(node)))
790 if opts['merge'] and op1 != node:
798 if opts['merge'] and op1 != node:
791 ui.status(_('merging with changeset %s\n') % nice(op1))
799 ui.status(_('merging with changeset %s\n') % nice(op1))
792 update(ui, repo, hex(op1), **opts)
800 doupdate(ui, repo, hex(op1), **opts)
793
801
794 def bundle(ui, repo, fname, dest="default-push", **opts):
802 def bundle(ui, repo, fname, dest="default-push", **opts):
795 """create a changegroup file
803 """create a changegroup file
@@ -939,7 +947,7 b' def clone(ui, source, dest=None, **opts)'
939 f.close()
947 f.close()
940
948
941 if not opts['noupdate']:
949 if not opts['noupdate']:
942 update(repo.ui, repo)
950 doupdate(repo.ui, repo)
943
951
944 d.close()
952 d.close()
945
953
@@ -980,7 +988,8 b' def commit(ui, repo, *pats, **opts):'
980 else:
988 else:
981 files = []
989 files = []
982 try:
990 try:
983 repo.commit(files, message, opts['user'], opts['date'], match)
991 repo.commit(files, message, opts['user'], opts['date'], match,
992 force_editor=opts.get('force_editor'))
984 except ValueError, inst:
993 except ValueError, inst:
985 raise util.Abort(str(inst))
994 raise util.Abort(str(inst))
986
995
@@ -1296,10 +1305,11 b' def debugindexdot(ui, file_):'
1296 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
1305 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
1297 ui.write("digraph G {\n")
1306 ui.write("digraph G {\n")
1298 for i in range(r.count()):
1307 for i in range(r.count()):
1299 e = r.index[i]
1308 node = r.node(i)
1300 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
1309 pp = r.parents(node)
1301 if e[5] != nullid:
1310 ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
1302 ui.write("\t%d -> %d\n" % (r.rev(e[5]), i))
1311 if pp[1] != nullid:
1312 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1303 ui.write("}\n")
1313 ui.write("}\n")
1304
1314
1305 def debugrename(ui, repo, file, rev=None):
1315 def debugrename(ui, repo, file, rev=None):
@@ -1947,7 +1957,7 b' def merge(ui, repo, node=None, **opts):'
1947 marked as changed for the next commit and a commit must be
1957 marked as changed for the next commit and a commit must be
1948 performed before any further updates are allowed.
1958 performed before any further updates are allowed.
1949 """
1959 """
1950 return update(ui, repo, node=node, merge=True, **opts)
1960 return doupdate(ui, repo, node=node, merge=True, **opts)
1951
1961
1952 def outgoing(ui, repo, dest="default-push", **opts):
1962 def outgoing(ui, repo, dest="default-push", **opts):
1953 """show changesets not found in destination
1963 """show changesets not found in destination
@@ -2026,7 +2036,7 b' def postincoming(ui, repo, modheads, opt'
2026 return
2036 return
2027 if optupdate:
2037 if optupdate:
2028 if modheads == 1:
2038 if modheads == 1:
2029 return update(ui, repo)
2039 return doupdate(ui, repo)
2030 else:
2040 else:
2031 ui.status(_("not updating, since new heads added\n"))
2041 ui.status(_("not updating, since new heads added\n"))
2032 if modheads > 1:
2042 if modheads > 1:
@@ -2268,6 +2278,7 b' def revert(ui, repo, *pats, **opts):'
2268 'you must specify the revision to revert to'))
2278 'you must specify the revision to revert to'))
2269 else:
2279 else:
2270 node = parent
2280 node = parent
2281 pmf = None
2271 mf = repo.manifest.read(repo.changelog.read(node)[0])
2282 mf = repo.manifest.read(repo.changelog.read(node)[0])
2272
2283
2273 wlock = repo.wlock()
2284 wlock = repo.wlock()
@@ -2350,7 +2361,12 b' def revert(ui, repo, *pats, **opts):'
2350 if exact: ui.warn(_('no changes needed to %s\n' % rel))
2361 if exact: ui.warn(_('no changes needed to %s\n' % rel))
2351 continue
2362 continue
2352 if not in_mf:
2363 if not in_mf:
2353 handle(remove, False)
2364 if pmf is None:
2365 # only need parent manifest in this unlikely case,
2366 # so do not read by default
2367 pmf = repo.manifest.read(repo.changelog.read(parent)[0])
2368 if abs in pmf:
2369 handle(remove, False)
2354 update[abs] = True
2370 update[abs] = True
2355
2371
2356 repo.dirstate.forget(forget[0])
2372 repo.dirstate.forget(forget[0])
@@ -2725,15 +2741,19 b' def update(ui, repo, node=None, merge=Fa'
2725 there is a linear relationship between the current version and the
2741 there is a linear relationship between the current version and the
2726 requested version, the result is the requested version.
2742 requested version, the result is the requested version.
2727
2743
2728 Otherwise the result is a merge between the contents of the
2744 To merge the working directory with another revision, use the
2729 current working directory and the requested version. Files that
2745 merge command.
2730 changed between either parent are marked as changed for the next
2731 commit and a commit must be performed before any further updates
2732 are allowed.
2733
2746
2734 By default, update will refuse to run if doing so would require
2747 By default, update will refuse to run if doing so would require
2735 merging or discarding local changes.
2748 merging or discarding local changes.
2736 """
2749 """
2750 if merge:
2751 ui.warn(_('(the -m/--merge option is deprecated; '
2752 'use the merge command instead)\n'))
2753 return doupdate(ui, repo, node, merge, clean, force, branch, **opts)
2754
2755 def doupdate(ui, repo, node=None, merge=False, clean=False, force=None,
2756 branch=None, **opts):
2737 if branch:
2757 if branch:
2738 br = repo.branchlookup(branch=branch)
2758 br = repo.branchlookup(branch=branch)
2739 found = []
2759 found = []
@@ -3100,7 +3120,7 b' table = {'
3100 "^update|up|checkout|co":
3120 "^update|up|checkout|co":
3101 (update,
3121 (update,
3102 [('b', 'branch', '', _('checkout the head of a specific branch')),
3122 [('b', 'branch', '', _('checkout the head of a specific branch')),
3103 ('m', 'merge', None, _('allow merging of branches')),
3123 ('m', 'merge', None, _('allow merging of branches (DEPRECATED)')),
3104 ('C', 'clean', None, _('overwrite locally modified files')),
3124 ('C', 'clean', None, _('overwrite locally modified files')),
3105 ('f', 'force', None, _('force a merge with outstanding changes'))],
3125 ('f', 'force', None, _('force a merge with outstanding changes'))],
3106 _('hg update [-b TAG] [-m] [-C] [-f] [REV]')),
3126 _('hg update [-b TAG] [-m] [-C] [-f] [REV]')),
@@ -3116,6 +3136,7 b' globalopts = ['
3116 _('do not prompt, assume \'yes\' for any required answers')),
3136 _('do not prompt, assume \'yes\' for any required answers')),
3117 ('q', 'quiet', None, _('suppress output')),
3137 ('q', 'quiet', None, _('suppress output')),
3118 ('v', 'verbose', None, _('enable additional output')),
3138 ('v', 'verbose', None, _('enable additional output')),
3139 ('', 'config', [], _('set/override config option')),
3119 ('', 'debug', None, _('enable debugging output')),
3140 ('', 'debug', None, _('enable debugging output')),
3120 ('', 'debugger', None, _('start debugger')),
3141 ('', 'debugger', None, _('start debugger')),
3121 ('', 'traceback', None, _('print traceback on exception')),
3142 ('', 'traceback', None, _('print traceback on exception')),
@@ -3280,7 +3301,8 b' def dispatch(args):'
3280 atexit.register(print_time)
3301 atexit.register(print_time)
3281
3302
3282 u.updateopts(options["verbose"], options["debug"], options["quiet"],
3303 u.updateopts(options["verbose"], options["debug"], options["quiet"],
3283 not options["noninteractive"], options["traceback"])
3304 not options["noninteractive"], options["traceback"],
3305 options["config"])
3284
3306
3285 # enter the debugger before command execution
3307 # enter the debugger before command execution
3286 if options['debugger']:
3308 if options['debugger']:
@@ -684,7 +684,7 b' class hgweb(object):'
684 mf = self.repo.manifest.read(cs[0])
684 mf = self.repo.manifest.read(cs[0])
685
685
686 def diff(**map):
686 def diff(**map):
687 yield self.diff(p1, n, file)
687 yield self.diff(p1, n, [file])
688
688
689 yield self.t("filediff",
689 yield self.t("filediff",
690 file=file,
690 file=file,
@@ -11,6 +11,25 b' from i18n import gettext as _'
11 from demandload import *
11 from demandload import *
12 demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib")
12 demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib")
13
13
14 class passwordmgr(urllib2.HTTPPasswordMgr):
15 def __init__(self, ui):
16 urllib2.HTTPPasswordMgr.__init__(self)
17 self.ui = ui
18
19 def find_user_password(self, realm, authuri):
20 authinfo = urllib2.HTTPPasswordMgr.find_user_password(
21 self, realm, authuri)
22 if authinfo != (None, None):
23 return authinfo
24
25 self.ui.write(_("http authorization required\n"))
26 self.ui.status(_("realm: %s\n") % realm)
27 user = self.ui.prompt(_("user:"), default=None)
28 passwd = self.ui.getpass()
29
30 self.add_password(realm, authuri, user, passwd)
31 return (user, passwd)
32
14 class httprepository(remoterepository):
33 class httprepository(remoterepository):
15 def __init__(self, ui, path):
34 def __init__(self, ui, path):
16 # fix missing / after hostname
35 # fix missing / after hostname
@@ -53,13 +72,21 b' class httprepository(remoterepository):'
53 if host and not no_proxy:
72 if host and not no_proxy:
54 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host})
73 proxy_handler = urllib2.ProxyHandler({"http" : "http://" + host})
55
74
56 authinfo = None
75 proxyauthinfo = None
57 if user and passwd:
76 if user and passwd:
58 passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
77 passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
59 passmgr.add_password(None, host, user, passwd)
78 passmgr.add_password(None, host, user, passwd)
60 authinfo = urllib2.ProxyBasicAuthHandler(passmgr)
79 proxyauthinfo = urllib2.ProxyBasicAuthHandler(passmgr)
61
80
62 opener = urllib2.build_opener(proxy_handler, authinfo)
81 if ui.interactive:
82 passmgr = passwordmgr(ui)
83 opener = urllib2.build_opener(
84 proxy_handler, proxyauthinfo,
85 urllib2.HTTPBasicAuthHandler(passmgr),
86 urllib2.HTTPDigestAuthHandler(passmgr))
87 else:
88 opener = urllib2.build_opener(proxy_handler, proxyauthinfo)
89
63 # 1.0 here is the _protocol_ version
90 # 1.0 here is the _protocol_ version
64 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
91 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
65 urllib2.install_opener(opener)
92 urllib2.install_opener(opener)
@@ -76,7 +103,10 b' class httprepository(remoterepository):'
76 q.update(args)
103 q.update(args)
77 qs = urllib.urlencode(q)
104 qs = urllib.urlencode(q)
78 cu = "%s?%s" % (self.url, qs)
105 cu = "%s?%s" % (self.url, qs)
79 resp = urllib2.urlopen(cu)
106 try:
107 resp = urllib2.urlopen(cu)
108 except httplib.HTTPException, inst:
109 raise IOError(None, _('http error while sending %s command') % cmd)
80 proto = resp.headers['content-type']
110 proto = resp.headers['content-type']
81
111
82 # accept old "text/plain" and "application/hg-changegroup" for now
112 # accept old "text/plain" and "application/hg-changegroup" for now
@@ -136,8 +136,7 b' class localrepository(object):'
136
136
137 def runhook(name, cmd):
137 def runhook(name, cmd):
138 self.ui.note(_("running hook %s: %s\n") % (name, cmd))
138 self.ui.note(_("running hook %s: %s\n") % (name, cmd))
139 env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()] +
139 env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()])
140 [(k.upper(), v) for k, v in args.iteritems()])
141 r = util.system(cmd, environ=env, cwd=self.root)
140 r = util.system(cmd, environ=env, cwd=self.root)
142 if r:
141 if r:
143 desc, r = util.explain_exit(r)
142 desc, r = util.explain_exit(r)
@@ -446,7 +445,8 b' class localrepository(object):'
446 self.dirstate.setparents(n, nullid)
445 self.dirstate.setparents(n, nullid)
447
446
448 def commit(self, files=None, text="", user=None, date=None,
447 def commit(self, files=None, text="", user=None, date=None,
449 match=util.always, force=False, lock=None, wlock=None):
448 match=util.always, force=False, lock=None, wlock=None,
449 force_editor=False):
450 commit = []
450 commit = []
451 remove = []
451 remove = []
452 changed = []
452 changed = []
@@ -535,8 +535,11 b' class localrepository(object):'
535 new.sort()
535 new.sort()
536
536
537 user = user or self.ui.username()
537 user = user or self.ui.username()
538 if not text:
538 if not text or force_editor:
539 edittext = [""]
539 edittext = []
540 if text:
541 edittext.append(text)
542 edittext.append("")
540 if p2 != nullid:
543 if p2 != nullid:
541 edittext.append("HG: branch merge")
544 edittext.append("HG: branch merge")
542 edittext.extend(["HG: changed %s" % f for f in changed])
545 edittext.extend(["HG: changed %s" % f for f in changed])
@@ -1544,8 +1547,9 b' class localrepository(object):'
1544 " with %d changes to %d files%s\n")
1547 " with %d changes to %d files%s\n")
1545 % (changesets, revisions, files, heads))
1548 % (changesets, revisions, files, heads))
1546
1549
1547 self.hook('pretxnchangegroup', throw=True,
1550 if changesets > 0:
1548 node=hex(self.changelog.node(cor+1)), source=srctype)
1551 self.hook('pretxnchangegroup', throw=True,
1552 node=hex(self.changelog.node(cor+1)), source=srctype)
1549
1553
1550 tr.close()
1554 tr.close()
1551
1555
@@ -1563,8 +1567,7 b' class localrepository(object):'
1563 moddirstate=True, forcemerge=False, wlock=None, show_stats=True):
1567 moddirstate=True, forcemerge=False, wlock=None, show_stats=True):
1564 pl = self.dirstate.parents()
1568 pl = self.dirstate.parents()
1565 if not force and pl[1] != nullid:
1569 if not force and pl[1] != nullid:
1566 self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
1570 raise util.Abort(_("outstanding uncommitted merges"))
1567 return 1
1568
1571
1569 err = False
1572 err = False
1570
1573
@@ -1592,6 +1595,7 b' class localrepository(object):'
1592 if allow and not forcemerge:
1595 if allow and not forcemerge:
1593 if modified or added or removed:
1596 if modified or added or removed:
1594 raise util.Abort(_("outstanding uncommitted changes"))
1597 raise util.Abort(_("outstanding uncommitted changes"))
1598
1595 if not forcemerge and not force:
1599 if not forcemerge and not force:
1596 for f in unknown:
1600 for f in unknown:
1597 if f in m2:
1601 if f in m2:
@@ -1765,6 +1769,13 b' class localrepository(object):'
1765 return 1
1769 return 1
1766 branch_merge = True
1770 branch_merge = True
1767
1771
1772 xp1 = hex(p1)
1773 xp2 = hex(p2)
1774 if p2 == nullid: xxp2 = ''
1775 else: xxp2 = xp2
1776
1777 self.hook('preupdate', throw=True, parent1=xp1, parent2=xxp2)
1778
1768 # get the files we don't need to change
1779 # get the files we don't need to change
1769 files = get.keys()
1780 files = get.keys()
1770 files.sort()
1781 files.sort()
@@ -1785,8 +1796,6 b' class localrepository(object):'
1785 failedmerge = []
1796 failedmerge = []
1786 files = merge.keys()
1797 files = merge.keys()
1787 files.sort()
1798 files.sort()
1788 xp1 = hex(p1)
1789 xp2 = hex(p2)
1790 for f in files:
1799 for f in files:
1791 self.ui.status(_("merging %s\n") % f)
1800 self.ui.status(_("merging %s\n") % f)
1792 my, other, flag = merge[f]
1801 my, other, flag = merge[f]
@@ -1850,6 +1859,7 b' class localrepository(object):'
1850 self.ui.status(_("There are unresolved merges with"
1859 self.ui.status(_("There are unresolved merges with"
1851 " locally modified files.\n"))
1860 " locally modified files.\n"))
1852
1861
1862 self.hook('update', parent1=xp1, parent2=xxp2, error=int(err))
1853 return err
1863 return err
1854
1864
1855 def merge3(self, fn, my, other, p1, p2):
1865 def merge3(self, fn, my, other, p1, p2):
@@ -376,12 +376,7 b' class revlog(object):'
376 self.index = lazyindex(parser)
376 self.index = lazyindex(parser)
377 self.nodemap = lazymap(parser)
377 self.nodemap = lazymap(parser)
378 else:
378 else:
379 i = f.read()
379 self.parseindex(f, st)
380 self.parseindex(i)
381 if self.inlinedata():
382 # we've already got the entire data file read in, save it
383 # in the chunk data
384 self.chunkcache = (0, i)
385 if self.version != REVLOGV0:
380 if self.version != REVLOGV0:
386 e = list(self.index[0])
381 e = list(self.index[0])
387 type = self.ngtype(e[0])
382 type = self.ngtype(e[0])
@@ -392,22 +387,47 b' class revlog(object):'
392 self.index = []
387 self.index = []
393
388
394
389
395 def parseindex(self, data):
390 def parseindex(self, fp, st):
396 s = struct.calcsize(self.indexformat)
391 s = struct.calcsize(self.indexformat)
397 l = len(data)
398 self.index = []
392 self.index = []
399 self.nodemap = {nullid: -1}
393 self.nodemap = {nullid: -1}
400 inline = self.inlinedata()
394 inline = self.inlinedata()
401 off = 0
402 n = 0
395 n = 0
403 while off < l:
396 leftover = None
404 e = struct.unpack(self.indexformat, data[off:off + s])
397 while True:
405 self.index.append(e)
398 if st:
406 self.nodemap[e[-1]] = n
399 data = fp.read(65536)
407 n += 1
400 else:
408 off += s
401 # hack for httprangereader, it doesn't do partial reads well
409 if inline:
402 data = fp.read()
410 off += e[1]
403 if not data:
404 break
405 if n == 0 and self.inlinedata():
406 # cache the first chunk
407 self.chunkcache = (0, data)
408 if leftover:
409 data = leftover + data
410 leftover = None
411 off = 0
412 l = len(data)
413 while off < l:
414 if l - off < s:
415 leftover = data[off:]
416 break
417 cur = data[off:off + s]
418 off += s
419 e = struct.unpack(self.indexformat, cur)
420 self.index.append(e)
421 self.nodemap[e[-1]] = n
422 n += 1
423 if inline:
424 off += e[1]
425 if off > l:
426 # some things don't seek well, just read it
427 fp.read(off - l)
428 if not st:
429 break
430
411
431
412 def ngoffset(self, q):
432 def ngoffset(self, q):
413 if q & 0xFFFF:
433 if q & 0xFFFF:
@@ -1117,7 +1137,7 b' class revlog(object):'
1117
1137
1118 for p in (p1, p2):
1138 for p in (p1, p2):
1119 if not p in self.nodemap:
1139 if not p in self.nodemap:
1120 raise RevlogError(_("unknown parent %s") % short(p1))
1140 raise RevlogError(_("unknown parent %s") % short(p))
1121
1141
1122 if not chain:
1142 if not chain:
1123 # retrieve the parent revision of the delta chain
1143 # retrieve the parent revision of the delta chain
@@ -8,7 +8,8 b''
8 import ConfigParser
8 import ConfigParser
9 from i18n import gettext as _
9 from i18n import gettext as _
10 from demandload import *
10 from demandload import *
11 demandload(globals(), "errno os re smtplib socket sys tempfile util")
11 demandload(globals(), "errno getpass os re smtplib socket sys tempfile")
12 demandload(globals(), "templater util")
12
13
13 class ui(object):
14 class ui(object):
14 def __init__(self, verbose=False, debug=False, quiet=False,
15 def __init__(self, verbose=False, debug=False, quiet=False,
@@ -46,12 +47,23 b' class ui(object):'
46 return getattr(self.parentui, key)
47 return getattr(self.parentui, key)
47
48
48 def updateopts(self, verbose=False, debug=False, quiet=False,
49 def updateopts(self, verbose=False, debug=False, quiet=False,
49 interactive=True, traceback=False):
50 interactive=True, traceback=False, config=[]):
50 self.quiet = (self.quiet or quiet) and not verbose and not debug
51 self.quiet = (self.quiet or quiet) and not verbose and not debug
51 self.verbose = (self.verbose or verbose) or debug
52 self.verbose = (self.verbose or verbose) or debug
52 self.debugflag = (self.debugflag or debug)
53 self.debugflag = (self.debugflag or debug)
53 self.interactive = (self.interactive and interactive)
54 self.interactive = (self.interactive and interactive)
54 self.traceback = self.traceback or traceback
55 self.traceback = self.traceback or traceback
56 for cfg in config:
57 try:
58 name, value = cfg.split('=', 1)
59 section, name = name.split('.', 1)
60 if not self.cdata.has_section(section):
61 self.cdata.add_section(section)
62 if not section or not name:
63 raise IndexError
64 self.cdata.set(section, name, value)
65 except (IndexError, ValueError):
66 raise util.Abort(_('malformed --config option: %s') % cfg)
55
67
56 def readconfig(self, fn, root=None):
68 def readconfig(self, fn, root=None):
57 if isinstance(fn, basestring):
69 if isinstance(fn, basestring):
@@ -224,15 +236,18 b' class ui(object):'
224
236
225 def readline(self):
237 def readline(self):
226 return sys.stdin.readline()[:-1]
238 return sys.stdin.readline()[:-1]
227 def prompt(self, msg, pat, default="y"):
239 def prompt(self, msg, pat=None, default="y"):
228 if not self.interactive: return default
240 if not self.interactive: return default
229 while 1:
241 while 1:
230 self.write(msg, " ")
242 self.write(msg, " ")
231 r = self.readline()
243 r = self.readline()
232 if re.match(pat, r):
244 if not pat or re.match(pat, r):
233 return r
245 return r
234 else:
246 else:
235 self.write(_("unrecognized response\n"))
247 self.write(_("unrecognized response\n"))
248 def getpass(self, prompt=None, default=None):
249 if not self.interactive: return default
250 return getpass.getpass(prompt or _('password: '))
236 def status(self, *msg):
251 def status(self, *msg):
237 if not self.quiet: self.write(*msg)
252 if not self.quiet: self.write(*msg)
238 def warn(self, *msg):
253 def warn(self, *msg):
@@ -267,15 +282,56 b' class ui(object):'
267 return t
282 return t
268
283
269 def sendmail(self):
284 def sendmail(self):
270 s = smtplib.SMTP()
285 '''send mail message. object returned has one method, sendmail.
271 s.connect(host = self.config('smtp', 'host', 'mail'),
286 call as sendmail(sender, list-of-recipients, msg).'''
272 port = int(self.config('smtp', 'port', 25)))
287
273 if self.configbool('smtp', 'tls'):
288 def smtp():
274 s.ehlo()
289 '''send mail using smtp.'''
275 s.starttls()
290
276 s.ehlo()
291 s = smtplib.SMTP()
277 username = self.config('smtp', 'username')
292 mailhost = self.config('smtp', 'host')
278 password = self.config('smtp', 'password')
293 if not mailhost:
279 if username and password:
294 raise util.Abort(_('no [smtp]host in hgrc - cannot send mail'))
280 s.login(username, password)
295 mailport = int(self.config('smtp', 'port', 25))
281 return s
296 self.note(_('sending mail: smtp host %s, port %s\n') %
297 (mailhost, mailport))
298 s.connect(host=mailhost, port=mailport)
299 if self.configbool('smtp', 'tls'):
300 self.note(_('(using tls)\n'))
301 s.ehlo()
302 s.starttls()
303 s.ehlo()
304 username = self.config('smtp', 'username')
305 password = self.config('smtp', 'password')
306 if username and password:
307 self.note(_('(authenticating to mail server as %s)\n') %
308 (username))
309 s.login(username, password)
310 return s
311
312 class sendmail(object):
313 '''send mail using sendmail.'''
314
315 def __init__(self, ui, program):
316 self.ui = ui
317 self.program = program
318
319 def sendmail(self, sender, recipients, msg):
320 cmdline = '%s -f %s %s' % (
321 self.program, templater.email(sender),
322 ' '.join(map(templater.email, recipients)))
323 self.ui.note(_('sending mail: %s\n') % cmdline)
324 fp = os.popen(cmdline, 'w')
325 fp.write(msg)
326 ret = fp.close()
327 if ret:
328 raise util.Abort('%s %s' % (
329 os.path.basename(self.program.split(None, 1)[0]),
330 util.explain_exit(ret)[0]))
331
332 method = self.config('email', 'method', 'smtp')
333 if method == 'smtp':
334 mail = smtp()
335 else:
336 mail = sendmail(self, method)
337 return mail
@@ -205,13 +205,15 b' def canonpath(root, cwd, myname):'
205 """return the canonical path of myname, given cwd and root"""
205 """return the canonical path of myname, given cwd and root"""
206 if root == os.sep:
206 if root == os.sep:
207 rootsep = os.sep
207 rootsep = os.sep
208 elif root.endswith(os.sep):
209 rootsep = root
208 else:
210 else:
209 rootsep = root + os.sep
211 rootsep = root + os.sep
210 name = myname
212 name = myname
211 if not os.path.isabs(name):
213 if not os.path.isabs(name):
212 name = os.path.join(root, cwd, name)
214 name = os.path.join(root, cwd, name)
213 name = os.path.normpath(name)
215 name = os.path.normpath(name)
214 if name.startswith(rootsep):
216 if name != rootsep and name.startswith(rootsep):
215 name = name[len(rootsep):]
217 name = name[len(rootsep):]
216 audit_path(name)
218 audit_path(name)
217 return pconvert(name)
219 return pconvert(name)
@@ -533,8 +535,16 b" if os.name == 'nt':"
533
535
534 def os_rcpath():
536 def os_rcpath():
535 '''return default os-specific hgrc search path'''
537 '''return default os-specific hgrc search path'''
536 return system_rcpath() + [os.path.join(os.path.expanduser('~'),
538 path = system_rcpath()
537 'mercurial.ini')]
539 path.append(user_rcpath())
540 userprofile = os.environ.get('USERPROFILE')
541 if userprofile:
542 path.append(os.path.join(userprofile, 'mercurial.ini'))
543 return path
544
545 def user_rcpath():
546 '''return os-specific hgrc search path to the user dir'''
547 return os.path.join(os.path.expanduser('~'), 'mercurial.ini')
538
548
539 def parse_patch_output(output_line):
549 def parse_patch_output(output_line):
540 """parses the output produced by patch and returns the file name"""
550 """parses the output produced by patch and returns the file name"""
@@ -597,7 +607,8 b' else:'
597 def os_rcpath():
607 def os_rcpath():
598 '''return default os-specific hgrc search path'''
608 '''return default os-specific hgrc search path'''
599 path = []
609 path = []
600 if len(sys.argv) > 0:
610 # old mod_python does not set sys.argv
611 if len(getattr(sys, 'argv', [])) > 0:
601 path.extend(rcfiles(os.path.dirname(sys.argv[0]) +
612 path.extend(rcfiles(os.path.dirname(sys.argv[0]) +
602 '/../etc/mercurial'))
613 '/../etc/mercurial'))
603 path.extend(rcfiles('/etc/mercurial'))
614 path.extend(rcfiles('/etc/mercurial'))
@@ -16,7 +16,7 b' import win32api'
16 from demandload import *
16 from demandload import *
17 from i18n import gettext as _
17 from i18n import gettext as _
18 demandload(globals(), 'errno os pywintypes win32con win32file win32process')
18 demandload(globals(), 'errno os pywintypes win32con win32file win32process')
19 demandload(globals(), 'cStringIO winerror')
19 demandload(globals(), 'cStringIO win32com.shell:shell,shellcon winerror')
20
20
21 class WinError:
21 class WinError:
22 winerror_map = {
22 winerror_map = {
@@ -180,9 +180,24 b' def testpid(pid):'
180 def system_rcpath_win32():
180 def system_rcpath_win32():
181 '''return default os-specific hgrc search path'''
181 '''return default os-specific hgrc search path'''
182 proc = win32api.GetCurrentProcess()
182 proc = win32api.GetCurrentProcess()
183 filename = win32process.GetModuleFileNameEx(proc, 0)
183 try:
184 # This will fail on windows < NT
185 filename = win32process.GetModuleFileNameEx(proc, 0)
186 except:
187 filename = win32api.GetModuleFileName(0)
184 return [os.path.join(os.path.dirname(filename), 'mercurial.ini')]
188 return [os.path.join(os.path.dirname(filename), 'mercurial.ini')]
185
189
190 def user_rcpath():
191 '''return os-specific hgrc search path to the user dir'''
192 userdir = os.path.expanduser('~')
193 if userdir == '~':
194 # We are on win < nt: fetch the APPDATA directory location and use
195 # the parent directory as the user home dir.
196 appdir = shell.SHGetPathFromIDList(
197 qshell.SHGetSpecialFolderLocation(0, shellcon.CSIDL_APPDATA))
198 userdir = os.path.dirname(appdir)
199 return os.path.join(userdir, 'mercurial.ini')
200
186 class posixfile_nt(object):
201 class posixfile_nt(object):
187 '''file object with posix-like semantics. on windows, normal
202 '''file object with posix-like semantics. on windows, normal
188 files can not be deleted or renamed if they are open. must open
203 files can not be deleted or renamed if they are open. must open
@@ -16,10 +16,10 b' test-<x>.err.'
16 There are some tricky points here that you should be aware of when
16 There are some tricky points here that you should be aware of when
17 writing tests:
17 writing tests:
18
18
19 - hg commit and hg up -m want user interaction
19 - hg commit and hg merge want user interaction
20
20
21 for commit use -m "text"
21 for commit use -m "text"
22 for hg up -m, set HGMERGE to something noninteractive (like true or merge)
22 for hg merge, set HGMERGE to something noninteractive (like true or merge)
23
23
24 - changeset hashes will change based on user and date which make
24 - changeset hashes will change based on user and date which make
25 things like hg history output change
25 things like hg history output change
@@ -242,24 +242,28 b' PYTHONDIR = os.path.join(INST, "lib", "p'
242 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
242 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
243
243
244 try:
244 try:
245 install_hg()
245 try:
246 install_hg()
246
247
247 tests = 0
248 tests = 0
248 failed = 0
249 failed = 0
249
250
250 if len(args) == 0:
251 if len(args) == 0:
251 args = os.listdir(".")
252 args = os.listdir(".")
252 for test in args:
253 for test in args:
253 if test.startswith("test-"):
254 if test.startswith("test-"):
254 if '~' in test or re.search(r'\.(out|err)$', test):
255 if '~' in test or re.search(r'\.(out|err)$', test):
255 continue
256 continue
256 if not run_one(test):
257 if not run_one(test):
257 failed += 1
258 failed += 1
258 tests += 1
259 tests += 1
259
260
260 print "\n# Ran %d tests, %d failed." % (tests, failed)
261 print "\n# Ran %d tests, %d failed." % (tests, failed)
261 if coverage:
262 if coverage:
262 output_coverage()
263 output_coverage()
264 except KeyboardInterrupt:
265 failed = True
266 print "\ninterrupted!"
263 finally:
267 finally:
264 cleanup_exit()
268 cleanup_exit()
265
269
@@ -1,19 +1,19 b''
1 # basic operation
1 # basic operation
2 adding a
2 adding a
3 changeset 2:b38a34ddfd9f backs out changeset 1:a820f4f40a57
3 changeset 2:c86754337410 backs out changeset 1:a820f4f40a57
4 a
4 a
5 # file that was removed is recreated
5 # file that was removed is recreated
6 adding a
6 adding a
7 adding a
7 adding a
8 changeset 2:44cd84c7349a backs out changeset 1:76862dcce372
8 changeset 2:d2d961bd79f2 backs out changeset 1:76862dcce372
9 content
9 content
10 # backout of backout is as if nothing happened
10 # backout of backout is as if nothing happened
11 removing a
11 removing a
12 changeset 3:0dd8a0ed5e99 backs out changeset 2:44cd84c7349a
12 changeset 3:8a7eeb5ab5ce backs out changeset 2:d2d961bd79f2
13 cat: a: No such file or directory
13 cat: a: No such file or directory
14 # backout with merge
14 # backout with merge
15 adding a
15 adding a
16 changeset 3:6c77ecc28460 backs out changeset 1:314f55b1bf23
16 changeset 3:3c9e845b409c backs out changeset 1:314f55b1bf23
17 merging with changeset 2:b66ea5b77abb
17 merging with changeset 2:b66ea5b77abb
18 merging a
18 merging a
19 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
19 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
@@ -10,7 +10,7 b' hg co 0'
10 echo "something else" > a
10 echo "something else" > a
11 hg commit -m branch2 -d "1000000 0"
11 hg commit -m branch2 -d "1000000 0"
12 HGMERGE=merge; export HGMERGE
12 HGMERGE=merge; export HGMERGE
13 hg up -m 1
13 hg merge 1
14 hg id
14 hg id
15 egrep -v ">>>|<<<" a
15 egrep -v ">>>|<<<" a
16 hg status
16 hg status
@@ -28,7 +28,7 b' hg co -C 0'
28 echo foo-b > a
28 echo foo-b > a
29 hg commit -m "2b" -d "1000000 0"
29 hg commit -m "2b" -d "1000000 0"
30
30
31 HGMERGE=true hg update -m 1
31 HGMERGE=true hg merge 1
32
32
33 echo "%%% should show foo-b"
33 echo "%%% should show foo-b"
34 cat a
34 cat a
@@ -17,12 +17,12 b' hg co 0'
17 echo blah > b
17 echo blah > b
18
18
19 hg ci -m "branch b" -d "1000000 0"
19 hg ci -m "branch b" -d "1000000 0"
20 HGMERGE=true hg up -m 1
20 HGMERGE=true hg merge 1
21
21
22 hg ci -m "merge b/a -> blah" -d "1000000 0"
22 hg ci -m "merge b/a -> blah" -d "1000000 0"
23
23
24 hg co 1
24 hg co 1
25 HGMERGE=true hg up -m 2
25 HGMERGE=true hg merge 2
26 hg ci -m "merge a/b -> blah" -d "1000000 0"
26 hg ci -m "merge a/b -> blah" -d "1000000 0"
27
27
28 hg log
28 hg log
@@ -43,4 +43,4 b' echo'
43
43
44 hg debugindex .hg/data/a.i
44 hg debugindex .hg/data/a.i
45
45
46 hg verify No newline at end of file
46 hg verify
@@ -41,7 +41,7 b' hg debugstate | cut -b 1-16,35-'
41
41
42 echo merging
42 echo merging
43 hg pull ../a
43 hg pull ../a
44 env HGMERGE=../merge hg update -vm
44 env HGMERGE=../merge hg merge -v
45
45
46 echo 2m > foo
46 echo 2m > foo
47 echo 2b > baz
47 echo 2b > baz
@@ -27,7 +27,7 b' hg pull ../test2'
27 hg heads
27 hg heads
28 hg history
28 hg history
29
29
30 hg -v co -m
30 hg -v merge
31
31
32 ls -l ../test[12]/a > foo
32 ls -l ../test[12]/a > foo
33 cut -b 1-10 < foo
33 cut -b 1-10 < foo
@@ -29,7 +29,7 b' hg update -C 0'
29 echo b > b
29 echo b > b
30 hg add b
30 hg add b
31 hg commit -m b -d '1 0'
31 hg commit -m b -d '1 0'
32 hg update -m 1
32 hg merge 1
33 hg commit -m merge -d '2 0'
33 hg commit -m merge -d '2 0'
34
34
35 cd ../b
35 cd ../b
@@ -61,6 +61,14 b" echo 'precommit.forbid = echo precommit."
61 hg commit -m 'fail' -d '4 0'
61 hg commit -m 'fail' -d '4 0'
62 hg -q tip
62 hg -q tip
63
63
64 # preupdate hook can prevent update
65 echo 'preupdate = echo preupdate hook: p1=$HG_PARENT1 p2=$HG_PARENT2' >> .hg/hgrc
66 hg update 1
67
68 # update hook
69 echo 'update = echo update hook: p1=$HG_PARENT1 p2=$HG_PARENT2 err=$HG_ERROR' >> .hg/hgrc
70 hg update
71
64 # prechangegroup hook can prevent incoming changes
72 # prechangegroup hook can prevent incoming changes
65 cd ../b
73 cd ../b
66 hg -q tip
74 hg -q tip
@@ -62,6 +62,11 b' precommit hook: p1=4f92e785b90ae8995dfe1'
62 precommit.forbid hook
62 precommit.forbid hook
63 abort: precommit.forbid hook exited with status 1
63 abort: precommit.forbid hook exited with status 1
64 4:4f92e785b90a
64 4:4f92e785b90a
65 preupdate hook: p1=b702efe9688826e3a91283852b328b84dbf37bc2 p2=
66 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
67 preupdate hook: p1=4f92e785b90ae8995dfe156e39dd4fbc3b346a24 p2=
68 update hook: p1=4f92e785b90ae8995dfe156e39dd4fbc3b346a24 p2= err=0
69 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 3:4c52fb2e4022
70 3:4c52fb2e4022
66 prechangegroup.forbid hook
71 prechangegroup.forbid hook
67 pulling from ../a
72 pulling from ../a
@@ -22,7 +22,7 b' hg add c'
22 hg commit -m "commit #2" -d "1000000 0"
22 hg commit -m "commit #2" -d "1000000 0"
23 echo This is file b1 > b
23 echo This is file b1 > b
24 echo %% no merges expected
24 echo %% no merges expected
25 env HGMERGE=../merge hg update -m 1
25 env HGMERGE=../merge hg merge 1
26 cd ..; /bin/rm -rf t
26 cd ..; /bin/rm -rf t
27
27
28 mkdir t
28 mkdir t
@@ -41,9 +41,9 b' hg add c'
41 hg commit -m "commit #2" -d "1000000 0"
41 hg commit -m "commit #2" -d "1000000 0"
42 echo This is file b2 > b
42 echo This is file b2 > b
43 echo %% merge should fail
43 echo %% merge should fail
44 env HGMERGE=../merge hg update -m 1
44 env HGMERGE=../merge hg merge 1
45 echo %% merge of b expected
45 echo %% merge of b expected
46 env HGMERGE=../merge hg update -f -m 1
46 env HGMERGE=../merge hg merge -f 1
47 cd ..; /bin/rm -rf t
47 cd ..; /bin/rm -rf t
48 echo %%
48 echo %%
49
49
@@ -68,9 +68,9 b' cat b'
68
68
69 echo This is file b22 > b
69 echo This is file b22 > b
70 echo %% merge fails
70 echo %% merge fails
71 env HGMERGE=../merge hg update -m 2
71 env HGMERGE=../merge hg merge 2
72 echo %% merge expected!
72 echo %% merge expected!
73 env HGMERGE=../merge hg update -f -m 2
73 env HGMERGE=../merge hg merge -f 2
74 cd ..; /bin/rm -rf t
74 cd ..; /bin/rm -rf t
75
75
76 mkdir t
76 mkdir t
@@ -90,7 +90,7 b' hg add c'
90 hg commit -m "commit #3" -d "1000000 0"
90 hg commit -m "commit #3" -d "1000000 0"
91 echo This is file b33 > b
91 echo This is file b33 > b
92 echo %% merge of b should fail
92 echo %% merge of b should fail
93 env HGMERGE=../merge hg update -m 2
93 env HGMERGE=../merge hg merge 2
94 echo %% merge of b expected
94 echo %% merge of b expected
95 env HGMERGE=../merge hg update -f -m 2
95 env HGMERGE=../merge hg merge -f 2
96 cd ..; /bin/rm -rf t
96 cd ..; /bin/rm -rf t
@@ -11,7 +11,7 b' hg update 0'
11 echo This is file c1 > c
11 echo This is file c1 > c
12 hg add c
12 hg add c
13 hg commit -m "commit #2" -d "1000000 0"
13 hg commit -m "commit #2" -d "1000000 0"
14 hg update -m 1
14 hg merge 1
15 rm b
15 rm b
16 echo This is file c22 > c
16 echo This is file c22 > c
17 hg commit -m "commit #3" -d "1000000 0"
17 hg commit -m "commit #3" -d "1000000 0"
@@ -33,14 +33,14 b' hg clone B1 B2'
33
33
34 cd A1
34 cd A1
35 hg pull ../B1
35 hg pull ../B1
36 hg update -m
36 hg merge
37 hg commit -m "commit test" -d "1000000 0"
37 hg commit -m "commit test" -d "1000000 0"
38 echo bar should remain deleted.
38 echo bar should remain deleted.
39 hg manifest
39 hg manifest
40
40
41 cd ../B2
41 cd ../B2
42 hg pull ../A2
42 hg pull ../A2
43 hg update -m
43 hg merge
44 hg commit -m "commit test" -d "1000000 0"
44 hg commit -m "commit test" -d "1000000 0"
45 echo bar should remain deleted.
45 echo bar should remain deleted.
46 hg manifest
46 hg manifest
@@ -35,7 +35,7 b' hg commit -m "2 -> 2.5" -d "1000000 0"'
35
35
36 # now pull and merge from test-a
36 # now pull and merge from test-a
37 hg pull ../test-a
37 hg pull ../test-a
38 HGMERGE=merge hg update -m
38 HGMERGE=merge hg merge
39 # resolve conflict
39 # resolve conflict
40 cat >test.txt <<"EOF"
40 cat >test.txt <<"EOF"
41 one
41 one
@@ -57,7 +57,7 b' hg commit -m "two -> two-point-one" -d "'
57 # pull and merge from test-a again
57 # pull and merge from test-a again
58 cd ../test-b
58 cd ../test-b
59 hg pull ../test-a
59 hg pull ../test-a
60 HGMERGE=merge hg update --debug -m
60 HGMERGE=merge hg merge --debug
61
61
62 cat test.txt | sed "s% .*%%"
62 cat test.txt | sed "s% .*%%"
63
63
@@ -22,7 +22,7 b' added 1 changesets with 1 changes to 1 f'
22 (run 'hg heads' to see heads, 'hg merge' to merge)
22 (run 'hg heads' to see heads, 'hg merge' to merge)
23 merge: warning: conflicts during merge
23 merge: warning: conflicts during merge
24 resolving manifests
24 resolving manifests
25 force None allow 1 moddirstate True linear False
25 force False allow True moddirstate True linear False
26 ancestor 055d847dd401 local 2eded9ab0a5c remote 84cf5750dd20
26 ancestor 055d847dd401 local 2eded9ab0a5c remote 84cf5750dd20
27 test.txt versions differ, resolve
27 test.txt versions differ, resolve
28 merging test.txt
28 merging test.txt
@@ -23,7 +23,7 b' hg commit -m "3" -d "1000000 0"'
23 hg push ../a
23 hg push ../a
24 hg pull ../a
24 hg pull ../a
25 hg push ../a
25 hg push ../a
26 hg up -m
26 hg merge
27 hg commit -m "4" -d "1000000 0"
27 hg commit -m "4" -d "1000000 0"
28 hg push ../a
28 hg push ../a
29 cd ..
29 cd ..
@@ -44,7 +44,7 b' for i in 0 1; do'
44 hg ci -m d-$i -d "1000000 0"
44 hg ci -m d-$i -d "1000000 0"
45 done
45 done
46
46
47 HGMERGE=true hg co -m 3
47 HGMERGE=true hg merge 3
48 hg ci -m c-d -d "1000000 0"
48 hg ci -m c-d -d "1000000 0"
49
49
50 hg push ../c
50 hg push ../c
@@ -68,4 +68,16 b' hg revert'
68 echo %% should print executable
68 echo %% should print executable
69 test -x c && echo executable
69 test -x c && echo executable
70
70
71 echo %% issue 241
72 hg init a
73 cd a
74 echo a >> a
75 hg commit -A -d '1 0' -m a
76 echo a >> a
77 hg commit -d '2 0' -m a
78 hg update 0
79 mkdir b
80 echo b > b/b
81 hg revert -rtip
82
71 true
83 true
@@ -51,3 +51,6 b' non-executable'
51 reverting c
51 reverting c
52 %% should print executable
52 %% should print executable
53 executable
53 executable
54 %% issue 241
55 adding a
56 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -14,4 +14,4 b" echo 'stationary' >>b/vehicle"
14 "$HG" commit -m 'Clarifying the vehicle.'
14 "$HG" commit -m 'Clarifying the vehicle.'
15 "$HG" update -C 1
15 "$HG" update -C 1
16 chmod a-w b/vehicle
16 chmod a-w b/vehicle
17 "$HG" update -m 2 2>&1 | sed 's|^\(.*[ ]\).*/\([^/]*/[^/]*/[^/]*\)$|\1\2|g'
17 "$HG" merge 2 2>&1 | sed 's|^\(.*[ ]\).*/\([^/]*/[^/]*/[^/]*\)$|\1\2|g'
@@ -27,7 +27,7 b' echo 1 > b'
27 hg add b
27 hg add b
28 hg commit -m "branch" -d "1000000 0"
28 hg commit -m "branch" -d "1000000 0"
29 hg id
29 hg id
30 hg co -m 1
30 hg merge 1
31 hg id
31 hg id
32 hg status
32 hg status
33
33
@@ -29,7 +29,7 b' hg --debug up'
29 hg parents
29 hg parents
30 hg --debug up 0
30 hg --debug up 0
31 hg parents
31 hg parents
32 hg --debug up -m || echo failed
32 hg --debug merge || echo failed
33 hg parents
33 hg parents
34 hg --debug up
34 hg --debug up
35 hg parents
35 hg parents
@@ -50,8 +50,8 b' hg -q pull ../r1'
50 hg status
50 hg status
51 hg parents
51 hg parents
52 hg --debug up || echo failed
52 hg --debug up || echo failed
53 hg --debug up -m || echo failed
53 hg --debug merge || echo failed
54 hg --debug up -f -m
54 hg --debug merge -f
55 hg parents
55 hg parents
56 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
56 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
57 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
57 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
@@ -112,7 +112,7 b' failed'
112 abort: outstanding uncommitted changes
112 abort: outstanding uncommitted changes
113 failed
113 failed
114 resolving manifests
114 resolving manifests
115 force None allow 1 moddirstate True linear False
115 force False allow True moddirstate True linear False
116 ancestor a0c8bcbbb45c local 1165e8bd193e remote 4096f2872392
116 ancestor a0c8bcbbb45c local 1165e8bd193e remote 4096f2872392
117 a versions differ, resolve
117 a versions differ, resolve
118 b versions differ, resolve
118 b versions differ, resolve
General Comments 0
You need to be logged in to leave comments. Login now