##// END OF EJS Templates
merge with crew-stable
Alexis S. L. Carvalho -
r5123:79373ec3 merge default
parent child Browse files
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 250 except KeyError:
251 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 259 def rebuild(self, parent, files):
254 self.invalidate()
260 self.clear()
255 261 for f in files:
256 262 if files.execf(f):
257 263 self._map[f] = ('n', 0777, -1, 0)
@@ -488,7 +488,7 b' class hgweb(object):'
488 488 continue
489 489
490 490 yield {"parity": parity.next(),
491 "path": os.path.join(abspath, f),
491 "path": "%s%s" % (abspath, f),
492 492 "basename": f[:-1]}
493 493
494 494 yield self.t("manifest",
@@ -17,7 +17,8 b' from hgweb_mod import hgweb'
17 17 class hgwebdir(object):
18 18 def __init__(self, config, parentui=None):
19 19 def cleannames(items):
20 return [(name.strip(os.sep), path) for name, path in items]
20 return [(util.pconvert(name.strip(os.sep)), path)
21 for name, path in items]
21 22
22 23 self.parentui = parentui
23 24 self.motd = None
@@ -144,6 +144,43 b' def zgenerator(f):'
144 144 raise IOError(None, _('connection ended unexpectedly'))
145 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 184 class httprepository(remoterepository):
148 185 def __init__(self, ui, path):
149 186 self.path = path
@@ -153,13 +190,16 b' class httprepository(remoterepository):'
153 190 if query or frag:
154 191 raise util.Abort(_('unsupported URL component: "%s"') %
155 192 (query or frag))
156 if not urlpath: urlpath = '/'
193 if not urlpath:
194 urlpath = '/'
195 urlpath = quotepath(urlpath)
157 196 host, port, user, passwd = netlocsplit(netloc)
158 197
159 198 # urllib cannot handle URLs with embedded user or passwd
160 199 self._url = urlparse.urlunsplit((scheme, netlocunsplit(host, port),
161 200 urlpath, '', ''))
162 201 self.ui = ui
202 self.ui.debug(_('using %s\n') % self._url)
163 203
164 204 proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
165 205 # XXX proxyauthinfo = None
@@ -5,3 +5,5 b' import mercurial.changelog'
5 5
6 6 doctest.testmod(mercurial.changelog)
7 7
8 import mercurial.httprepo
9 doctest.testmod(mercurial.httprepo)
General Comments 0
You need to be logged in to leave comments. Login now