Show More
@@ -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 |
@@ -3136,6 +3136,7 b' globalopts = [' | |||||
3136 | _('do not prompt, assume \'yes\' for any required answers')), |
|
3136 | _('do not prompt, assume \'yes\' for any required answers')), | |
3137 | ('q', 'quiet', None, _('suppress output')), |
|
3137 | ('q', 'quiet', None, _('suppress output')), | |
3138 | ('v', 'verbose', None, _('enable additional output')), |
|
3138 | ('v', 'verbose', None, _('enable additional output')), | |
|
3139 | ('', 'config', [], _('set/override config option')), | |||
3139 | ('', 'debug', None, _('enable debugging output')), |
|
3140 | ('', 'debug', None, _('enable debugging output')), | |
3140 | ('', 'debugger', None, _('start debugger')), |
|
3141 | ('', 'debugger', None, _('start debugger')), | |
3141 | ('', 'traceback', None, _('print traceback on exception')), |
|
3142 | ('', 'traceback', None, _('print traceback on exception')), | |
@@ -3300,7 +3301,8 b' def dispatch(args):' | |||||
3300 | atexit.register(print_time) |
|
3301 | atexit.register(print_time) | |
3301 |
|
3302 | |||
3302 | u.updateopts(options["verbose"], options["debug"], options["quiet"], |
|
3303 | u.updateopts(options["verbose"], options["debug"], options["quiet"], | |
3303 |
not options["noninteractive"], options["traceback"] |
|
3304 | not options["noninteractive"], options["traceback"], | |
|
3305 | options["config"]) | |||
3304 |
|
3306 | |||
3305 | # enter the debugger before command execution |
|
3307 | # enter the debugger before command execution | |
3306 | if options['debugger']: |
|
3308 | if options['debugger']: |
@@ -47,12 +47,23 b' class ui(object):' | |||||
47 | return getattr(self.parentui, key) |
|
47 | return getattr(self.parentui, key) | |
48 |
|
48 | |||
49 | def updateopts(self, verbose=False, debug=False, quiet=False, |
|
49 | def updateopts(self, verbose=False, debug=False, quiet=False, | |
50 | interactive=True, traceback=False): |
|
50 | interactive=True, traceback=False, config=[]): | |
51 | 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 | |
52 | self.verbose = (self.verbose or verbose) or debug |
|
52 | self.verbose = (self.verbose or verbose) or debug | |
53 | self.debugflag = (self.debugflag or debug) |
|
53 | self.debugflag = (self.debugflag or debug) | |
54 | self.interactive = (self.interactive and interactive) |
|
54 | self.interactive = (self.interactive and interactive) | |
55 | 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) | |||
56 |
|
67 | |||
57 | def readconfig(self, fn, root=None): |
|
68 | def readconfig(self, fn, root=None): | |
58 | if isinstance(fn, basestring): |
|
69 | if isinstance(fn, basestring): |
General Comments 0
You need to be logged in to leave comments.
Login now