Show More
@@ -1,213 +1,225 b'' | |||
|
1 | 1 | .\"Generated by db2man.xsl. Don't modify this, modify the source. |
|
2 | 2 | .de Sh \" Subsection |
|
3 | 3 | .br |
|
4 | 4 | .if t .Sp |
|
5 | 5 | .ne 5 |
|
6 | 6 | .PP |
|
7 | 7 | \fB\\$1\fR |
|
8 | 8 | .PP |
|
9 | 9 | .. |
|
10 | 10 | .de Sp \" Vertical space (when we can't use .PP) |
|
11 | 11 | .if t .sp .5v |
|
12 | 12 | .if n .sp |
|
13 | 13 | .. |
|
14 | 14 | .de Ip \" List item |
|
15 | 15 | .br |
|
16 | 16 | .ie \\n(.$>=3 .ne \\$3 |
|
17 | 17 | .el .ne 3 |
|
18 | 18 | .IP "\\$1" \\$2 |
|
19 | 19 | .. |
|
20 | 20 | .TH "HG" 1 "" "" "" |
|
21 | 21 | .SH NAME |
|
22 | 22 | hg \- command line interface to the Mercurial source code management system |
|
23 | 23 | .SH "SYNOPSIS" |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | hg [\-v \-d \-q \-y] <command> [command options] [files] |
|
27 | 27 | |
|
28 | 28 | .SH "DESCRIPTION" |
|
29 | 29 | |
|
30 | 30 | |
|
31 | 31 | The hg(1) command provides a command line interface to the Mercurial system\&. |
|
32 | 32 | |
|
33 | 33 | .SH "NOTE" |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | Many of the hg commands are not yet subdirectory and/or working directory aware\&. This means that some commands will only work in the top level repository directory or will only accept paths and filenames relative to the top level\&. Merges and commits, in particular, should be done in the top\-level directory\&. |
|
37 | 37 | |
|
38 | 38 | .SH "OPTIONS" |
|
39 | 39 | |
|
40 | 40 | .TP |
|
41 | 41 | --debug, \-d |
|
42 | 42 | enable debugging output |
|
43 | 43 | |
|
44 | 44 | .TP |
|
45 | 45 | --quiet, \-q |
|
46 | 46 | suppress output |
|
47 | 47 | |
|
48 | 48 | .TP |
|
49 | 49 | --verbose, \-v |
|
50 | 50 | enable additional output |
|
51 | 51 | |
|
52 | 52 | .TP |
|
53 | 53 | --noninteractive, \-y |
|
54 | 54 | do not prompt, assume yes for any required answers |
|
55 | 55 | |
|
56 | 56 | .SH "COMMAND ELEMENTS" |
|
57 | 57 | |
|
58 | 58 | .TP |
|
59 | 59 | files ... |
|
60 | 60 | indicates one or more filename or relative path filenames |
|
61 | 61 | |
|
62 | 62 | .TP |
|
63 | 63 | path |
|
64 | 64 | indicates a path on the local machine |
|
65 | 65 | |
|
66 | 66 | .TP |
|
67 | 67 | revision |
|
68 | 68 | indicates a changeset which can be specified as a changeset id (int), a tag, or a unique substring of the changeset hash value |
|
69 | 69 | |
|
70 | 70 | .TP |
|
71 | 71 | repository path |
|
72 | 72 | is either the pathname of a local repository of the URI of a remote repository\&. There are two available URI protocols, http:// which is fast and the old\-http:// protocol which is much slower but does not require python on the web host\&. |
|
73 | 73 | |
|
74 | 74 | .SH "COMMANDS" |
|
75 | 75 | |
|
76 | 76 | .TP |
|
77 | 77 | add [files ...] |
|
78 | 78 | add the given files to the repository\&. Note that this just schedules the files for addition at the next hg commit time\&. |
|
79 | 79 | |
|
80 | 80 | .TP |
|
81 | 81 | addremove |
|
82 | 82 | add all new files and remove all missing files from the repository\&. new files are ignored if they match any of the patterns in \&.hgignore |
|
83 | 83 | |
|
84 | 84 | .TP |
|
85 | 85 | annotate [\-r revision \-u \-n \-c] [files ...] |
|
86 | 86 | list the files with each line showing the revision id responsible for that line\&. \-u will add the author to the revision id, \-c will print the changeset hash, and \-n will ... |
|
87 | 87 | |
|
88 | 88 | .TP |
|
89 | 89 | branch <path> |
|
90 | 90 | create a new branch of the repository indicated by path in the current directory\&. Note that there should not be a repository already initialized in the current directory |
|
91 | 91 | |
|
92 | 92 | .TP |
|
93 | 93 | checkout [revision] |
|
94 | 94 | check out the indicated version of the repository into the working directory\&. Note that currently no merge occurs with changed files in the working dir\&. |
|
95 | 95 | |
|
96 | 96 | .TP |
|
97 | 97 | commit |
|
98 | 98 | commit all changed files in the working dir to the repository\&. This uses the EDITOR environment variable to bring up an editor to add a commit comment\&. |
|
99 | 99 | |
|
100 | 100 | .TP |
|
101 | 101 | diff [\-r revision] [\-r revision] [files ...] |
|
102 | 102 | generate a unified diff of the indicated files\&. If there are no revisions specified, the working directory file is compared to the tip, one revision specified indicates a comparison between the working directory file and the specified revision, two revisions compares the two versions specified\&. |
|
103 | 103 | |
|
104 | 104 | .TP |
|
105 | 105 | dump <file> [revision] |
|
106 | 106 | print the indicated revision of the file |
|
107 | 107 | |
|
108 | 108 | .TP |
|
109 | 109 | dumpmanifest [revision] |
|
110 | 110 | print the indicated revision of the manifest (list of version controlled files) |
|
111 | 111 | |
|
112 | 112 | .TP |
|
113 | export [revision] | |
|
114 | print the changeset header (author, changeset hash, parent, and commit comment) and the diffs for a particular revision\&. | |
|
115 | ||
|
116 | .TP | |
|
113 | 117 | history |
|
114 | 118 | print the revision history of the repository |
|
115 | 119 | |
|
116 | 120 | .TP |
|
117 | 121 | init |
|
118 | 122 | initialize a repository in the current directory |
|
119 | 123 | |
|
120 | 124 | .TP |
|
121 | 125 | log <file> |
|
122 | 126 | print the revision history of the specified file |
|
123 | 127 | |
|
124 | 128 | .TP |
|
125 | 129 | merge <repository path> |
|
126 | 130 | pull any changes from the specified repository to the repository in the current directory\&. Use the value of the HGMERGE environment variable as a program to resolve any merge conflicts between the two repositories\&. An implicit commit is done at the end of this process if there were any merge conflicts\&. Note that merge does not yet merge with changed files in the working dir\&. |
|
127 | 131 | |
|
128 | 132 | .TP |
|
133 | recover | |
|
134 | rollback an interrupted transaction | |
|
135 | ||
|
136 | .TP | |
|
129 | 137 | remove [files ...] |
|
130 | 138 | schedule the indicated files for removal from the repository at the next commit |
|
131 | 139 | |
|
132 | 140 | .TP |
|
133 | 141 | serve [\-a addr \-n name \-p port \-t templatedir] |
|
134 | 142 | this will start an http server, by default on port 8000, that will allow browsing the repository using the hgweb interface and will allow merging from the repository\&. \-a sets the interface address, \-p the port to listen on, \-n the name of the repository and \-t sets the location of the template directory\&. |
|
135 | 143 | |
|
136 | 144 | .TP |
|
137 | 145 | status |
|
138 | 146 | list new, changed, and missing files in the working directory |
|
139 | 147 | |
|
140 | 148 | .TP |
|
141 | 149 | tags |
|
142 | 150 | list the current tags |
|
143 | 151 | |
|
152 | .TP | |
|
153 | undo | |
|
154 | undo the last transaction | |
|
155 | ||
|
144 | 156 | .SH "ENVIRONMENT VARIABLES" |
|
145 | 157 | |
|
146 | 158 | .TP |
|
147 | 159 | HGMERGE |
|
148 | 160 | points to an executable to use for resolving merge conflicts, the program will be executed with four arguments: local file, remote file, ancestor file, and original filename\&. |
|
149 | 161 | |
|
150 | 162 | .TP |
|
151 | 163 | HGUSER |
|
152 | 164 | this is the string used for the author value of a commit |
|
153 | 165 | |
|
154 | 166 | .TP |
|
155 | 167 | HG_OPTS |
|
156 | 168 | this string is used for default arguments to hg |
|
157 | 169 | |
|
158 | 170 | .TP |
|
159 | 171 | PYTHONPATH |
|
160 | 172 | this is used by Python to find imported modules and needs to be set appropriately based on where mercurial is installed |
|
161 | 173 | |
|
162 | 174 | .TP |
|
163 | 175 | |
|
164 | 176 | if HGUSER is not set, this will be used next as the author value for a commit |
|
165 | 177 | |
|
166 | 178 | .TP |
|
167 | 179 | LOGNAME |
|
168 | 180 | if neither HGUSER nor EMAIL is set, LOGNAME will be used (with @hostname appended) as the author value for a commit |
|
169 | 181 | |
|
170 | 182 | .TP |
|
171 | 183 | EDITOR |
|
172 | 184 | this is the name of the editor to use when committing |
|
173 | 185 | |
|
174 | 186 | .SH "FILES" |
|
175 | 187 | |
|
176 | 188 | .TP |
|
177 | 189 | \&.hgignore |
|
178 | 190 | this file contains regular expressions (one per line) that describe file names that should be ignored by hg |
|
179 | 191 | |
|
180 | 192 | .TP |
|
181 | 193 | \&.hgtags |
|
182 | 194 | this file contains changeset hash values and text tag names (one of each seperated by spaces) that correspond to tagged versions of the repository contents\&. |
|
183 | 195 | |
|
184 | 196 | .TP |
|
185 | 197 | $HOME/\&.hgpaths |
|
186 | 198 | this file contains a mapping from a symbolic name to a repository path (which could be a local path or a remote URI), the format is <symbolic name> <repository path> with each mapping on a seperate line |
|
187 | 199 | |
|
188 | 200 | .SH "BUGS" |
|
189 | 201 | |
|
190 | 202 | |
|
191 | 203 | Probably lots, please post them to the mailing list (See Resources below) when you find them\&. |
|
192 | 204 | |
|
193 | 205 | .SH "AUTHOR" |
|
194 | 206 | |
|
195 | 207 | |
|
196 | 208 | Written by Matt Mackall <mpm@selenic\&.com> |
|
197 | 209 | |
|
198 | 210 | .SH "RESOURCES" |
|
199 | 211 | |
|
200 | 212 | |
|
201 | 213 | Main Web Site: \fIhttp://selenic.com/mercurial\fR |
|
202 | 214 | |
|
203 | 215 | |
|
204 | 216 | Source code repository: \fIhttp://selenic.com/hg\fR |
|
205 | 217 | |
|
206 | 218 | |
|
207 | 219 | Mailing list: \fIhttp://selenic.com/mailman/listinfo/mercurial\fR |
|
208 | 220 | |
|
209 | 221 | .SH "COPYING" |
|
210 | 222 | |
|
211 | 223 | |
|
212 | 224 | Copyright (C) 2005 Matt Mackall\&. Free use of this software is granted under the terms of the GNU General Public License (GPL)\&. |
|
213 | 225 |
@@ -1,417 +1,442 b'' | |||
|
1 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
2 | 2 | <html> |
|
3 | 3 | <head> |
|
4 | 4 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|
5 | 5 | <meta name="generator" content="AsciiDoc 6.0.3"> |
|
6 | 6 | <meta name="author" content="Matt Mackall"> |
|
7 | 7 | <meta name="author-email" content="mpm@selenic.com"> |
|
8 | 8 | <title>HG(1)</title> |
|
9 | 9 | </head> |
|
10 | 10 | <body> |
|
11 | 11 | <h1>HG(1)</h1> |
|
12 | 12 | <p> |
|
13 | 13 | <strong>by Matt Mackall</strong><br /> |
|
14 | 14 | <tt><<a href="mailto:mpm@selenic.com">mpm@selenic.com</a>></tt><br /> |
|
15 | 15 | v0.5, |
|
16 | 16 | 27 May 2005 |
|
17 | 17 | </p> |
|
18 | 18 | <hr /> |
|
19 | 19 | <h2>NAME</h2> |
|
20 | 20 | <p> |
|
21 | 21 | hg - command line interface to the Mercurial source code management system |
|
22 | 22 | </p> |
|
23 | 23 | <hr /> |
|
24 | 24 | <h2>SYNOPSIS</h2> |
|
25 | 25 | <p> |
|
26 | 26 | <em>hg</em> [-v -d -q -y] <command> [command options] [files] |
|
27 | 27 | </p> |
|
28 | 28 | <hr /> |
|
29 | 29 | <h2>DESCRIPTION</h2> |
|
30 | 30 | <p> |
|
31 | 31 | The hg(1) command provides a command line interface to the Mercurial system. |
|
32 | 32 | </p> |
|
33 | 33 | <hr /> |
|
34 | 34 | <h2>NOTE</h2> |
|
35 | 35 | <p> |
|
36 | 36 | Many of the hg commands are not yet subdirectory and/or working directory |
|
37 | 37 | aware. This means that some commands will only work in the top level |
|
38 | 38 | repository directory or will only accept paths and filenames relative to the |
|
39 | 39 | top level. Merges and commits, in particular, should be done in the |
|
40 | 40 | top-level directory. |
|
41 | 41 | </p> |
|
42 | 42 | <hr /> |
|
43 | 43 | <h2>OPTIONS</h2> |
|
44 | 44 | <dl> |
|
45 | 45 | <dt> |
|
46 | 46 | —debug, -d |
|
47 | 47 | </dt> |
|
48 | 48 | <dd> |
|
49 | 49 | |
|
50 | 50 | enable debugging output |
|
51 | 51 | |
|
52 | 52 | </dd> |
|
53 | 53 | <dt> |
|
54 | 54 | —quiet, -q |
|
55 | 55 | </dt> |
|
56 | 56 | <dd> |
|
57 | 57 | |
|
58 | 58 | suppress output |
|
59 | 59 | |
|
60 | 60 | </dd> |
|
61 | 61 | <dt> |
|
62 | 62 | —verbose, -v |
|
63 | 63 | </dt> |
|
64 | 64 | <dd> |
|
65 | 65 | |
|
66 | 66 | enable additional output |
|
67 | 67 | |
|
68 | 68 | </dd> |
|
69 | 69 | <dt> |
|
70 | 70 | —noninteractive, -y |
|
71 | 71 | </dt> |
|
72 | 72 | <dd> |
|
73 | 73 | |
|
74 | 74 | do not prompt, assume <em>yes</em> for any required answers |
|
75 | 75 | |
|
76 | 76 | </dd> |
|
77 | 77 | </dl> |
|
78 | 78 | <hr /> |
|
79 | 79 | <h2>COMMAND ELEMENTS</h2> |
|
80 | 80 | <dl> |
|
81 | 81 | <dt> |
|
82 | 82 | files … |
|
83 | 83 | </dt> |
|
84 | 84 | <dd> |
|
85 | 85 | |
|
86 | 86 | indicates one or more filename or relative path filenames |
|
87 | 87 | |
|
88 | 88 | </dd> |
|
89 | 89 | <dt> |
|
90 | 90 | path |
|
91 | 91 | </dt> |
|
92 | 92 | <dd> |
|
93 | 93 | |
|
94 | 94 | indicates a path on the local machine |
|
95 | 95 | |
|
96 | 96 | </dd> |
|
97 | 97 | <dt> |
|
98 | 98 | revision |
|
99 | 99 | </dt> |
|
100 | 100 | <dd> |
|
101 | 101 | |
|
102 | 102 | indicates a changeset which can be specified as a changeset id (int), |
|
103 | 103 | a tag, or a unique substring of the changeset hash value |
|
104 | 104 | |
|
105 | 105 | </dd> |
|
106 | 106 | <dt> |
|
107 | 107 | repository path |
|
108 | 108 | </dt> |
|
109 | 109 | <dd> |
|
110 | 110 | |
|
111 | 111 | is either the pathname of a local repository of the URI of a remote |
|
112 | 112 | repository. There are two available URI protocols, http:// which is |
|
113 | 113 | fast and the old-http:// protocol which is much slower but does not |
|
114 | 114 | require python on the web host. |
|
115 | 115 | |
|
116 | 116 | </dd> |
|
117 | 117 | </dl> |
|
118 | 118 | <hr /> |
|
119 | 119 | <h2>COMMANDS</h2> |
|
120 | 120 | <dl> |
|
121 | 121 | <dt> |
|
122 | 122 | add [files …] |
|
123 | 123 | </dt> |
|
124 | 124 | <dd> |
|
125 | 125 | |
|
126 | 126 | add the given files to the repository. Note that this just schedules the |
|
127 | 127 | files for addition at the next hg commit time. |
|
128 | 128 | |
|
129 | 129 | </dd> |
|
130 | 130 | <dt> |
|
131 | 131 | addremove |
|
132 | 132 | </dt> |
|
133 | 133 | <dd> |
|
134 | 134 | |
|
135 | 135 | add all new files and remove all missing files from the repository. new |
|
136 | 136 | files are ignored if they match any of the patterns in .hgignore |
|
137 | 137 | |
|
138 | 138 | </dd> |
|
139 | 139 | <dt> |
|
140 | 140 | annotate [-r revision -u -n -c] [files …] |
|
141 | 141 | </dt> |
|
142 | 142 | <dd> |
|
143 | 143 | |
|
144 | 144 | list the files with each line showing the revision id responsible |
|
145 | 145 | for that line. -u will add the author to the revision id, -c will |
|
146 | 146 | print the changeset hash, and -n will … |
|
147 | 147 | |
|
148 | 148 | </dd> |
|
149 | 149 | <dt> |
|
150 | 150 | branch <path> |
|
151 | 151 | </dt> |
|
152 | 152 | <dd> |
|
153 | 153 | |
|
154 | 154 | create a new branch of the repository indicated by path in the current |
|
155 | 155 | directory. Note that there should not be a repository already initialized |
|
156 | 156 | in the current directory |
|
157 | 157 | |
|
158 | 158 | </dd> |
|
159 | 159 | <dt> |
|
160 | 160 | checkout [revision] |
|
161 | 161 | </dt> |
|
162 | 162 | <dd> |
|
163 | 163 | |
|
164 | 164 | check out the indicated version of the repository into the working |
|
165 | 165 | directory. Note that currently no merge occurs with changed files |
|
166 | 166 | in the working dir. |
|
167 | 167 | |
|
168 | 168 | </dd> |
|
169 | 169 | <dt> |
|
170 | 170 | commit |
|
171 | 171 | </dt> |
|
172 | 172 | <dd> |
|
173 | 173 | |
|
174 | 174 | commit all changed files in the working dir to the repository. This uses |
|
175 | 175 | the EDITOR environment variable to bring up an editor to add a commit |
|
176 | 176 | comment. |
|
177 | 177 | |
|
178 | 178 | </dd> |
|
179 | 179 | <dt> |
|
180 | 180 | diff [-r revision] [-r revision] [files …] |
|
181 | 181 | </dt> |
|
182 | 182 | <dd> |
|
183 | 183 | |
|
184 | 184 | generate a unified diff of the indicated files. If there are no |
|
185 | 185 | revisions specified, the working directory file is compared to |
|
186 | 186 | the tip, one revision specified indicates a comparison between the |
|
187 | 187 | working directory file and the specified revision, two revisions |
|
188 | 188 | compares the two versions specified. |
|
189 | 189 | |
|
190 | 190 | </dd> |
|
191 | 191 | <dt> |
|
192 | 192 | dump <file> [revision] |
|
193 | 193 | </dt> |
|
194 | 194 | <dd> |
|
195 | 195 | |
|
196 | 196 | print the indicated revision of the file |
|
197 | 197 | |
|
198 | 198 | </dd> |
|
199 | 199 | <dt> |
|
200 | 200 | dumpmanifest [revision] |
|
201 | 201 | </dt> |
|
202 | 202 | <dd> |
|
203 | 203 | |
|
204 | 204 | print the indicated revision of the manifest (list of version controlled |
|
205 | 205 | files) |
|
206 | 206 | |
|
207 | 207 | </dd> |
|
208 | 208 | <dt> |
|
209 | export [revision] | |
|
210 | </dt> | |
|
211 | <dd> | |
|
212 | ||
|
213 | print the changeset header (author, changeset hash, parent, and commit | |
|
214 | comment) and the diffs for a particular revision. | |
|
215 | ||
|
216 | </dd> | |
|
217 | <dt> | |
|
209 | 218 | history |
|
210 | 219 | </dt> |
|
211 | 220 | <dd> |
|
212 | 221 | |
|
213 | 222 | print the revision history of the repository |
|
214 | 223 | |
|
215 | 224 | </dd> |
|
216 | 225 | <dt> |
|
217 | 226 | init |
|
218 | 227 | </dt> |
|
219 | 228 | <dd> |
|
220 | 229 | |
|
221 | 230 | initialize a repository in the current directory |
|
222 | 231 | |
|
223 | 232 | </dd> |
|
224 | 233 | <dt> |
|
225 | 234 | log <file> |
|
226 | 235 | </dt> |
|
227 | 236 | <dd> |
|
228 | 237 | |
|
229 | 238 | print the revision history of the specified file |
|
230 | 239 | |
|
231 | 240 | </dd> |
|
232 | 241 | <dt> |
|
233 | 242 | merge <repository path> |
|
234 | 243 | </dt> |
|
235 | 244 | <dd> |
|
236 | 245 | |
|
237 | 246 | pull any changes from the specified repository to the repository in the |
|
238 | 247 | current directory. Use the value of the HGMERGE environment variable |
|
239 | 248 | as a program to resolve any merge conflicts between the two repositories. |
|
240 | 249 | An implicit commit is done at the end of this process if there were any |
|
241 | 250 | merge conflicts. Note that merge does not yet merge with changed files |
|
242 | 251 | in the working dir. |
|
243 | 252 | |
|
244 | 253 | </dd> |
|
245 | 254 | <dt> |
|
255 | recover | |
|
256 | </dt> | |
|
257 | <dd> | |
|
258 | ||
|
259 | rollback an interrupted transaction | |
|
260 | ||
|
261 | </dd> | |
|
262 | <dt> | |
|
246 | 263 | remove [files …] |
|
247 | 264 | </dt> |
|
248 | 265 | <dd> |
|
249 | 266 | |
|
250 | 267 | schedule the indicated files for removal from the repository at the next |
|
251 | 268 | commit |
|
252 | 269 | |
|
253 | 270 | </dd> |
|
254 | 271 | <dt> |
|
255 | 272 | serve [-a addr -n name -p port -t templatedir] |
|
256 | 273 | </dt> |
|
257 | 274 | <dd> |
|
258 | 275 | |
|
259 | 276 | this will start an http server, by default on port 8000, that will |
|
260 | 277 | allow browsing the repository using the hgweb interface and will allow |
|
261 | 278 | merging from the repository. -a sets the interface address, -p the |
|
262 | 279 | port to listen on, -n the name of the repository and -t sets the |
|
263 | 280 | location of the template directory. |
|
264 | 281 | |
|
265 | 282 | </dd> |
|
266 | 283 | <dt> |
|
267 | 284 | status |
|
268 | 285 | </dt> |
|
269 | 286 | <dd> |
|
270 | 287 | |
|
271 | 288 | list new, changed, and missing files in the working directory |
|
272 | 289 | |
|
273 | 290 | </dd> |
|
274 | 291 | <dt> |
|
275 | 292 | tags |
|
276 | 293 | </dt> |
|
277 | 294 | <dd> |
|
278 | 295 | |
|
279 | 296 | list the current tags |
|
280 | 297 | |
|
281 | 298 | </dd> |
|
299 | <dt> | |
|
300 | undo | |
|
301 | </dt> | |
|
302 | <dd> | |
|
303 | ||
|
304 | undo the last transaction | |
|
305 | ||
|
306 | </dd> | |
|
282 | 307 | </dl> |
|
283 | 308 | <hr /> |
|
284 | 309 | <h2>ENVIRONMENT VARIABLES</h2> |
|
285 | 310 | <dl> |
|
286 | 311 | <dt> |
|
287 | 312 | HGMERGE |
|
288 | 313 | </dt> |
|
289 | 314 | <dd> |
|
290 | 315 | |
|
291 | 316 | points to an executable to use for resolving merge conflicts, the |
|
292 | 317 | program will be executed with four arguments: local file, remote |
|
293 | 318 | file, ancestor file, and original filename. |
|
294 | 319 | |
|
295 | 320 | </dd> |
|
296 | 321 | <dt> |
|
297 | 322 | HGUSER |
|
298 | 323 | </dt> |
|
299 | 324 | <dd> |
|
300 | 325 | |
|
301 | 326 | this is the string used for the author value of a commit |
|
302 | 327 | |
|
303 | 328 | </dd> |
|
304 | 329 | <dt> |
|
305 | 330 | HG_OPTS |
|
306 | 331 | </dt> |
|
307 | 332 | <dd> |
|
308 | 333 | |
|
309 | 334 | this string is used for default arguments to hg |
|
310 | 335 | |
|
311 | 336 | </dd> |
|
312 | 337 | <dt> |
|
313 | 338 | PYTHONPATH |
|
314 | 339 | </dt> |
|
315 | 340 | <dd> |
|
316 | 341 | |
|
317 | 342 | this is used by Python to find imported modules and needs to be set |
|
318 | 343 | appropriately based on where mercurial is installed |
|
319 | 344 | |
|
320 | 345 | </dd> |
|
321 | 346 | <dt> |
|
322 | 347 | |
|
323 | 348 | </dt> |
|
324 | 349 | <dd> |
|
325 | 350 | |
|
326 | 351 | if HGUSER is not set, this will be used next as the author value for |
|
327 | 352 | a commit |
|
328 | 353 | |
|
329 | 354 | </dd> |
|
330 | 355 | <dt> |
|
331 | 356 | LOGNAME |
|
332 | 357 | </dt> |
|
333 | 358 | <dd> |
|
334 | 359 | |
|
335 | 360 | if neither HGUSER nor EMAIL is set, LOGNAME will be used (with |
|
336 | 361 | <em>@hostname</em> appended) as the author value for a commit |
|
337 | 362 | |
|
338 | 363 | </dd> |
|
339 | 364 | <dt> |
|
340 | 365 | EDITOR |
|
341 | 366 | </dt> |
|
342 | 367 | <dd> |
|
343 | 368 | |
|
344 | 369 | this is the name of the editor to use when committing |
|
345 | 370 | |
|
346 | 371 | </dd> |
|
347 | 372 | </dl> |
|
348 | 373 | <hr /> |
|
349 | 374 | <h2>FILES</h2> |
|
350 | 375 | <dl> |
|
351 | 376 | <dt> |
|
352 | 377 | .hgignore |
|
353 | 378 | </dt> |
|
354 | 379 | <dd> |
|
355 | 380 | |
|
356 | 381 | this file contains regular expressions (one per line) that describe file |
|
357 | 382 | names that should be ignored by hg |
|
358 | 383 | |
|
359 | 384 | </dd> |
|
360 | 385 | <dt> |
|
361 | 386 | .hgtags |
|
362 | 387 | </dt> |
|
363 | 388 | <dd> |
|
364 | 389 | |
|
365 | 390 | this file contains changeset hash values and text tag names (one of each |
|
366 | 391 | seperated by spaces) that correspond to tagged versions of the repository |
|
367 | 392 | contents. |
|
368 | 393 | |
|
369 | 394 | </dd> |
|
370 | 395 | <dt> |
|
371 | 396 | $HOME/.hgpaths |
|
372 | 397 | </dt> |
|
373 | 398 | <dd> |
|
374 | 399 | |
|
375 | 400 | this file contains a mapping from a symbolic name to a repository path |
|
376 | 401 | (which could be a local path or a remote URI), the format is |
|
377 | 402 | <symbolic name> <repository path> with each mapping on a seperate line |
|
378 | 403 | |
|
379 | 404 | </dd> |
|
380 | 405 | </dl> |
|
381 | 406 | <hr /> |
|
382 | 407 | <h2>BUGS</h2> |
|
383 | 408 | <p> |
|
384 | 409 | Probably lots, please post them to the mailing list (See Resources below) |
|
385 | 410 | when you find them. |
|
386 | 411 | </p> |
|
387 | 412 | <hr /> |
|
388 | 413 | <h2>AUTHOR</h2> |
|
389 | 414 | <p> |
|
390 | 415 | Written by Matt Mackall <mpm@selenic.com> |
|
391 | 416 | </p> |
|
392 | 417 | <hr /> |
|
393 | 418 | <h2>RESOURCES</h2> |
|
394 | 419 | <p> |
|
395 | 420 | <a href="http://selenic.com/mercurial">Main Web Site</a> |
|
396 | 421 | </p> |
|
397 | 422 | <p> |
|
398 | 423 | <a href="http://selenic.com/hg">Source code repository</a> |
|
399 | 424 | </p> |
|
400 | 425 | <p> |
|
401 | 426 | <a href="http://selenic.com/mailman/listinfo/mercurial">Mailing list</a> |
|
402 | 427 | </p> |
|
403 | 428 | <hr /> |
|
404 | 429 | <h2>COPYING</h2> |
|
405 | 430 | <p> |
|
406 | 431 | Copyright © 2005 Matt Mackall. |
|
407 | 432 | Free use of this software is granted under the terms of the GNU General |
|
408 | 433 | Public License (GPL). |
|
409 | 434 | </p> |
|
410 | 435 | <p></p> |
|
411 | 436 | <p></p> |
|
412 | 437 | <hr /><p><small> |
|
413 | 438 | Version 0.5<br /> |
|
414 |
Last updated 27-May-2005 15: |
|
|
439 | Last updated 27-May-2005 15:51:06 MDT | |
|
415 | 440 | </small></p> |
|
416 | 441 | </body> |
|
417 | 442 | </html> |
@@ -1,202 +1,212 b'' | |||
|
1 | 1 | HG(1) |
|
2 | 2 | ===== |
|
3 | 3 | Matt Mackall <mpm@selenic.com> |
|
4 | 4 | v0.5, 27 May 2005 |
|
5 | 5 | |
|
6 | 6 | NAME |
|
7 | 7 | ---- |
|
8 | 8 | hg - command line interface to the Mercurial source code management system |
|
9 | 9 | |
|
10 | 10 | SYNOPSIS |
|
11 | 11 | -------- |
|
12 | 12 | 'hg' [-v -d -q -y] <command> [command options] [files] |
|
13 | 13 | |
|
14 | 14 | DESCRIPTION |
|
15 | 15 | ----------- |
|
16 | 16 | The hg(1) command provides a command line interface to the Mercurial system. |
|
17 | 17 | |
|
18 | 18 | NOTE |
|
19 | 19 | ---- |
|
20 | 20 | Many of the hg commands are not yet subdirectory and/or working directory |
|
21 | 21 | aware. This means that some commands will only work in the top level |
|
22 | 22 | repository directory or will only accept paths and filenames relative to the |
|
23 | 23 | top level. Merges and commits, in particular, should be done in the |
|
24 | 24 | top-level directory. |
|
25 | 25 | |
|
26 | 26 | OPTIONS |
|
27 | 27 | ------- |
|
28 | 28 | --debug, -d:: |
|
29 | 29 | enable debugging output |
|
30 | 30 | |
|
31 | 31 | --quiet, -q:: |
|
32 | 32 | suppress output |
|
33 | 33 | |
|
34 | 34 | --verbose, -v:: |
|
35 | 35 | enable additional output |
|
36 | 36 | |
|
37 | 37 | --noninteractive, -y:: |
|
38 | 38 | do not prompt, assume 'yes' for any required answers |
|
39 | 39 | |
|
40 | 40 | COMMAND ELEMENTS |
|
41 | 41 | ---------------- |
|
42 | 42 | |
|
43 | 43 | files ...:: |
|
44 | 44 | indicates one or more filename or relative path filenames |
|
45 | 45 | |
|
46 | 46 | path:: |
|
47 | 47 | indicates a path on the local machine |
|
48 | 48 | |
|
49 | 49 | revision:: |
|
50 | 50 | indicates a changeset which can be specified as a changeset id (int), |
|
51 | 51 | a tag, or a unique substring of the changeset hash value |
|
52 | 52 | |
|
53 | 53 | repository path:: |
|
54 | 54 | is either the pathname of a local repository of the URI of a remote |
|
55 | 55 | repository. There are two available URI protocols, http:// which is |
|
56 | 56 | fast and the old-http:// protocol which is much slower but does not |
|
57 | 57 | require python on the web host. |
|
58 | 58 | |
|
59 | 59 | COMMANDS |
|
60 | 60 | -------- |
|
61 | 61 | add [files ...]:: |
|
62 | 62 | add the given files to the repository. Note that this just schedules the |
|
63 | 63 | files for addition at the next hg commit time. |
|
64 | 64 | |
|
65 | 65 | addremove:: |
|
66 | 66 | add all new files and remove all missing files from the repository. new |
|
67 | 67 | files are ignored if they match any of the patterns in .hgignore |
|
68 | 68 | |
|
69 | 69 | annotate [-r revision -u -n -c] [files ...]:: |
|
70 | 70 | list the files with each line showing the revision id responsible |
|
71 | 71 | for that line. -u will add the author to the revision id, -c will |
|
72 | 72 | print the changeset hash, and -n will ... |
|
73 | 73 | |
|
74 | 74 | branch <path>:: |
|
75 | 75 | create a new branch of the repository indicated by path in the current |
|
76 | 76 | directory. Note that there should not be a repository already initialized |
|
77 | 77 | in the current directory |
|
78 | 78 | |
|
79 | 79 | checkout [revision]:: |
|
80 | 80 | check out the indicated version of the repository into the working |
|
81 | 81 | directory. Note that currently no merge occurs with changed files |
|
82 | 82 | in the working dir. |
|
83 | 83 | |
|
84 | 84 | commit:: |
|
85 | 85 | commit all changed files in the working dir to the repository. This uses |
|
86 | 86 | the EDITOR environment variable to bring up an editor to add a commit |
|
87 | 87 | comment. |
|
88 | 88 | |
|
89 | 89 | diff [-r revision] [-r revision] [files ...]:: |
|
90 | 90 | generate a unified diff of the indicated files. If there are no |
|
91 | 91 | revisions specified, the working directory file is compared to |
|
92 | 92 | the tip, one revision specified indicates a comparison between the |
|
93 | 93 | working directory file and the specified revision, two revisions |
|
94 | 94 | compares the two versions specified. |
|
95 | 95 | |
|
96 | 96 | dump <file> [revision]:: |
|
97 | 97 | print the indicated revision of the file |
|
98 | 98 | |
|
99 | 99 | dumpmanifest [revision]:: |
|
100 | 100 | print the indicated revision of the manifest (list of version controlled |
|
101 | 101 | files) |
|
102 | 102 | |
|
103 | export [revision]:: | |
|
104 | print the changeset header (author, changeset hash, parent, and commit | |
|
105 | comment) and the diffs for a particular revision. | |
|
106 | ||
|
103 | 107 | history:: |
|
104 | 108 | print the revision history of the repository |
|
105 | 109 | |
|
106 | 110 | init:: |
|
107 | 111 | initialize a repository in the current directory |
|
108 | 112 | |
|
109 | 113 | log <file>:: |
|
110 | 114 | print the revision history of the specified file |
|
111 | 115 | |
|
112 | 116 | merge <repository path>:: |
|
113 | 117 | pull any changes from the specified repository to the repository in the |
|
114 | 118 | current directory. Use the value of the HGMERGE environment variable |
|
115 | 119 | as a program to resolve any merge conflicts between the two repositories. |
|
116 | 120 | An implicit commit is done at the end of this process if there were any |
|
117 | 121 | merge conflicts. Note that merge does not yet merge with changed files |
|
118 | 122 | in the working dir. |
|
119 | 123 | |
|
124 | recover:: | |
|
125 | rollback an interrupted transaction | |
|
126 | ||
|
120 | 127 | remove [files ...]:: |
|
121 | 128 | schedule the indicated files for removal from the repository at the next |
|
122 | 129 | commit |
|
123 | 130 | |
|
124 | 131 | serve [-a addr -n name -p port -t templatedir]:: |
|
125 | 132 | this will start an http server, by default on port 8000, that will |
|
126 | 133 | allow browsing the repository using the hgweb interface and will allow |
|
127 | 134 | merging from the repository. -a sets the interface address, -p the |
|
128 | 135 | port to listen on, -n the name of the repository and -t sets the |
|
129 | 136 | location of the template directory. |
|
130 | 137 | |
|
131 | 138 | status:: |
|
132 | 139 | list new, changed, and missing files in the working directory |
|
133 | 140 | |
|
134 | 141 | tags:: |
|
135 | 142 | list the current tags |
|
136 | 143 | |
|
144 | undo:: | |
|
145 | undo the last transaction | |
|
146 | ||
|
137 | 147 | ENVIRONMENT VARIABLES |
|
138 | 148 | --------------------- |
|
139 | 149 | HGMERGE:: |
|
140 | 150 | points to an executable to use for resolving merge conflicts, the |
|
141 | 151 | program will be executed with four arguments: local file, remote |
|
142 | 152 | file, ancestor file, and original filename. |
|
143 | 153 | |
|
144 | 154 | HGUSER:: |
|
145 | 155 | this is the string used for the author value of a commit |
|
146 | 156 | |
|
147 | 157 | HG_OPTS:: |
|
148 | 158 | this string is used for default arguments to hg |
|
149 | 159 | |
|
150 | 160 | PYTHONPATH:: |
|
151 | 161 | this is used by Python to find imported modules and needs to be set |
|
152 | 162 | appropriately based on where mercurial is installed |
|
153 | 163 | |
|
154 | 164 | EMAIL:: |
|
155 | 165 | if HGUSER is not set, this will be used next as the author value for |
|
156 | 166 | a commit |
|
157 | 167 | |
|
158 | 168 | LOGNAME:: |
|
159 | 169 | if neither HGUSER nor EMAIL is set, LOGNAME will be used (with |
|
160 | 170 | '@hostname' appended) as the author value for a commit |
|
161 | 171 | |
|
162 | 172 | EDITOR:: |
|
163 | 173 | this is the name of the editor to use when committing |
|
164 | 174 | |
|
165 | 175 | FILES |
|
166 | 176 | ----- |
|
167 | 177 | .hgignore:: |
|
168 | 178 | this file contains regular expressions (one per line) that describe file |
|
169 | 179 | names that should be ignored by hg |
|
170 | 180 | |
|
171 | 181 | .hgtags:: |
|
172 | 182 | this file contains changeset hash values and text tag names (one of each |
|
173 | 183 | seperated by spaces) that correspond to tagged versions of the repository |
|
174 | 184 | contents. |
|
175 | 185 | |
|
176 | 186 | $HOME/.hgpaths:: |
|
177 | 187 | this file contains a mapping from a symbolic name to a repository path |
|
178 | 188 | (which could be a local path or a remote URI), the format is |
|
179 | 189 | <symbolic name> <repository path> with each mapping on a seperate line |
|
180 | 190 | |
|
181 | 191 | BUGS |
|
182 | 192 | ---- |
|
183 | 193 | Probably lots, please post them to the mailing list (See Resources below) |
|
184 | 194 | when you find them. |
|
185 | 195 | |
|
186 | 196 | AUTHOR |
|
187 | 197 | ------ |
|
188 | 198 | Written by Matt Mackall <mpm@selenic.com> |
|
189 | 199 | |
|
190 | 200 | RESOURCES |
|
191 | 201 | --------- |
|
192 | 202 | http://selenic.com/mercurial[Main Web Site] |
|
193 | 203 | |
|
194 | 204 | http://selenic.com/hg[Source code repository] |
|
195 | 205 | |
|
196 | 206 | http://selenic.com/mailman/listinfo/mercurial[Mailing list] |
|
197 | 207 | |
|
198 | 208 | COPYING |
|
199 | 209 | ------- |
|
200 | 210 | Copyright (C) 2005 Matt Mackall. |
|
201 | 211 | Free use of this software is granted under the terms of the GNU General |
|
202 | 212 | Public License (GPL). |
@@ -1,588 +1,589 b'' | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | # |
|
3 | 3 | # mercurial - a minimal scalable distributed SCM |
|
4 | 4 | # v0.5b "katje" |
|
5 | 5 | # |
|
6 | 6 | # Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
7 | 7 | # |
|
8 | 8 | # This software may be used and distributed according to the terms |
|
9 | 9 | # of the GNU General Public License, incorporated herein by reference. |
|
10 | 10 | |
|
11 | 11 | # the psyco compiler makes commits a bit faster |
|
12 | 12 | # and makes changegroup merge about 20 times slower! |
|
13 | 13 | # try: |
|
14 | 14 | # import psyco |
|
15 | 15 | # psyco.full() |
|
16 | 16 | # except: |
|
17 | 17 | # pass |
|
18 | 18 | |
|
19 | 19 | import sys, os, time |
|
20 | 20 | from mercurial import hg, mdiff, fancyopts |
|
21 | 21 | |
|
22 | 22 | def help(): |
|
23 | 23 | ui.status("""\ |
|
24 | 24 | commands: |
|
25 | 25 | |
|
26 | 26 | add [files...] add the given files in the next commit |
|
27 | 27 | addremove add all new files, delete all missing files |
|
28 | 28 | annotate [files...] show changeset number per file line |
|
29 | 29 | branch <path> create a branch of <path> in this directory |
|
30 | 30 | checkout [changeset] checkout the latest or given changeset |
|
31 | 31 | commit commit all changes to the repository |
|
32 | 32 | diff [files...] diff working directory (or selected files) |
|
33 | 33 | dump <file> [rev] dump the latest or given revision of a file |
|
34 | 34 | dumpmanifest [rev] dump the latest or given revision of the manifest |
|
35 | export <rev> dump the changeset header and diffs for a revision | |
|
35 | 36 | history show changeset history |
|
36 | 37 | init create a new repository in this directory |
|
37 | 38 | log <file> show revision history of a single file |
|
38 | 39 | merge <path> merge changes from <path> into local repository |
|
39 | 40 | recover rollback an interrupted transaction |
|
40 | 41 | remove [files...] remove the given files in the next commit |
|
41 | 42 | serve export the repository via HTTP |
|
42 | 43 | status show new, missing, and changed files in working dir |
|
43 | 44 | tags show current changeset tags |
|
44 | 45 | undo undo the last transaction |
|
45 | 46 | """) |
|
46 | 47 | |
|
47 | 48 | def filterfiles(list, files): |
|
48 | 49 | l = [ x for x in list if x in files ] |
|
49 | 50 | |
|
50 | 51 | for f in files: |
|
51 | 52 | if f[-1] != os.sep: f += os.sep |
|
52 | 53 | l += [ x for x in list if x.startswith(f) ] |
|
53 | 54 | return l |
|
54 | 55 | |
|
55 | 56 | def diff(files = None, node1 = None, node2 = None): |
|
56 | 57 | def date(c): |
|
57 | 58 | return time.asctime(time.gmtime(float(c[2].split(' ')[0]))) |
|
58 | 59 | |
|
59 | 60 | if node2: |
|
60 | 61 | change = repo.changelog.read(node2) |
|
61 | 62 | mmap2 = repo.manifest.read(change[0]) |
|
62 | 63 | (c, a, d) = repo.diffrevs(node1, node2) |
|
63 | 64 | def read(f): return repo.file(f).read(mmap2[f]) |
|
64 | 65 | date2 = date(change) |
|
65 | 66 | else: |
|
66 | 67 | date2 = time.asctime() |
|
67 | 68 | if not node1: |
|
68 | 69 | node1 = repo.current |
|
69 | 70 | (c, a, d) = repo.diffdir(repo.root, node1) |
|
70 | 71 | a = [] # ignore unknown files in repo, by popular request |
|
71 | 72 | def read(f): return file(os.path.join(repo.root, f)).read() |
|
72 | 73 | |
|
73 | 74 | change = repo.changelog.read(node1) |
|
74 | 75 | mmap = repo.manifest.read(change[0]) |
|
75 | 76 | date1 = date(change) |
|
76 | 77 | |
|
77 | 78 | if files: |
|
78 | 79 | c, a, d = map(lambda x: filterfiles(x, files), (c, a, d)) |
|
79 | 80 | |
|
80 | 81 | for f in c: |
|
81 | 82 | to = "" |
|
82 | 83 | if mmap.has_key(f): |
|
83 | 84 | to = repo.file(f).read(mmap[f]) |
|
84 | 85 | tn = read(f) |
|
85 | 86 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
86 | 87 | for f in a: |
|
87 | 88 | to = "" |
|
88 | 89 | tn = read(f) |
|
89 | 90 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
90 | 91 | for f in d: |
|
91 | 92 | to = repo.file(f).read(mmap[f]) |
|
92 | 93 | tn = "" |
|
93 | 94 | sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f)) |
|
94 | 95 | |
|
95 | 96 | options = {} |
|
96 | 97 | opts = [('v', 'verbose', None, 'verbose'), |
|
97 | 98 | ('d', 'debug', None, 'debug'), |
|
98 | 99 | ('q', 'quiet', None, 'quiet'), |
|
99 | 100 | ('y', 'noninteractive', None, 'run non-interactively'), |
|
100 | 101 | ] |
|
101 | 102 | |
|
102 | 103 | args = fancyopts.fancyopts(sys.argv[1:], opts, options, |
|
103 | 104 | 'hg [options] <command> [command options] [files]') |
|
104 | 105 | |
|
105 | 106 | try: |
|
106 | 107 | cmd = args[0] |
|
107 | 108 | args = args[1:] |
|
108 | 109 | except: |
|
109 | 110 | cmd = "" |
|
110 | 111 | |
|
111 | 112 | ui = hg.ui(options["verbose"], options["debug"], options["quiet"], |
|
112 | 113 | not options["noninteractive"]) |
|
113 | 114 | |
|
114 | 115 | if cmd == "init": |
|
115 | 116 | repo = hg.repository(ui, ".", create=1) |
|
116 | 117 | sys.exit(0) |
|
117 | 118 | elif cmd == "branch" or cmd == "clone": |
|
118 | 119 | os.system("cp -al %s/.hg .hg" % args[0]) |
|
119 | 120 | sys.exit(0) |
|
120 | 121 | elif cmd == "help": |
|
121 | 122 | help() |
|
122 | 123 | sys.exit(0) |
|
123 | 124 | else: |
|
124 | 125 | try: |
|
125 | 126 | repo = hg.repository(ui=ui) |
|
126 | 127 | except IOError: |
|
127 | 128 | ui.warn("Unable to open repository\n") |
|
128 | 129 | sys.exit(0) |
|
129 | 130 | |
|
130 | 131 | relpath = None |
|
131 | 132 | if os.getcwd() != repo.root: |
|
132 | 133 | relpath = os.getcwd()[len(repo.root) + 1: ] |
|
133 | 134 | |
|
134 | 135 | if cmd == "checkout" or cmd == "co": |
|
135 | 136 | node = repo.changelog.tip() |
|
136 | 137 | if args: |
|
137 | 138 | node = repo.lookup(args[0]) |
|
138 | 139 | repo.checkout(node) |
|
139 | 140 | |
|
140 | 141 | elif cmd == "add": |
|
141 | 142 | repo.add(args) |
|
142 | 143 | |
|
143 | 144 | elif cmd == "remove" or cmd == "rm" or cmd == "del" or cmd == "delete": |
|
144 | 145 | repo.remove(args) |
|
145 | 146 | |
|
146 | 147 | elif cmd == "commit" or cmd == "checkin" or cmd == "ci": |
|
147 | 148 | if 1: |
|
148 | 149 | if len(args) > 0: |
|
149 | 150 | repo.commit(repo.current, args) |
|
150 | 151 | else: |
|
151 | 152 | repo.commit(repo.current) |
|
152 | 153 | |
|
153 | 154 | elif cmd == "import" or cmd == "patch": |
|
154 | 155 | try: |
|
155 | 156 | import psyco |
|
156 | 157 | psyco.full() |
|
157 | 158 | except: |
|
158 | 159 | pass |
|
159 | 160 | |
|
160 | 161 | ioptions = {} |
|
161 | 162 | opts = [('p', 'strip', 1, 'path strip'), |
|
162 | 163 | ('b', 'base', "", 'base path'), |
|
163 | 164 | ('q', 'quiet', "", 'silence diff') |
|
164 | 165 | ] |
|
165 | 166 | |
|
166 | 167 | args = fancyopts.fancyopts(args, opts, ioptions, |
|
167 | 168 | 'hg import [options] <patch names>') |
|
168 | 169 | d = ioptions["base"] |
|
169 | 170 | strip = ioptions["strip"] |
|
170 | 171 | quiet = ioptions["quiet"] and "> /dev/null" or "" |
|
171 | 172 | |
|
172 | 173 | for patch in args: |
|
173 | 174 | ui.status("applying %s\n" % patch) |
|
174 | 175 | pf = os.path.join(d, patch) |
|
175 | 176 | |
|
176 | 177 | text = "" |
|
177 | 178 | for l in file(pf): |
|
178 | 179 | if l[:4] == "--- ": break |
|
179 | 180 | text += l |
|
180 | 181 | |
|
181 | 182 | f = os.popen("lsdiff --strip %d %s" % (strip, pf)) |
|
182 | 183 | files = filter(None, map(lambda x: x.rstrip(), f.read().splitlines())) |
|
183 | 184 | f.close() |
|
184 | 185 | |
|
185 | 186 | if files: |
|
186 | 187 | if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): |
|
187 | 188 | raise "patch failed!" |
|
188 | 189 | repo.commit(repo.current, files, text) |
|
189 | 190 | |
|
190 | 191 | elif cmd == "status": |
|
191 | 192 | (c, a, d) = repo.diffdir(repo.root, repo.current) |
|
192 | 193 | if relpath: |
|
193 | 194 | (c, a, d) = map(lambda x: filterfiles(x, [ relpath ]), (c, a, d)) |
|
194 | 195 | |
|
195 | 196 | for f in c: print "C", f |
|
196 | 197 | for f in a: print "?", f |
|
197 | 198 | for f in d: print "R", f |
|
198 | 199 | |
|
199 | 200 | elif cmd == "diff": |
|
200 | 201 | revs = [] |
|
201 | 202 | |
|
202 | 203 | if args: |
|
203 | 204 | doptions = {} |
|
204 | 205 | opts = [('r', 'revision', [], 'revision')] |
|
205 | 206 | args = fancyopts.fancyopts(args, opts, doptions, |
|
206 | 207 | 'hg diff [options] [files]') |
|
207 | 208 | revs = map(lambda x: repo.lookup(x), doptions['revision']) |
|
208 | 209 | |
|
209 | 210 | if len(revs) > 2: |
|
210 | 211 | self.ui.warn("too many revisions to diff\n") |
|
211 | 212 | sys.exit(1) |
|
212 | 213 | |
|
213 | 214 | if relpath: |
|
214 | 215 | if not args: args = [ relpath ] |
|
215 | 216 | else: args = [ os.path.join(relpath, x) for x in args ] |
|
216 | 217 | |
|
217 | 218 | diff(args, *revs) |
|
218 | 219 | |
|
219 | 220 | elif cmd == "annotate": |
|
220 | 221 | bcache = {} |
|
221 | 222 | |
|
222 | 223 | def getnode(rev): |
|
223 | 224 | return hg.short(repo.changelog.node(rev)) |
|
224 | 225 | |
|
225 | 226 | def getname(rev): |
|
226 | 227 | try: |
|
227 | 228 | return bcache[rev] |
|
228 | 229 | except KeyError: |
|
229 | 230 | cl = repo.changelog.read(repo.changelog.node(rev)) |
|
230 | 231 | name = cl[1] |
|
231 | 232 | f = name.find('@') |
|
232 | 233 | if f >= 0: |
|
233 | 234 | name = name[:f] |
|
234 | 235 | bcache[rev] = name |
|
235 | 236 | return name |
|
236 | 237 | |
|
237 | 238 | aoptions = {} |
|
238 | 239 | opts = [('r', 'revision', '', 'revision'), |
|
239 | 240 | ('u', 'user', None, 'show user'), |
|
240 | 241 | ('n', 'number', None, 'show revision number'), |
|
241 | 242 | ('c', 'changeset', None, 'show changeset')] |
|
242 | 243 | |
|
243 | 244 | args = fancyopts.fancyopts(args, opts, aoptions, |
|
244 | 245 | 'hg annotate [-u] [-c] [-n] [-r id] [files]') |
|
245 | 246 | |
|
246 | 247 | opmap = [['user', getname], ['number', str], ['changeset', getnode]] |
|
247 | 248 | if not aoptions['user'] and not aoptions['changeset']: |
|
248 | 249 | aoptions['number'] = 1 |
|
249 | 250 | |
|
250 | 251 | if args: |
|
251 | 252 | if relpath: args = [ os.path.join(relpath, x) for x in args ] |
|
252 | 253 | node = repo.current |
|
253 | 254 | if aoptions['revision']: |
|
254 | 255 | node = repo.changelog.lookup(aoptions['revision']) |
|
255 | 256 | change = repo.changelog.read(node) |
|
256 | 257 | mmap = repo.manifest.read(change[0]) |
|
257 | 258 | maxuserlen = 0 |
|
258 | 259 | maxchangelen = 0 |
|
259 | 260 | for f in args: |
|
260 | 261 | lines = repo.file(f).annotate(mmap[f]) |
|
261 | 262 | pieces = [] |
|
262 | 263 | |
|
263 | 264 | for o, f in opmap: |
|
264 | 265 | if aoptions[o]: |
|
265 | 266 | l = [ f(n) for n,t in lines ] |
|
266 | 267 | m = max(map(len, l)) |
|
267 | 268 | pieces.append([ "%*s" % (m, x) for x in l]) |
|
268 | 269 | |
|
269 | 270 | for p,l in zip(zip(*pieces), lines): |
|
270 | 271 | sys.stdout.write(" ".join(p) + ": " + l[1]) |
|
271 | 272 | |
|
272 | 273 | elif cmd == "export": |
|
273 | 274 | node = repo.lookup(args[0]) |
|
274 | 275 | prev, other = repo.changelog.parents(node) |
|
275 | 276 | change = repo.changelog.read(node) |
|
276 | 277 | print "# HG changeset patch" |
|
277 | 278 | print "# User %s" % change[1] |
|
278 | 279 | print "# Node ID %s" % hg.hex(node) |
|
279 | 280 | print "# Parent %s" % hg.hex(prev) |
|
280 | 281 | |
|
281 | 282 | if other != hg.nullid: |
|
282 | 283 | print "# Parent %s" % hg.hex(other) |
|
283 | 284 | print change[4] |
|
284 | 285 | |
|
285 | 286 | diff(None, prev, node) |
|
286 | 287 | |
|
287 | 288 | elif cmd == "debugchangegroup": |
|
288 | 289 | newer = repo.newer(map(repo.lookup, args)) |
|
289 | 290 | for chunk in repo.changegroup(newer): |
|
290 | 291 | sys.stdout.write(chunk) |
|
291 | 292 | |
|
292 | 293 | elif cmd == "debugaddchangegroup": |
|
293 | 294 | data = sys.stdin.read() |
|
294 | 295 | repo.addchangegroup(data) |
|
295 | 296 | |
|
296 | 297 | elif cmd == "addremove": |
|
297 | 298 | (c, a, d) = repo.diffdir(repo.root, repo.current) |
|
298 | 299 | repo.add(a) |
|
299 | 300 | repo.remove(d) |
|
300 | 301 | |
|
301 | 302 | elif cmd == "history": |
|
302 | 303 | for i in range(repo.changelog.count()): |
|
303 | 304 | n = repo.changelog.node(i) |
|
304 | 305 | changes = repo.changelog.read(n) |
|
305 | 306 | (p1, p2) = repo.changelog.parents(n) |
|
306 | 307 | (h, h1, h2) = map(hg.hex, (n, p1, p2)) |
|
307 | 308 | (i1, i2) = map(repo.changelog.rev, (p1, p2)) |
|
308 | 309 | print "rev: %4d:%s" % (i, h) |
|
309 | 310 | print "parents: %4d:%s" % (i1, h1) |
|
310 | 311 | if i2: print " %4d:%s" % (i2, h2) |
|
311 | 312 | print "manifest: %4d:%s" % (repo.manifest.rev(changes[0]), |
|
312 | 313 | hg.hex(changes[0])) |
|
313 | 314 | print "user:", changes[1] |
|
314 | 315 | print "date:", time.asctime( |
|
315 | 316 | time.localtime(float(changes[2].split(' ')[0]))) |
|
316 | 317 | if ui.verbose: print "files:", " ".join(changes[3]) |
|
317 | 318 | print "description:" |
|
318 | 319 | print changes[4] |
|
319 | 320 | |
|
320 | 321 | elif cmd == "tip": |
|
321 | 322 | n = repo.changelog.tip() |
|
322 | 323 | t = repo.changelog.rev(n) |
|
323 | 324 | ui.status("%d:%s\n" % (t, hg.hex(n))) |
|
324 | 325 | |
|
325 | 326 | elif cmd == "log": |
|
326 | 327 | |
|
327 | 328 | if len(args) == 1: |
|
328 | 329 | if relpath: |
|
329 | 330 | args[0] = os.path.join(relpath, args[0]) |
|
330 | 331 | |
|
331 | 332 | r = repo.file(args[0]) |
|
332 | 333 | for i in range(r.count()): |
|
333 | 334 | n = r.node(i) |
|
334 | 335 | (p1, p2) = r.parents(n) |
|
335 | 336 | (h, h1, h2) = map(hg.hex, (n, p1, p2)) |
|
336 | 337 | (i1, i2) = map(r.rev, (p1, p2)) |
|
337 | 338 | cr = r.linkrev(n) |
|
338 | 339 | cn = hg.hex(repo.changelog.node(cr)) |
|
339 | 340 | print "rev: %4d:%s" % (i, h) |
|
340 | 341 | print "changeset: %4d:%s" % (cr, cn) |
|
341 | 342 | print "parents: %4d:%s" % (i1, h1) |
|
342 | 343 | if i2: print " %4d:%s" % (i2, h2) |
|
343 | 344 | changes = repo.changelog.read(repo.changelog.node(cr)) |
|
344 | 345 | print "user: %s" % changes[1] |
|
345 | 346 | print "date: %s" % time.asctime( |
|
346 | 347 | time.localtime(float(changes[2].split(' ')[0]))) |
|
347 | 348 | print "description:" |
|
348 | 349 | print changes[4] |
|
349 | 350 | |
|
350 | 351 | elif len(args) > 1: |
|
351 | 352 | print "too many args" |
|
352 | 353 | else: |
|
353 | 354 | print "missing filename" |
|
354 | 355 | |
|
355 | 356 | elif cmd == "dump": |
|
356 | 357 | if args: |
|
357 | 358 | r = repo.file(args[0]) |
|
358 | 359 | n = r.tip() |
|
359 | 360 | if len(args) > 1: n = r.lookup(args[1]) |
|
360 | 361 | sys.stdout.write(r.read(n)) |
|
361 | 362 | else: |
|
362 | 363 | print "missing filename" |
|
363 | 364 | |
|
364 | 365 | elif cmd == "dumpmanifest": |
|
365 | 366 | n = repo.manifest.tip() |
|
366 | 367 | if len(args) > 0: |
|
367 | 368 | n = repo.manifest.lookup(args[0]) |
|
368 | 369 | m = repo.manifest.read(n) |
|
369 | 370 | files = m.keys() |
|
370 | 371 | files.sort() |
|
371 | 372 | |
|
372 | 373 | for f in files: |
|
373 | 374 | print hg.hex(m[f]), f |
|
374 | 375 | |
|
375 | 376 | elif cmd == "debugindex": |
|
376 | 377 | if ".hg" not in args[0]: |
|
377 | 378 | args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" |
|
378 | 379 | |
|
379 | 380 | r = hg.revlog(open, args[0], "") |
|
380 | 381 | print " rev offset length base linkrev"+\ |
|
381 | 382 | " p1 p2 nodeid" |
|
382 | 383 | for i in range(r.count()): |
|
383 | 384 | e = r.index[i] |
|
384 | 385 | print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % ( |
|
385 | 386 | i, e[0], e[1], e[2], e[3], |
|
386 | 387 | hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) |
|
387 | 388 | |
|
388 | 389 | elif cmd == "debugindexdot": |
|
389 | 390 | if ".hg" not in args[0]: |
|
390 | 391 | args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i" |
|
391 | 392 | |
|
392 | 393 | r = hg.revlog(open, args[0], "") |
|
393 | 394 | print "digraph G {" |
|
394 | 395 | for i in range(r.count()): |
|
395 | 396 | e = r.index[i] |
|
396 | 397 | print "\t%d -> %d" % (r.rev(e[4]), i) |
|
397 | 398 | if e[5] != hg.nullid: |
|
398 | 399 | print "\t%d -> %d" % (r.rev(e[5]), i) |
|
399 | 400 | print "}" |
|
400 | 401 | |
|
401 | 402 | elif cmd == "merge": |
|
402 | 403 | (c, a, d) = repo.diffdir(repo.root, repo.current) |
|
403 | 404 | if c: |
|
404 | 405 | ui.warn("aborting (outstanding changes in working directory)\n") |
|
405 | 406 | sys.exit(1) |
|
406 | 407 | |
|
407 | 408 | if args: |
|
408 | 409 | paths = {} |
|
409 | 410 | try: |
|
410 | 411 | pf = os.path.join(os.environ["HOME"], ".hgpaths") |
|
411 | 412 | for l in file(pf): |
|
412 | 413 | name, path = l.split() |
|
413 | 414 | paths[name] = path |
|
414 | 415 | except: |
|
415 | 416 | pass |
|
416 | 417 | |
|
417 | 418 | if args[0] in paths: args[0] = paths[args[0]] |
|
418 | 419 | |
|
419 | 420 | other = hg.repository(ui, args[0]) |
|
420 | 421 | cg = repo.getchangegroup(other) |
|
421 | 422 | repo.addchangegroup(cg) |
|
422 | 423 | else: |
|
423 | 424 | print "missing source repository" |
|
424 | 425 | |
|
425 | 426 | elif cmd == "tags": |
|
426 | 427 | repo.lookup(0) # prime the cache |
|
427 | 428 | i = repo.tags.items() |
|
428 | 429 | i.sort() |
|
429 | 430 | for k, n in i: |
|
430 | 431 | try: |
|
431 | 432 | r = repo.changelog.rev(n) |
|
432 | 433 | except KeyError: |
|
433 | 434 | r = "?" |
|
434 | 435 | print "%-30s %5d:%s" % (k, repo.changelog.rev(n), hg.hex(n)) |
|
435 | 436 | |
|
436 | 437 | elif cmd == "recover": |
|
437 | 438 | repo.recover() |
|
438 | 439 | |
|
439 | 440 | elif cmd == "undo": |
|
440 | 441 | repo.recover("undo") |
|
441 | 442 | |
|
442 | 443 | elif cmd == "verify": |
|
443 | 444 | filelinkrevs = {} |
|
444 | 445 | filenodes = {} |
|
445 | 446 | manifestchangeset = {} |
|
446 | 447 | changesets = revisions = files = 0 |
|
447 | 448 | errors = 0 |
|
448 | 449 | |
|
449 | 450 | ui.status("checking changesets\n") |
|
450 | 451 | for i in range(repo.changelog.count()): |
|
451 | 452 | changesets += 1 |
|
452 | 453 | n = repo.changelog.node(i) |
|
453 | 454 | for p in repo.changelog.parents(n): |
|
454 | 455 | if p not in repo.changelog.nodemap: |
|
455 | 456 | ui.warn("changeset %s has unknown parent %s\n" % |
|
456 | 457 | (hg.short(n), hg.short(p))) |
|
457 | 458 | errors += 1 |
|
458 | 459 | try: |
|
459 | 460 | changes = repo.changelog.read(n) |
|
460 | 461 | except Exception, inst: |
|
461 | 462 | ui.warn("unpacking changeset %s: %s\n" % (short(n), inst)) |
|
462 | 463 | errors += 1 |
|
463 | 464 | |
|
464 | 465 | manifestchangeset[changes[0]] = n |
|
465 | 466 | for f in changes[3]: |
|
466 | 467 | revisions += 1 |
|
467 | 468 | filelinkrevs.setdefault(f, []).append(i) |
|
468 | 469 | |
|
469 | 470 | ui.status("checking manifests\n") |
|
470 | 471 | for i in range(repo.manifest.count()): |
|
471 | 472 | n = repo.manifest.node(i) |
|
472 | 473 | for p in repo.manifest.parents(n): |
|
473 | 474 | if p not in repo.manifest.nodemap: |
|
474 | 475 | ui.warn("manifest %s has unknown parent %s\n" % |
|
475 | 476 | (hg.short(n), hg.short(p))) |
|
476 | 477 | errors += 1 |
|
477 | 478 | ca = repo.changelog.node(repo.manifest.linkrev(n)) |
|
478 | 479 | cc = manifestchangeset[n] |
|
479 | 480 | if ca != cc: |
|
480 | 481 | ui.warn("manifest %s points to %s, not %s\n" % |
|
481 | 482 | (hg.hex(n), hg.hex(ca), hg.hex(cc))) |
|
482 | 483 | errors += 1 |
|
483 | 484 | |
|
484 | 485 | try: |
|
485 | 486 | delta = mdiff.patchtext(repo.manifest.delta(n)) |
|
486 | 487 | except KeyboardInterrupt: |
|
487 | 488 | print "aborted" |
|
488 | 489 | sys.exit(0) |
|
489 | 490 | except Exception, inst: |
|
490 | 491 | ui.warn("unpacking manifest %s: %s\n" % (hg.short(n), inst)) |
|
491 | 492 | errors += 1 |
|
492 | 493 | |
|
493 | 494 | ff = [ l.split('\0') for l in delta.splitlines() ] |
|
494 | 495 | for f, fn in ff: |
|
495 | 496 | filenodes.setdefault(f, {})[hg.bin(fn)] = 1 |
|
496 | 497 | |
|
497 | 498 | ui.status("crosschecking files in changesets and manifests\n") |
|
498 | 499 | for f in filenodes: |
|
499 | 500 | if f not in filelinkrevs: |
|
500 | 501 | ui.warn("file %s in manifest but not in changesets\n" % f) |
|
501 | 502 | errors += 1 |
|
502 | 503 | |
|
503 | 504 | for f in filelinkrevs: |
|
504 | 505 | if f not in filenodes: |
|
505 | 506 | ui.warn("file %s in changeset but not in manifest\n" % f) |
|
506 | 507 | errors += 1 |
|
507 | 508 | |
|
508 | 509 | ui.status("checking files\n") |
|
509 | 510 | ff = filenodes.keys() |
|
510 | 511 | ff.sort() |
|
511 | 512 | for f in ff: |
|
512 | 513 | if f == "/dev/null": continue |
|
513 | 514 | files += 1 |
|
514 | 515 | fl = repo.file(f) |
|
515 | 516 | nodes = { hg.nullid: 1 } |
|
516 | 517 | for i in range(fl.count()): |
|
517 | 518 | n = fl.node(i) |
|
518 | 519 | |
|
519 | 520 | if n not in filenodes[f]: |
|
520 | 521 | ui.warn("%s: %d:%s not in manifests\n" % (f, i, hg.short(n))) |
|
521 | 522 | print len(filenodes[f].keys()), fl.count(), f |
|
522 | 523 | errors += 1 |
|
523 | 524 | else: |
|
524 | 525 | del filenodes[f][n] |
|
525 | 526 | |
|
526 | 527 | flr = fl.linkrev(n) |
|
527 | 528 | if flr not in filelinkrevs[f]: |
|
528 | 529 | ui.warn("%s:%s points to unexpected changeset rev %d\n" |
|
529 | 530 | % (f, hg.short(n), fl.linkrev(n))) |
|
530 | 531 | errors += 1 |
|
531 | 532 | else: |
|
532 | 533 | filelinkrevs[f].remove(flr) |
|
533 | 534 | |
|
534 | 535 | # verify contents |
|
535 | 536 | try: |
|
536 | 537 | t = fl.read(n) |
|
537 | 538 | except Exception, inst: |
|
538 | 539 | ui.warn("unpacking file %s %s: %s\n" % (f, hg.short(n), inst)) |
|
539 | 540 | errors += 1 |
|
540 | 541 | |
|
541 | 542 | # verify parents |
|
542 | 543 | (p1, p2) = fl.parents(n) |
|
543 | 544 | if p1 not in nodes: |
|
544 | 545 | ui.warn("file %s:%s unknown parent 1 %s" % |
|
545 | 546 | (f, hg.short(n), hg.short(p1))) |
|
546 | 547 | errors += 1 |
|
547 | 548 | if p2 not in nodes: |
|
548 | 549 | ui.warn("file %s:%s unknown parent 2 %s" % |
|
549 | 550 | (f, hg.short(n), hg.short(p1))) |
|
550 | 551 | errors += 1 |
|
551 | 552 | nodes[n] = 1 |
|
552 | 553 | |
|
553 | 554 | # cross-check |
|
554 | 555 | for flr in filelinkrevs[f]: |
|
555 | 556 | ui.warn("changeset rev %d not in %s\n" % (flr, f)) |
|
556 | 557 | errors += 1 |
|
557 | 558 | |
|
558 | 559 | for node in filenodes[f]: |
|
559 | 560 | ui.warn("node %s in manifests not in %s\n" % (hg.hex(n), f)) |
|
560 | 561 | errors += 1 |
|
561 | 562 | |
|
562 | 563 | ui.status("%d files, %d changesets, %d total revisions\n" % |
|
563 | 564 | (files, changesets, revisions)) |
|
564 | 565 | |
|
565 | 566 | if errors: |
|
566 | 567 | ui.warn("%d integrity errors encountered!\n" % errors) |
|
567 | 568 | sys.exit(1) |
|
568 | 569 | |
|
569 | 570 | elif cmd == "serve": |
|
570 | 571 | from mercurial import hgweb |
|
571 | 572 | |
|
572 | 573 | soptions = {} |
|
573 | 574 | opts = [('p', 'port', 8000, 'listen port'), |
|
574 | 575 | ('a', 'address', '', 'interface address'), |
|
575 | 576 | ('n', 'name', os.getcwd(), 'repository name'), |
|
576 | 577 | ('t', 'templates', "", 'template map') |
|
577 | 578 | ] |
|
578 | 579 | |
|
579 | 580 | args = fancyopts.fancyopts(args, opts, soptions, |
|
580 | 581 | 'hg serve [options]') |
|
581 | 582 | |
|
582 | 583 | hgweb.server(repo.root, soptions["name"], soptions["templates"], |
|
583 | 584 | soptions["address"], soptions["port"]) |
|
584 | 585 | |
|
585 | 586 | else: |
|
586 | 587 | if cmd: ui.warn("unknown command\n\n") |
|
587 | 588 | help() |
|
588 | 589 | sys.exit(1) |
General Comments 0
You need to be logged in to leave comments.
Login now