##// END OF EJS Templates
pathutil: hint if a path is root relative instead of cwd relative (issue4663)...
Matt Harbison -
r25011:7d6a507a default
parent child Browse files
Show More
@@ -1,177 +1,187 b''
1 import os, errno, stat
1 import os, errno, stat
2
2
3 import encoding
3 import encoding
4 import util
4 import util
5 from i18n import _
5 from i18n import _
6
6
7 def _lowerclean(s):
7 def _lowerclean(s):
8 return encoding.hfsignoreclean(s.lower())
8 return encoding.hfsignoreclean(s.lower())
9
9
10 class pathauditor(object):
10 class pathauditor(object):
11 '''ensure that a filesystem path contains no banned components.
11 '''ensure that a filesystem path contains no banned components.
12 the following properties of a path are checked:
12 the following properties of a path are checked:
13
13
14 - ends with a directory separator
14 - ends with a directory separator
15 - under top-level .hg
15 - under top-level .hg
16 - starts at the root of a windows drive
16 - starts at the root of a windows drive
17 - contains ".."
17 - contains ".."
18 - traverses a symlink (e.g. a/symlink_here/b)
18 - traverses a symlink (e.g. a/symlink_here/b)
19 - inside a nested repository (a callback can be used to approve
19 - inside a nested repository (a callback can be used to approve
20 some nested repositories, e.g., subrepositories)
20 some nested repositories, e.g., subrepositories)
21 '''
21 '''
22
22
23 def __init__(self, root, callback=None):
23 def __init__(self, root, callback=None):
24 self.audited = set()
24 self.audited = set()
25 self.auditeddir = set()
25 self.auditeddir = set()
26 self.root = root
26 self.root = root
27 self.callback = callback
27 self.callback = callback
28 if os.path.lexists(root) and not util.checkcase(root):
28 if os.path.lexists(root) and not util.checkcase(root):
29 self.normcase = util.normcase
29 self.normcase = util.normcase
30 else:
30 else:
31 self.normcase = lambda x: x
31 self.normcase = lambda x: x
32
32
33 def __call__(self, path):
33 def __call__(self, path):
34 '''Check the relative path.
34 '''Check the relative path.
35 path may contain a pattern (e.g. foodir/**.txt)'''
35 path may contain a pattern (e.g. foodir/**.txt)'''
36
36
37 path = util.localpath(path)
37 path = util.localpath(path)
38 normpath = self.normcase(path)
38 normpath = self.normcase(path)
39 if normpath in self.audited:
39 if normpath in self.audited:
40 return
40 return
41 # AIX ignores "/" at end of path, others raise EISDIR.
41 # AIX ignores "/" at end of path, others raise EISDIR.
42 if util.endswithsep(path):
42 if util.endswithsep(path):
43 raise util.Abort(_("path ends in directory separator: %s") % path)
43 raise util.Abort(_("path ends in directory separator: %s") % path)
44 parts = util.splitpath(path)
44 parts = util.splitpath(path)
45 if (os.path.splitdrive(path)[0]
45 if (os.path.splitdrive(path)[0]
46 or _lowerclean(parts[0]) in ('.hg', '.hg.', '')
46 or _lowerclean(parts[0]) in ('.hg', '.hg.', '')
47 or os.pardir in parts):
47 or os.pardir in parts):
48 raise util.Abort(_("path contains illegal component: %s") % path)
48 raise util.Abort(_("path contains illegal component: %s") % path)
49 # Windows shortname aliases
49 # Windows shortname aliases
50 for p in parts:
50 for p in parts:
51 if "~" in p:
51 if "~" in p:
52 first, last = p.split("~", 1)
52 first, last = p.split("~", 1)
53 if last.isdigit() and first.upper() in ["HG", "HG8B6C"]:
53 if last.isdigit() and first.upper() in ["HG", "HG8B6C"]:
54 raise util.Abort(_("path contains illegal component: %s")
54 raise util.Abort(_("path contains illegal component: %s")
55 % path)
55 % path)
56 if '.hg' in _lowerclean(path):
56 if '.hg' in _lowerclean(path):
57 lparts = [_lowerclean(p.lower()) for p in parts]
57 lparts = [_lowerclean(p.lower()) for p in parts]
58 for p in '.hg', '.hg.':
58 for p in '.hg', '.hg.':
59 if p in lparts[1:]:
59 if p in lparts[1:]:
60 pos = lparts.index(p)
60 pos = lparts.index(p)
61 base = os.path.join(*parts[:pos])
61 base = os.path.join(*parts[:pos])
62 raise util.Abort(_("path '%s' is inside nested repo %r")
62 raise util.Abort(_("path '%s' is inside nested repo %r")
63 % (path, base))
63 % (path, base))
64
64
65 normparts = util.splitpath(normpath)
65 normparts = util.splitpath(normpath)
66 assert len(parts) == len(normparts)
66 assert len(parts) == len(normparts)
67
67
68 parts.pop()
68 parts.pop()
69 normparts.pop()
69 normparts.pop()
70 prefixes = []
70 prefixes = []
71 while parts:
71 while parts:
72 prefix = os.sep.join(parts)
72 prefix = os.sep.join(parts)
73 normprefix = os.sep.join(normparts)
73 normprefix = os.sep.join(normparts)
74 if normprefix in self.auditeddir:
74 if normprefix in self.auditeddir:
75 break
75 break
76 curpath = os.path.join(self.root, prefix)
76 curpath = os.path.join(self.root, prefix)
77 try:
77 try:
78 st = os.lstat(curpath)
78 st = os.lstat(curpath)
79 except OSError, err:
79 except OSError, err:
80 # EINVAL can be raised as invalid path syntax under win32.
80 # EINVAL can be raised as invalid path syntax under win32.
81 # They must be ignored for patterns can be checked too.
81 # They must be ignored for patterns can be checked too.
82 if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
82 if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
83 raise
83 raise
84 else:
84 else:
85 if stat.S_ISLNK(st.st_mode):
85 if stat.S_ISLNK(st.st_mode):
86 raise util.Abort(
86 raise util.Abort(
87 _('path %r traverses symbolic link %r')
87 _('path %r traverses symbolic link %r')
88 % (path, prefix))
88 % (path, prefix))
89 elif (stat.S_ISDIR(st.st_mode) and
89 elif (stat.S_ISDIR(st.st_mode) and
90 os.path.isdir(os.path.join(curpath, '.hg'))):
90 os.path.isdir(os.path.join(curpath, '.hg'))):
91 if not self.callback or not self.callback(curpath):
91 if not self.callback or not self.callback(curpath):
92 raise util.Abort(_("path '%s' is inside nested "
92 raise util.Abort(_("path '%s' is inside nested "
93 "repo %r")
93 "repo %r")
94 % (path, prefix))
94 % (path, prefix))
95 prefixes.append(normprefix)
95 prefixes.append(normprefix)
96 parts.pop()
96 parts.pop()
97 normparts.pop()
97 normparts.pop()
98
98
99 self.audited.add(normpath)
99 self.audited.add(normpath)
100 # only add prefixes to the cache after checking everything: we don't
100 # only add prefixes to the cache after checking everything: we don't
101 # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
101 # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
102 self.auditeddir.update(prefixes)
102 self.auditeddir.update(prefixes)
103
103
104 def check(self, path):
104 def check(self, path):
105 try:
105 try:
106 self(path)
106 self(path)
107 return True
107 return True
108 except (OSError, util.Abort):
108 except (OSError, util.Abort):
109 return False
109 return False
110
110
111 def canonpath(root, cwd, myname, auditor=None):
111 def canonpath(root, cwd, myname, auditor=None):
112 '''return the canonical path of myname, given cwd and root'''
112 '''return the canonical path of myname, given cwd and root'''
113 if util.endswithsep(root):
113 if util.endswithsep(root):
114 rootsep = root
114 rootsep = root
115 else:
115 else:
116 rootsep = root + os.sep
116 rootsep = root + os.sep
117 name = myname
117 name = myname
118 if not os.path.isabs(name):
118 if not os.path.isabs(name):
119 name = os.path.join(root, cwd, name)
119 name = os.path.join(root, cwd, name)
120 name = os.path.normpath(name)
120 name = os.path.normpath(name)
121 if auditor is None:
121 if auditor is None:
122 auditor = pathauditor(root)
122 auditor = pathauditor(root)
123 if name != rootsep and name.startswith(rootsep):
123 if name != rootsep and name.startswith(rootsep):
124 name = name[len(rootsep):]
124 name = name[len(rootsep):]
125 auditor(name)
125 auditor(name)
126 return util.pconvert(name)
126 return util.pconvert(name)
127 elif name == root:
127 elif name == root:
128 return ''
128 return ''
129 else:
129 else:
130 # Determine whether `name' is in the hierarchy at or beneath `root',
130 # Determine whether `name' is in the hierarchy at or beneath `root',
131 # by iterating name=dirname(name) until that causes no change (can't
131 # by iterating name=dirname(name) until that causes no change (can't
132 # check name == '/', because that doesn't work on windows). The list
132 # check name == '/', because that doesn't work on windows). The list
133 # `rel' holds the reversed list of components making up the relative
133 # `rel' holds the reversed list of components making up the relative
134 # file name we want.
134 # file name we want.
135 rel = []
135 rel = []
136 while True:
136 while True:
137 try:
137 try:
138 s = util.samefile(name, root)
138 s = util.samefile(name, root)
139 except OSError:
139 except OSError:
140 s = False
140 s = False
141 if s:
141 if s:
142 if not rel:
142 if not rel:
143 # name was actually the same as root (maybe a symlink)
143 # name was actually the same as root (maybe a symlink)
144 return ''
144 return ''
145 rel.reverse()
145 rel.reverse()
146 name = os.path.join(*rel)
146 name = os.path.join(*rel)
147 auditor(name)
147 auditor(name)
148 return util.pconvert(name)
148 return util.pconvert(name)
149 dirname, basename = util.split(name)
149 dirname, basename = util.split(name)
150 rel.append(basename)
150 rel.append(basename)
151 if dirname == name:
151 if dirname == name:
152 break
152 break
153 name = dirname
153 name = dirname
154
154
155 raise util.Abort(_("%s not under root '%s'") % (myname, root))
155 # A common mistake is to use -R, but specify a file relative to the repo
156 # instead of cwd. Detect that case, and provide a hint to the user.
157 hint = None
158 try:
159 canonpath(root, root, myname, auditor)
160 hint = _("consider using '--cwd %s'") % os.path.relpath(root, cwd)
161 except util.Abort:
162 pass
163
164 raise util.Abort(_("%s not under root '%s'") % (myname, root),
165 hint=hint)
156
166
157 def normasprefix(path):
167 def normasprefix(path):
158 '''normalize the specified path as path prefix
168 '''normalize the specified path as path prefix
159
169
160 Returned value can be used safely for "p.startswith(prefix)",
170 Returned value can be used safely for "p.startswith(prefix)",
161 "p[len(prefix):]", and so on.
171 "p[len(prefix):]", and so on.
162
172
163 For efficiency, this expects "path" argument to be already
173 For efficiency, this expects "path" argument to be already
164 normalized by "os.path.normpath", "os.path.realpath", and so on.
174 normalized by "os.path.normpath", "os.path.realpath", and so on.
165
175
166 See also issue3033 for detail about need of this function.
176 See also issue3033 for detail about need of this function.
167
177
168 >>> normasprefix('/foo/bar').replace(os.sep, '/')
178 >>> normasprefix('/foo/bar').replace(os.sep, '/')
169 '/foo/bar/'
179 '/foo/bar/'
170 >>> normasprefix('/').replace(os.sep, '/')
180 >>> normasprefix('/').replace(os.sep, '/')
171 '/'
181 '/'
172 '''
182 '''
173 d, p = os.path.splitdrive(path)
183 d, p = os.path.splitdrive(path)
174 if len(p) != len(os.sep):
184 if len(p) != len(os.sep):
175 return path + os.sep
185 return path + os.sep
176 else:
186 else:
177 return path
187 return path
@@ -1,445 +1,446 b''
1 $ hg init a
1 $ hg init a
2 $ cd a
2 $ cd a
3 $ echo a > a
3 $ echo a > a
4 $ hg ci -A -d'1 0' -m a
4 $ hg ci -A -d'1 0' -m a
5 adding a
5 adding a
6
6
7 $ cd ..
7 $ cd ..
8
8
9 $ hg init b
9 $ hg init b
10 $ cd b
10 $ cd b
11 $ echo b > b
11 $ echo b > b
12 $ hg ci -A -d'1 0' -m b
12 $ hg ci -A -d'1 0' -m b
13 adding b
13 adding b
14
14
15 $ cd ..
15 $ cd ..
16
16
17 $ hg clone a c
17 $ hg clone a c
18 updating to branch default
18 updating to branch default
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ cd c
20 $ cd c
21 $ cat >> .hg/hgrc <<EOF
21 $ cat >> .hg/hgrc <<EOF
22 > [paths]
22 > [paths]
23 > relative = ../a
23 > relative = ../a
24 > EOF
24 > EOF
25 $ hg pull -f ../b
25 $ hg pull -f ../b
26 pulling from ../b
26 pulling from ../b
27 searching for changes
27 searching for changes
28 warning: repository is unrelated
28 warning: repository is unrelated
29 requesting all changes
29 requesting all changes
30 adding changesets
30 adding changesets
31 adding manifests
31 adding manifests
32 adding file changes
32 adding file changes
33 added 1 changesets with 1 changes to 1 files (+1 heads)
33 added 1 changesets with 1 changes to 1 files (+1 heads)
34 (run 'hg heads' to see heads, 'hg merge' to merge)
34 (run 'hg heads' to see heads, 'hg merge' to merge)
35 $ hg merge
35 $ hg merge
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 (branch merge, don't forget to commit)
37 (branch merge, don't forget to commit)
38
38
39 $ cd ..
39 $ cd ..
40
40
41 Testing -R/--repository:
41 Testing -R/--repository:
42
42
43 $ hg -R a tip
43 $ hg -R a tip
44 changeset: 0:8580ff50825a
44 changeset: 0:8580ff50825a
45 tag: tip
45 tag: tip
46 user: test
46 user: test
47 date: Thu Jan 01 00:00:01 1970 +0000
47 date: Thu Jan 01 00:00:01 1970 +0000
48 summary: a
48 summary: a
49
49
50 $ hg --repository b tip
50 $ hg --repository b tip
51 changeset: 0:b6c483daf290
51 changeset: 0:b6c483daf290
52 tag: tip
52 tag: tip
53 user: test
53 user: test
54 date: Thu Jan 01 00:00:01 1970 +0000
54 date: Thu Jan 01 00:00:01 1970 +0000
55 summary: b
55 summary: b
56
56
57
57
58 -R with a URL:
58 -R with a URL:
59
59
60 $ hg -R file:a identify
60 $ hg -R file:a identify
61 8580ff50825a tip
61 8580ff50825a tip
62 $ hg -R file://localhost/`pwd`/a/ identify
62 $ hg -R file://localhost/`pwd`/a/ identify
63 8580ff50825a tip
63 8580ff50825a tip
64
64
65 -R with path aliases:
65 -R with path aliases:
66
66
67 $ cd c
67 $ cd c
68 $ hg -R default identify
68 $ hg -R default identify
69 8580ff50825a tip
69 8580ff50825a tip
70 $ hg -R relative identify
70 $ hg -R relative identify
71 8580ff50825a tip
71 8580ff50825a tip
72 $ echo '[paths]' >> $HGRCPATH
72 $ echo '[paths]' >> $HGRCPATH
73 $ echo 'relativetohome = a' >> $HGRCPATH
73 $ echo 'relativetohome = a' >> $HGRCPATH
74 $ HOME=`pwd`/../ hg -R relativetohome identify
74 $ HOME=`pwd`/../ hg -R relativetohome identify
75 8580ff50825a tip
75 8580ff50825a tip
76 $ cd ..
76 $ cd ..
77
77
78 #if no-outer-repo
78 #if no-outer-repo
79
79
80 Implicit -R:
80 Implicit -R:
81
81
82 $ hg ann a/a
82 $ hg ann a/a
83 0: a
83 0: a
84 $ hg ann a/a a/a
84 $ hg ann a/a a/a
85 0: a
85 0: a
86 $ hg ann a/a b/b
86 $ hg ann a/a b/b
87 abort: no repository found in '$TESTTMP' (.hg not found)!
87 abort: no repository found in '$TESTTMP' (.hg not found)!
88 [255]
88 [255]
89 $ hg -R b ann a/a
89 $ hg -R b ann a/a
90 abort: a/a not under root '$TESTTMP/b' (glob)
90 abort: a/a not under root '$TESTTMP/b' (glob)
91 (consider using '--cwd b')
91 [255]
92 [255]
92 $ hg log
93 $ hg log
93 abort: no repository found in '$TESTTMP' (.hg not found)!
94 abort: no repository found in '$TESTTMP' (.hg not found)!
94 [255]
95 [255]
95
96
96 #endif
97 #endif
97
98
98 Abbreviation of long option:
99 Abbreviation of long option:
99
100
100 $ hg --repo c tip
101 $ hg --repo c tip
101 changeset: 1:b6c483daf290
102 changeset: 1:b6c483daf290
102 tag: tip
103 tag: tip
103 parent: -1:000000000000
104 parent: -1:000000000000
104 user: test
105 user: test
105 date: Thu Jan 01 00:00:01 1970 +0000
106 date: Thu Jan 01 00:00:01 1970 +0000
106 summary: b
107 summary: b
107
108
108
109
109 earlygetopt with duplicate options (36d23de02da1):
110 earlygetopt with duplicate options (36d23de02da1):
110
111
111 $ hg --cwd a --cwd b --cwd c tip
112 $ hg --cwd a --cwd b --cwd c tip
112 changeset: 1:b6c483daf290
113 changeset: 1:b6c483daf290
113 tag: tip
114 tag: tip
114 parent: -1:000000000000
115 parent: -1:000000000000
115 user: test
116 user: test
116 date: Thu Jan 01 00:00:01 1970 +0000
117 date: Thu Jan 01 00:00:01 1970 +0000
117 summary: b
118 summary: b
118
119
119 $ hg --repo c --repository b -R a tip
120 $ hg --repo c --repository b -R a tip
120 changeset: 0:8580ff50825a
121 changeset: 0:8580ff50825a
121 tag: tip
122 tag: tip
122 user: test
123 user: test
123 date: Thu Jan 01 00:00:01 1970 +0000
124 date: Thu Jan 01 00:00:01 1970 +0000
124 summary: a
125 summary: a
125
126
126
127
127 earlygetopt short option without following space:
128 earlygetopt short option without following space:
128
129
129 $ hg -q -Rb tip
130 $ hg -q -Rb tip
130 0:b6c483daf290
131 0:b6c483daf290
131
132
132 earlygetopt with illegal abbreviations:
133 earlygetopt with illegal abbreviations:
133
134
134 $ hg --confi "foo.bar=baz"
135 $ hg --confi "foo.bar=baz"
135 abort: option --config may not be abbreviated!
136 abort: option --config may not be abbreviated!
136 [255]
137 [255]
137 $ hg --cw a tip
138 $ hg --cw a tip
138 abort: option --cwd may not be abbreviated!
139 abort: option --cwd may not be abbreviated!
139 [255]
140 [255]
140 $ hg --rep a tip
141 $ hg --rep a tip
141 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
142 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
142 [255]
143 [255]
143 $ hg --repositor a tip
144 $ hg --repositor a tip
144 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
145 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
145 [255]
146 [255]
146 $ hg -qR a tip
147 $ hg -qR a tip
147 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
148 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
148 [255]
149 [255]
149 $ hg -qRa tip
150 $ hg -qRa tip
150 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
151 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!
151 [255]
152 [255]
152
153
153 Testing --cwd:
154 Testing --cwd:
154
155
155 $ hg --cwd a parents
156 $ hg --cwd a parents
156 changeset: 0:8580ff50825a
157 changeset: 0:8580ff50825a
157 tag: tip
158 tag: tip
158 user: test
159 user: test
159 date: Thu Jan 01 00:00:01 1970 +0000
160 date: Thu Jan 01 00:00:01 1970 +0000
160 summary: a
161 summary: a
161
162
162
163
163 Testing -y/--noninteractive - just be sure it is parsed:
164 Testing -y/--noninteractive - just be sure it is parsed:
164
165
165 $ hg --cwd a tip -q --noninteractive
166 $ hg --cwd a tip -q --noninteractive
166 0:8580ff50825a
167 0:8580ff50825a
167 $ hg --cwd a tip -q -y
168 $ hg --cwd a tip -q -y
168 0:8580ff50825a
169 0:8580ff50825a
169
170
170 Testing -q/--quiet:
171 Testing -q/--quiet:
171
172
172 $ hg -R a -q tip
173 $ hg -R a -q tip
173 0:8580ff50825a
174 0:8580ff50825a
174 $ hg -R b -q tip
175 $ hg -R b -q tip
175 0:b6c483daf290
176 0:b6c483daf290
176 $ hg -R c --quiet parents
177 $ hg -R c --quiet parents
177 0:8580ff50825a
178 0:8580ff50825a
178 1:b6c483daf290
179 1:b6c483daf290
179
180
180 Testing -v/--verbose:
181 Testing -v/--verbose:
181
182
182 $ hg --cwd c head -v
183 $ hg --cwd c head -v
183 changeset: 1:b6c483daf290
184 changeset: 1:b6c483daf290
184 tag: tip
185 tag: tip
185 parent: -1:000000000000
186 parent: -1:000000000000
186 user: test
187 user: test
187 date: Thu Jan 01 00:00:01 1970 +0000
188 date: Thu Jan 01 00:00:01 1970 +0000
188 files: b
189 files: b
189 description:
190 description:
190 b
191 b
191
192
192
193
193 changeset: 0:8580ff50825a
194 changeset: 0:8580ff50825a
194 user: test
195 user: test
195 date: Thu Jan 01 00:00:01 1970 +0000
196 date: Thu Jan 01 00:00:01 1970 +0000
196 files: a
197 files: a
197 description:
198 description:
198 a
199 a
199
200
200
201
201 $ hg --cwd b tip --verbose
202 $ hg --cwd b tip --verbose
202 changeset: 0:b6c483daf290
203 changeset: 0:b6c483daf290
203 tag: tip
204 tag: tip
204 user: test
205 user: test
205 date: Thu Jan 01 00:00:01 1970 +0000
206 date: Thu Jan 01 00:00:01 1970 +0000
206 files: b
207 files: b
207 description:
208 description:
208 b
209 b
209
210
210
211
211
212
212 Testing --config:
213 Testing --config:
213
214
214 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
215 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
215 quuxfoo
216 quuxfoo
216 $ hg --cwd c --config '' tip -q
217 $ hg --cwd c --config '' tip -q
217 abort: malformed --config option: '' (use --config section.name=value)
218 abort: malformed --config option: '' (use --config section.name=value)
218 [255]
219 [255]
219 $ hg --cwd c --config a.b tip -q
220 $ hg --cwd c --config a.b tip -q
220 abort: malformed --config option: 'a.b' (use --config section.name=value)
221 abort: malformed --config option: 'a.b' (use --config section.name=value)
221 [255]
222 [255]
222 $ hg --cwd c --config a tip -q
223 $ hg --cwd c --config a tip -q
223 abort: malformed --config option: 'a' (use --config section.name=value)
224 abort: malformed --config option: 'a' (use --config section.name=value)
224 [255]
225 [255]
225 $ hg --cwd c --config a.= tip -q
226 $ hg --cwd c --config a.= tip -q
226 abort: malformed --config option: 'a.=' (use --config section.name=value)
227 abort: malformed --config option: 'a.=' (use --config section.name=value)
227 [255]
228 [255]
228 $ hg --cwd c --config .b= tip -q
229 $ hg --cwd c --config .b= tip -q
229 abort: malformed --config option: '.b=' (use --config section.name=value)
230 abort: malformed --config option: '.b=' (use --config section.name=value)
230 [255]
231 [255]
231
232
232 Testing --debug:
233 Testing --debug:
233
234
234 $ hg --cwd c log --debug
235 $ hg --cwd c log --debug
235 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
236 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
236 tag: tip
237 tag: tip
237 phase: public
238 phase: public
238 parent: -1:0000000000000000000000000000000000000000
239 parent: -1:0000000000000000000000000000000000000000
239 parent: -1:0000000000000000000000000000000000000000
240 parent: -1:0000000000000000000000000000000000000000
240 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
241 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
241 user: test
242 user: test
242 date: Thu Jan 01 00:00:01 1970 +0000
243 date: Thu Jan 01 00:00:01 1970 +0000
243 files+: b
244 files+: b
244 extra: branch=default
245 extra: branch=default
245 description:
246 description:
246 b
247 b
247
248
248
249
249 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
250 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
250 phase: public
251 phase: public
251 parent: -1:0000000000000000000000000000000000000000
252 parent: -1:0000000000000000000000000000000000000000
252 parent: -1:0000000000000000000000000000000000000000
253 parent: -1:0000000000000000000000000000000000000000
253 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
254 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
254 user: test
255 user: test
255 date: Thu Jan 01 00:00:01 1970 +0000
256 date: Thu Jan 01 00:00:01 1970 +0000
256 files+: a
257 files+: a
257 extra: branch=default
258 extra: branch=default
258 description:
259 description:
259 a
260 a
260
261
261
262
262
263
263 Testing --traceback:
264 Testing --traceback:
264
265
265 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
266 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
266 Traceback (most recent call last):
267 Traceback (most recent call last):
267
268
268 Testing --time:
269 Testing --time:
269
270
270 $ hg --cwd a --time id
271 $ hg --cwd a --time id
271 8580ff50825a tip
272 8580ff50825a tip
272 time: real * (glob)
273 time: real * (glob)
273
274
274 Testing --version:
275 Testing --version:
275
276
276 $ hg --version -q
277 $ hg --version -q
277 Mercurial Distributed SCM * (glob)
278 Mercurial Distributed SCM * (glob)
278
279
279 hide outer repo
280 hide outer repo
280 $ hg init
281 $ hg init
281
282
282 Testing -h/--help:
283 Testing -h/--help:
283
284
284 $ hg -h
285 $ hg -h
285 Mercurial Distributed SCM
286 Mercurial Distributed SCM
286
287
287 list of commands:
288 list of commands:
288
289
289 add add the specified files on the next commit
290 add add the specified files on the next commit
290 addremove add all new files, delete all missing files
291 addremove add all new files, delete all missing files
291 annotate show changeset information by line for each file
292 annotate show changeset information by line for each file
292 archive create an unversioned archive of a repository revision
293 archive create an unversioned archive of a repository revision
293 backout reverse effect of earlier changeset
294 backout reverse effect of earlier changeset
294 bisect subdivision search of changesets
295 bisect subdivision search of changesets
295 bookmarks create a new bookmark or list existing bookmarks
296 bookmarks create a new bookmark or list existing bookmarks
296 branch set or show the current branch name
297 branch set or show the current branch name
297 branches list repository named branches
298 branches list repository named branches
298 bundle create a changegroup file
299 bundle create a changegroup file
299 cat output the current or given revision of files
300 cat output the current or given revision of files
300 clone make a copy of an existing repository
301 clone make a copy of an existing repository
301 commit commit the specified files or all outstanding changes
302 commit commit the specified files or all outstanding changes
302 config show combined config settings from all hgrc files
303 config show combined config settings from all hgrc files
303 copy mark files as copied for the next commit
304 copy mark files as copied for the next commit
304 diff diff repository (or selected files)
305 diff diff repository (or selected files)
305 export dump the header and diffs for one or more changesets
306 export dump the header and diffs for one or more changesets
306 files list tracked files
307 files list tracked files
307 forget forget the specified files on the next commit
308 forget forget the specified files on the next commit
308 graft copy changes from other branches onto the current branch
309 graft copy changes from other branches onto the current branch
309 grep search for a pattern in specified files and revisions
310 grep search for a pattern in specified files and revisions
310 heads show branch heads
311 heads show branch heads
311 help show help for a given topic or a help overview
312 help show help for a given topic or a help overview
312 identify identify the working directory or specified revision
313 identify identify the working directory or specified revision
313 import import an ordered set of patches
314 import import an ordered set of patches
314 incoming show new changesets found in source
315 incoming show new changesets found in source
315 init create a new repository in the given directory
316 init create a new repository in the given directory
316 log show revision history of entire repository or files
317 log show revision history of entire repository or files
317 manifest output the current or given revision of the project manifest
318 manifest output the current or given revision of the project manifest
318 merge merge another revision into working directory
319 merge merge another revision into working directory
319 outgoing show changesets not found in the destination
320 outgoing show changesets not found in the destination
320 paths show aliases for remote repositories
321 paths show aliases for remote repositories
321 phase set or show the current phase name
322 phase set or show the current phase name
322 pull pull changes from the specified source
323 pull pull changes from the specified source
323 push push changes to the specified destination
324 push push changes to the specified destination
324 recover roll back an interrupted transaction
325 recover roll back an interrupted transaction
325 remove remove the specified files on the next commit
326 remove remove the specified files on the next commit
326 rename rename files; equivalent of copy + remove
327 rename rename files; equivalent of copy + remove
327 resolve redo merges or set/view the merge status of files
328 resolve redo merges or set/view the merge status of files
328 revert restore files to their checkout state
329 revert restore files to their checkout state
329 root print the root (top) of the current working directory
330 root print the root (top) of the current working directory
330 serve start stand-alone webserver
331 serve start stand-alone webserver
331 status show changed files in the working directory
332 status show changed files in the working directory
332 summary summarize working directory state
333 summary summarize working directory state
333 tag add one or more tags for the current or given revision
334 tag add one or more tags for the current or given revision
334 tags list repository tags
335 tags list repository tags
335 unbundle apply one or more changegroup files
336 unbundle apply one or more changegroup files
336 update update working directory (or switch revisions)
337 update update working directory (or switch revisions)
337 verify verify the integrity of the repository
338 verify verify the integrity of the repository
338 version output version and copyright information
339 version output version and copyright information
339
340
340 additional help topics:
341 additional help topics:
341
342
342 config Configuration Files
343 config Configuration Files
343 dates Date Formats
344 dates Date Formats
344 diffs Diff Formats
345 diffs Diff Formats
345 environment Environment Variables
346 environment Environment Variables
346 extensions Using Additional Features
347 extensions Using Additional Features
347 filesets Specifying File Sets
348 filesets Specifying File Sets
348 glossary Glossary
349 glossary Glossary
349 hgignore Syntax for Mercurial Ignore Files
350 hgignore Syntax for Mercurial Ignore Files
350 hgweb Configuring hgweb
351 hgweb Configuring hgweb
351 merge-tools Merge Tools
352 merge-tools Merge Tools
352 multirevs Specifying Multiple Revisions
353 multirevs Specifying Multiple Revisions
353 patterns File Name Patterns
354 patterns File Name Patterns
354 phases Working with Phases
355 phases Working with Phases
355 revisions Specifying Single Revisions
356 revisions Specifying Single Revisions
356 revsets Specifying Revision Sets
357 revsets Specifying Revision Sets
357 subrepos Subrepositories
358 subrepos Subrepositories
358 templating Template Usage
359 templating Template Usage
359 urls URL Paths
360 urls URL Paths
360
361
361 (use "hg help -v" to show built-in aliases and global options)
362 (use "hg help -v" to show built-in aliases and global options)
362
363
363
364
364
365
365 $ hg --help
366 $ hg --help
366 Mercurial Distributed SCM
367 Mercurial Distributed SCM
367
368
368 list of commands:
369 list of commands:
369
370
370 add add the specified files on the next commit
371 add add the specified files on the next commit
371 addremove add all new files, delete all missing files
372 addremove add all new files, delete all missing files
372 annotate show changeset information by line for each file
373 annotate show changeset information by line for each file
373 archive create an unversioned archive of a repository revision
374 archive create an unversioned archive of a repository revision
374 backout reverse effect of earlier changeset
375 backout reverse effect of earlier changeset
375 bisect subdivision search of changesets
376 bisect subdivision search of changesets
376 bookmarks create a new bookmark or list existing bookmarks
377 bookmarks create a new bookmark or list existing bookmarks
377 branch set or show the current branch name
378 branch set or show the current branch name
378 branches list repository named branches
379 branches list repository named branches
379 bundle create a changegroup file
380 bundle create a changegroup file
380 cat output the current or given revision of files
381 cat output the current or given revision of files
381 clone make a copy of an existing repository
382 clone make a copy of an existing repository
382 commit commit the specified files or all outstanding changes
383 commit commit the specified files or all outstanding changes
383 config show combined config settings from all hgrc files
384 config show combined config settings from all hgrc files
384 copy mark files as copied for the next commit
385 copy mark files as copied for the next commit
385 diff diff repository (or selected files)
386 diff diff repository (or selected files)
386 export dump the header and diffs for one or more changesets
387 export dump the header and diffs for one or more changesets
387 files list tracked files
388 files list tracked files
388 forget forget the specified files on the next commit
389 forget forget the specified files on the next commit
389 graft copy changes from other branches onto the current branch
390 graft copy changes from other branches onto the current branch
390 grep search for a pattern in specified files and revisions
391 grep search for a pattern in specified files and revisions
391 heads show branch heads
392 heads show branch heads
392 help show help for a given topic or a help overview
393 help show help for a given topic or a help overview
393 identify identify the working directory or specified revision
394 identify identify the working directory or specified revision
394 import import an ordered set of patches
395 import import an ordered set of patches
395 incoming show new changesets found in source
396 incoming show new changesets found in source
396 init create a new repository in the given directory
397 init create a new repository in the given directory
397 log show revision history of entire repository or files
398 log show revision history of entire repository or files
398 manifest output the current or given revision of the project manifest
399 manifest output the current or given revision of the project manifest
399 merge merge another revision into working directory
400 merge merge another revision into working directory
400 outgoing show changesets not found in the destination
401 outgoing show changesets not found in the destination
401 paths show aliases for remote repositories
402 paths show aliases for remote repositories
402 phase set or show the current phase name
403 phase set or show the current phase name
403 pull pull changes from the specified source
404 pull pull changes from the specified source
404 push push changes to the specified destination
405 push push changes to the specified destination
405 recover roll back an interrupted transaction
406 recover roll back an interrupted transaction
406 remove remove the specified files on the next commit
407 remove remove the specified files on the next commit
407 rename rename files; equivalent of copy + remove
408 rename rename files; equivalent of copy + remove
408 resolve redo merges or set/view the merge status of files
409 resolve redo merges or set/view the merge status of files
409 revert restore files to their checkout state
410 revert restore files to their checkout state
410 root print the root (top) of the current working directory
411 root print the root (top) of the current working directory
411 serve start stand-alone webserver
412 serve start stand-alone webserver
412 status show changed files in the working directory
413 status show changed files in the working directory
413 summary summarize working directory state
414 summary summarize working directory state
414 tag add one or more tags for the current or given revision
415 tag add one or more tags for the current or given revision
415 tags list repository tags
416 tags list repository tags
416 unbundle apply one or more changegroup files
417 unbundle apply one or more changegroup files
417 update update working directory (or switch revisions)
418 update update working directory (or switch revisions)
418 verify verify the integrity of the repository
419 verify verify the integrity of the repository
419 version output version and copyright information
420 version output version and copyright information
420
421
421 additional help topics:
422 additional help topics:
422
423
423 config Configuration Files
424 config Configuration Files
424 dates Date Formats
425 dates Date Formats
425 diffs Diff Formats
426 diffs Diff Formats
426 environment Environment Variables
427 environment Environment Variables
427 extensions Using Additional Features
428 extensions Using Additional Features
428 filesets Specifying File Sets
429 filesets Specifying File Sets
429 glossary Glossary
430 glossary Glossary
430 hgignore Syntax for Mercurial Ignore Files
431 hgignore Syntax for Mercurial Ignore Files
431 hgweb Configuring hgweb
432 hgweb Configuring hgweb
432 merge-tools Merge Tools
433 merge-tools Merge Tools
433 multirevs Specifying Multiple Revisions
434 multirevs Specifying Multiple Revisions
434 patterns File Name Patterns
435 patterns File Name Patterns
435 phases Working with Phases
436 phases Working with Phases
436 revisions Specifying Single Revisions
437 revisions Specifying Single Revisions
437 revsets Specifying Revision Sets
438 revsets Specifying Revision Sets
438 subrepos Subrepositories
439 subrepos Subrepositories
439 templating Template Usage
440 templating Template Usage
440 urls URL Paths
441 urls URL Paths
441
442
442 (use "hg help -v" to show built-in aliases and global options)
443 (use "hg help -v" to show built-in aliases and global options)
443
444
444 Not tested: --debugger
445 Not tested: --debugger
445
446
General Comments 0
You need to be logged in to leave comments. Login now