##// END OF EJS Templates
bundle2: allow bundle2 for pulling over the wire...
Pierre-Yves David -
r21069:0a9cae23 default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 import urllib, tempfile, os, sys
8 import urllib, tempfile, os, sys
9 from i18n import _
9 from i18n import _
10 from node import bin, hex
10 from node import bin, hex
11 import changegroup as changegroupmod
11 import changegroup as changegroupmod, bundle2
12 import peer, error, encoding, util, store, exchange
12 import peer, error, encoding, util, store, exchange
13
13
14
14
@@ -335,7 +335,10 b' class wirepeer(peer.peerrepository):'
335 if bundlecaps is not None:
335 if bundlecaps is not None:
336 opts['bundlecaps'] = ','.join(bundlecaps)
336 opts['bundlecaps'] = ','.join(bundlecaps)
337 f = self._callcompressable("getbundle", **opts)
337 f = self._callcompressable("getbundle", **opts)
338 return changegroupmod.unbundle10(f, 'UN')
338 if bundlecaps is not None and 'HG20' in bundlecaps:
339 return bundle2.unbundle20(self.ui, f)
340 else:
341 return changegroupmod.unbundle10(f, 'UN')
339
342
340 def unbundle(self, cg, heads, source):
343 def unbundle(self, cg, heads, source):
341 '''Send cg (a readable file-like object representing the
344 '''Send cg (a readable file-like object representing the
@@ -565,6 +568,8 b' def _capabilities(repo, proto):'
565 # otherwise, add 'streamreqs' detailing our local revlog format
568 # otherwise, add 'streamreqs' detailing our local revlog format
566 else:
569 else:
567 caps.append('streamreqs=%s' % ','.join(requiredformats))
570 caps.append('streamreqs=%s' % ','.join(requiredformats))
571 if repo.ui.configbool('server', 'bundle2', False):
572 caps.append('bundle2')
568 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
573 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
569 caps.append('httpheader=1024')
574 caps.append('httpheader=1024')
570 return caps
575 return caps
@@ -602,7 +607,7 b' def getbundle(repo, proto, others):'
602 opts[k] = decodelist(v)
607 opts[k] = decodelist(v)
603 elif k == 'bundlecaps':
608 elif k == 'bundlecaps':
604 opts[k] = set(v.split(','))
609 opts[k] = set(v.split(','))
605 cg = changegroupmod.getbundle(repo, 'serve', **opts)
610 cg = exchange.getbundle(repo, 'serve', **opts)
606 return streamres(proto.groupchunks(cg))
611 return streamres(proto.groupchunks(cg))
607
612
608 @wireprotocommand('heads')
613 @wireprotocommand('heads')
@@ -156,6 +156,8 b' Create an extension to test bundle2 API'
156 > bundle2=$TESTTMP/bundle2.py
156 > bundle2=$TESTTMP/bundle2.py
157 > [server]
157 > [server]
158 > bundle2=True
158 > bundle2=True
159 > [ui]
160 > ssh=python "$TESTDIR/dummyssh"
159 > EOF
161 > EOF
160
162
161 The extension requires a repo (currently unused)
163 The extension requires a repo (currently unused)
@@ -682,3 +684,31 b' push'
682 adding manifests
684 adding manifests
683 adding file changes
685 adding file changes
684 added 1 changesets with 0 changes to 0 files (-1 heads)
686 added 1 changesets with 0 changes to 0 files (-1 heads)
687
688 pull over ssh
689
690 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --traceback
691 pulling from ssh://user@dummy/main
692 searching for changes
693 adding changesets
694 adding manifests
695 adding file changes
696 added 1 changesets with 1 changes to 1 files (+1 heads)
697 (run 'hg heads' to see heads, 'hg merge' to merge)
698
699 pull over http
700
701 $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log
702 $ cat main.pid >> $DAEMON_PIDS
703
704 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16
705 pulling from http://localhost:$HGPORT/
706 searching for changes
707 adding changesets
708 adding manifests
709 adding file changes
710 added 1 changesets with 1 changes to 1 files (+1 heads)
711 (run 'hg heads .' to see heads, 'hg merge' to merge)
712 $ cat main-error.log
713
714
General Comments 0
You need to be logged in to leave comments. Login now