Show More
@@ -0,0 +1,23 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | hgserve() | |||
|
4 | { | |||
|
5 | hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@ \ | |||
|
6 | | sed -e 's/:[0-9][0-9]*//g' -e 's/http:\/\/[^/]*\//http:\/\/localhost\//' | |||
|
7 | cat hg.pid >> "$DAEMON_PIDS" | |||
|
8 | } | |||
|
9 | ||||
|
10 | hg init a | |||
|
11 | hg --encoding utf-8 -R a branch Γ¦ | |||
|
12 | echo foo > a/foo | |||
|
13 | hg -R a ci -Am foo | |||
|
14 | ||||
|
15 | hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1 | |||
|
16 | hg clone http://localhost:$HGPORT1 b | |||
|
17 | hg --encoding utf-8 -R b log | |||
|
18 | echo bar >> b/foo | |||
|
19 | hg -R b ci -m bar | |||
|
20 | hg --encoding utf-8 -R b push | sed "s/$HGPORT1/PORT/" | |||
|
21 | hg -R a --encoding utf-8 log | |||
|
22 | ||||
|
23 | kill `cat hg.pid` |
@@ -0,0 +1,36 b'' | |||||
|
1 | marked working directory as branch Γ¦ | |||
|
2 | adding foo | |||
|
3 | listening at http://localhost/ (bound to 127.0.0.1) | |||
|
4 | requesting all changes | |||
|
5 | adding changesets | |||
|
6 | adding manifests | |||
|
7 | adding file changes | |||
|
8 | added 1 changesets with 1 changes to 1 files | |||
|
9 | updating working directory | |||
|
10 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
11 | changeset: 0:867c11ce77b8 | |||
|
12 | branch: Γ¦ | |||
|
13 | tag: tip | |||
|
14 | user: test | |||
|
15 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
16 | summary: foo | |||
|
17 | ||||
|
18 | pushing to http://localhost:PORT | |||
|
19 | searching for changes | |||
|
20 | adding changesets | |||
|
21 | adding manifests | |||
|
22 | adding file changes | |||
|
23 | added 1 changesets with 1 changes to 1 files | |||
|
24 | changeset: 1:58e7c90d67cb | |||
|
25 | branch: Γ¦ | |||
|
26 | tag: tip | |||
|
27 | user: test | |||
|
28 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
29 | summary: bar | |||
|
30 | ||||
|
31 | changeset: 0:867c11ce77b8 | |||
|
32 | branch: Γ¦ | |||
|
33 | user: test | |||
|
34 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
35 | summary: foo | |||
|
36 |
@@ -319,11 +319,24 b' class localrepository(repo.repository):' | |||||
319 |
|
319 | |||
320 | return partial |
|
320 | return partial | |
321 |
|
321 | |||
322 | def branchmap(self): |
|
322 | def lbranchmap(self): | |
323 | tip = self.changelog.tip() |
|
323 | tip = self.changelog.tip() | |
324 | if self.branchcache is not None and self._branchcachetip == tip: |
|
324 | if self.branchcache is not None and self._branchcachetip == tip: | |
325 | return self.branchcache |
|
325 | return self.branchcache | |
326 |
|
326 | |||
|
327 | partial = self.branchmap() | |||
|
328 | ||||
|
329 | # the branch cache is stored on disk as UTF-8, but in the local | |||
|
330 | # charset internally | |||
|
331 | for k, v in partial.iteritems(): | |||
|
332 | self.branchcache[encoding.tolocal(k)] = v | |||
|
333 | return self.branchcache | |||
|
334 | ||||
|
335 | def branchmap(self): | |||
|
336 | tip = self.changelog.tip() | |||
|
337 | if self._ubranchcache is not None and self._branchcachetip == tip: | |||
|
338 | return self._ubranchcache | |||
|
339 | ||||
327 | oldtip = self._branchcachetip |
|
340 | oldtip = self._branchcachetip | |
328 | self._branchcachetip = tip |
|
341 | self._branchcachetip = tip | |
329 | if self.branchcache is None: |
|
342 | if self.branchcache is None: | |
@@ -340,18 +353,13 b' class localrepository(repo.repository):' | |||||
340 | # this private cache holds all heads (not just tips) |
|
353 | # this private cache holds all heads (not just tips) | |
341 | self._ubranchcache = partial |
|
354 | self._ubranchcache = partial | |
342 |
|
355 | |||
343 | # the branch cache is stored on disk as UTF-8, but in the local |
|
356 | return self._ubranchcache | |
344 | # charset internally |
|
|||
345 | for k, v in partial.iteritems(): |
|
|||
346 | self.branchcache[encoding.tolocal(k)] = v |
|
|||
347 | return self.branchcache |
|
|||
348 |
|
||||
349 |
|
357 | |||
350 | def branchtags(self): |
|
358 | def branchtags(self): | |
351 | '''return a dict where branch names map to the tipmost head of |
|
359 | '''return a dict where branch names map to the tipmost head of | |
352 | the branch, open heads come before closed''' |
|
360 | the branch, open heads come before closed''' | |
353 | bt = {} |
|
361 | bt = {} | |
354 | for bn, heads in self.branchmap().iteritems(): |
|
362 | for bn, heads in self.lbranchmap().iteritems(): | |
355 | head = None |
|
363 | head = None | |
356 | for i in range(len(heads)-1, -1, -1): |
|
364 | for i in range(len(heads)-1, -1, -1): | |
357 | h = heads[i] |
|
365 | h = heads[i] | |
@@ -1168,7 +1176,7 b' class localrepository(repo.repository):' | |||||
1168 | ''' |
|
1176 | ''' | |
1169 | if branch is None: |
|
1177 | if branch is None: | |
1170 | branch = self[None].branch() |
|
1178 | branch = self[None].branch() | |
1171 | branches = self.branchmap() |
|
1179 | branches = self.lbranchmap() | |
1172 | if branch not in branches: |
|
1180 | if branch not in branches: | |
1173 | return [] |
|
1181 | return [] | |
1174 | # the cache returns heads ordered lowest to highest |
|
1182 | # the cache returns heads ordered lowest to highest |
General Comments 0
You need to be logged in to leave comments.
Login now