Show More
@@ -0,0 +1,24 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | # basic test for hg debugrebuildstate | |||
|
3 | ||||
|
4 | hg init repo | |||
|
5 | cd repo | |||
|
6 | ||||
|
7 | touch foo bar | |||
|
8 | hg ci -Am 'add foo bar' | |||
|
9 | ||||
|
10 | touch baz | |||
|
11 | hg add baz | |||
|
12 | hg rm bar | |||
|
13 | ||||
|
14 | echo '% state dump' | |||
|
15 | hg debugstate | cut -b 1-16,35- | sort | |||
|
16 | echo '% status' | |||
|
17 | hg st -A | |||
|
18 | ||||
|
19 | hg debugrebuildstate | |||
|
20 | echo '% state dump' | |||
|
21 | hg debugstate | cut -b 1-16,35- | sort | |||
|
22 | echo '% status' | |||
|
23 | hg st -A | |||
|
24 |
@@ -0,0 +1,17 b'' | |||||
|
1 | adding bar | |||
|
2 | adding foo | |||
|
3 | % state dump | |||
|
4 | a 0 -1 baz | |||
|
5 | n 644 0 foo | |||
|
6 | r 0 0 bar | |||
|
7 | % status | |||
|
8 | A baz | |||
|
9 | R bar | |||
|
10 | C foo | |||
|
11 | % state dump | |||
|
12 | n 666 -1 bar | |||
|
13 | n 666 -1 foo | |||
|
14 | % status | |||
|
15 | ! bar | |||
|
16 | ? baz | |||
|
17 | C foo |
@@ -250,8 +250,14 b' class dirstate(object):' | |||||
250 | except KeyError: |
|
250 | except KeyError: | |
251 | self._ui.warn(_("not in dirstate: %s!\n") % f) |
|
251 | self._ui.warn(_("not in dirstate: %s!\n") % f) | |
252 |
|
252 | |||
|
253 | def clear(self): | |||
|
254 | self._map = {} | |||
|
255 | self._copymap = {} | |||
|
256 | self._pl = [nullid, nullid] | |||
|
257 | self._dirty = True | |||
|
258 | ||||
253 | def rebuild(self, parent, files): |
|
259 | def rebuild(self, parent, files): | |
254 |
self. |
|
260 | self.clear() | |
255 | for f in files: |
|
261 | for f in files: | |
256 | if files.execf(f): |
|
262 | if files.execf(f): | |
257 | self._map[f] = ('n', 0777, -1, 0) |
|
263 | self._map[f] = ('n', 0777, -1, 0) |
@@ -488,7 +488,7 b' class hgweb(object):' | |||||
488 | continue |
|
488 | continue | |
489 |
|
489 | |||
490 | yield {"parity": parity.next(), |
|
490 | yield {"parity": parity.next(), | |
491 |
"path": |
|
491 | "path": "%s%s" % (abspath, f), | |
492 | "basename": f[:-1]} |
|
492 | "basename": f[:-1]} | |
493 |
|
493 | |||
494 | yield self.t("manifest", |
|
494 | yield self.t("manifest", |
@@ -17,7 +17,8 b' from hgweb_mod import hgweb' | |||||
17 | class hgwebdir(object): |
|
17 | class hgwebdir(object): | |
18 | def __init__(self, config, parentui=None): |
|
18 | def __init__(self, config, parentui=None): | |
19 | def cleannames(items): |
|
19 | def cleannames(items): | |
20 |
return [(name.strip(os.sep), path) |
|
20 | return [(util.pconvert(name.strip(os.sep)), path) | |
|
21 | for name, path in items] | |||
21 |
|
22 | |||
22 | self.parentui = parentui |
|
23 | self.parentui = parentui | |
23 | self.motd = None |
|
24 | self.motd = None |
@@ -144,6 +144,43 b' def zgenerator(f):' | |||||
144 | raise IOError(None, _('connection ended unexpectedly')) |
|
144 | raise IOError(None, _('connection ended unexpectedly')) | |
145 | yield zd.flush() |
|
145 | yield zd.flush() | |
146 |
|
146 | |||
|
147 | _safe = ('abcdefghijklmnopqrstuvwxyz' | |||
|
148 | 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |||
|
149 | '0123456789' '_.-/') | |||
|
150 | _safeset = None | |||
|
151 | _hex = None | |||
|
152 | def quotepath(path): | |||
|
153 | '''quote the path part of a URL | |||
|
154 | ||||
|
155 | This is similar to urllib.quote, but it also tries to avoid | |||
|
156 | quoting things twice (inspired by wget): | |||
|
157 | ||||
|
158 | >>> quotepath('abc def') | |||
|
159 | 'abc%20def' | |||
|
160 | >>> quotepath('abc%20def') | |||
|
161 | 'abc%20def' | |||
|
162 | >>> quotepath('abc%20 def') | |||
|
163 | 'abc%20%20def' | |||
|
164 | >>> quotepath('abc def%20') | |||
|
165 | 'abc%20def%20' | |||
|
166 | >>> quotepath('abc def%2') | |||
|
167 | 'abc%20def%252' | |||
|
168 | >>> quotepath('abc def%') | |||
|
169 | 'abc%20def%25' | |||
|
170 | ''' | |||
|
171 | global _safeset, _hex | |||
|
172 | if _safeset is None: | |||
|
173 | _safeset = util.set(_safe) | |||
|
174 | _hex = util.set('abcdefABCDEF0123456789') | |||
|
175 | l = list(path) | |||
|
176 | for i in xrange(len(l)): | |||
|
177 | c = l[i] | |||
|
178 | if c == '%' and i + 2 < len(l) and (l[i+1] in _hex and l[i+2] in _hex): | |||
|
179 | pass | |||
|
180 | elif c not in _safeset: | |||
|
181 | l[i] = '%%%02X' % ord(c) | |||
|
182 | return ''.join(l) | |||
|
183 | ||||
147 | class httprepository(remoterepository): |
|
184 | class httprepository(remoterepository): | |
148 | def __init__(self, ui, path): |
|
185 | def __init__(self, ui, path): | |
149 | self.path = path |
|
186 | self.path = path | |
@@ -153,13 +190,16 b' class httprepository(remoterepository):' | |||||
153 | if query or frag: |
|
190 | if query or frag: | |
154 | raise util.Abort(_('unsupported URL component: "%s"') % |
|
191 | raise util.Abort(_('unsupported URL component: "%s"') % | |
155 | (query or frag)) |
|
192 | (query or frag)) | |
156 |
if not urlpath: |
|
193 | if not urlpath: | |
|
194 | urlpath = '/' | |||
|
195 | urlpath = quotepath(urlpath) | |||
157 | host, port, user, passwd = netlocsplit(netloc) |
|
196 | host, port, user, passwd = netlocsplit(netloc) | |
158 |
|
197 | |||
159 | # urllib cannot handle URLs with embedded user or passwd |
|
198 | # urllib cannot handle URLs with embedded user or passwd | |
160 | self._url = urlparse.urlunsplit((scheme, netlocunsplit(host, port), |
|
199 | self._url = urlparse.urlunsplit((scheme, netlocunsplit(host, port), | |
161 | urlpath, '', '')) |
|
200 | urlpath, '', '')) | |
162 | self.ui = ui |
|
201 | self.ui = ui | |
|
202 | self.ui.debug(_('using %s\n') % self._url) | |||
163 |
|
203 | |||
164 | proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') |
|
204 | proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') | |
165 | # XXX proxyauthinfo = None |
|
205 | # XXX proxyauthinfo = None |
General Comments 0
You need to be logged in to leave comments.
Login now