##// END OF EJS Templates
branchcache: fetch source branchcache during clone (issue3378)...
Tomasz Kleczek -
r17740:e6067bec default
parent child Browse files
Show More
@@ -336,6 +336,16 b' def clone(ui, peeropts, source, dest=Non'
336
336
337 destlock = copystore(ui, srcrepo, destpath)
337 destlock = copystore(ui, srcrepo, destpath)
338
338
339 # Recomputing branch cache might be slow on big repos,
340 # so just copy it
341 dstcachedir = os.path.join(destpath, 'cache')
342 srcbranchcache = srcrepo.sjoin('cache/branchheads')
343 dstbranchcache = os.path.join(dstcachedir, 'branchheads')
344 if os.path.exists(srcbranchcache):
345 if not os.path.exists(dstcachedir):
346 os.mkdir(dstcachedir)
347 util.copyfile(srcbranchcache, dstbranchcache)
348
339 # we need to re-init the repo after manually copying the data
349 # we need to re-init the repo after manually copying the data
340 # into it
350 # into it
341 destpeer = peer(ui, peeropts, dest)
351 destpeer = peer(ui, peeropts, dest)
@@ -2472,6 +2472,12 b' class localrepository(object):'
2472 def stream_in(self, remote, requirements):
2472 def stream_in(self, remote, requirements):
2473 lock = self.lock()
2473 lock = self.lock()
2474 try:
2474 try:
2475 # Save remote branchmap. We will use it later
2476 # to speed up branchcache creation
2477 rbranchmap = None
2478 if remote.capable("branchmap"):
2479 rbranchmap = remote.branchmap()
2480
2475 fp = remote.stream_out()
2481 fp = remote.stream_out()
2476 l = fp.readline()
2482 l = fp.readline()
2477 try:
2483 try:
@@ -2532,6 +2538,17 b' class localrepository(object):'
2532 self._applyrequirements(requirements)
2538 self._applyrequirements(requirements)
2533 self._writerequirements()
2539 self._writerequirements()
2534
2540
2541 if rbranchmap:
2542 rbheads = []
2543 for bheads in rbranchmap.itervalues():
2544 rbheads.extend(bheads)
2545
2546 self.branchcache = rbranchmap
2547 if rbheads:
2548 rtiprev = max((int(self.changelog.rev(node))
2549 for node in rbheads))
2550 self._writebranchcache(self.branchcache,
2551 self[rtiprev].node(), rtiprev)
2535 self.invalidate()
2552 self.invalidate()
2536 return len(self.heads()) + 1
2553 return len(self.heads()) + 1
2537 finally:
2554 finally:
@@ -99,6 +99,7 b' do not use the proxy if it is in the no '
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 $ cat proxy.log
100 $ cat proxy.log
101 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
101 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
102 * - - [*] "GET http://localhost:$HGPORT/?cmd=branchmap HTTP/1.1" - - (glob)
102 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - (glob)
103 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=listkeys HTTP/1.1" - - x-hgarg-1:namespace=bookmarks (glob)
104 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
105 * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
General Comments 0
You need to be logged in to leave comments. Login now