##// END OF EJS Templates
bundle2: support for push over the wire...
Pierre-Yves David -
r21075:438803e4 default
parent child Browse files
Show More
@@ -343,8 +343,12 class wirepeer(peer.peerrepository):
343 343 def unbundle(self, cg, heads, source):
344 344 '''Send cg (a readable file-like object representing the
345 345 changegroup to push, typically a chunkbuffer object) to the
346 remote server as a bundle. Return an integer indicating the
347 result of the push (see localrepository.addchangegroup()).'''
346 remote server as a bundle.
347
348 When pushing a bundle10 stream, return an integer indicating the
349 result of the push (see localrepository.addchangegroup()).
350
351 When pushing a bundle20 stream, return a bundle20 stream.'''
348 352
349 353 if heads != ['force'] and self.capable('unbundlehash'):
350 354 heads = encodelist(['hashed',
@@ -352,6 +356,8 class wirepeer(peer.peerrepository):
352 356 else:
353 357 heads = encodelist(heads)
354 358
359 if util.safehasattr(cg, 'deltaheader'):
360 # this a bundle10, do the old style call sequence
355 361 ret, output = self._callpush("unbundle", cg, heads=heads)
356 362 if ret == "":
357 363 raise error.ResponseError(
@@ -364,6 +370,10 class wirepeer(peer.peerrepository):
364 370
365 371 for l in output.splitlines(True):
366 372 self.ui.status(_('remote: '), l)
373 else:
374 # bundle2 push. Send a stream, fetch a stream.
375 stream = self._calltwowaystream('unbundle', cg, heads=heads)
376 ret = bundle2.unbundle20(self.ui, stream)
367 377 return ret
368 378
369 379 def debugwireargs(self, one, two, three=None, four=None, five=None):
@@ -781,6 +791,10 def unbundle(repo, proto, heads):
781 791 gen = exchange.readbundle(repo.ui, fp, None)
782 792 r = exchange.unbundle(repo, gen, their_heads, 'serve',
783 793 proto._client())
794 if util.safehasattr(r, 'addpart'):
795 # The return looks streameable, we are in the bundle2 case and
796 # should return a stream.
797 return streamres(r.getchunks())
784 798 return pushres(r)
785 799
786 800 finally:
@@ -158,6 +158,9 Create an extension to test bundle2 API
158 158 > bundle2=True
159 159 > [ui]
160 160 > ssh=python "$TESTDIR/dummyssh"
161 > [web]
162 > push_ssl = false
163 > allow_push = *
161 164 > EOF
162 165
163 166 The extension requires a repo (currently unused)
@@ -711,4 +714,72 pull over http
711 714 (run 'hg heads .' to see heads, 'hg merge' to merge)
712 715 $ cat main-error.log
713 716
717 push over ssh
714 718
719 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8
720 pushing to ssh://user@dummy/other
721 searching for changes
722 remote: adding changesets
723 remote: adding manifests
724 remote: adding file changes
725 remote: added 1 changesets with 1 changes to 1 files
726
727 push over http
728
729 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
730 $ cat other.pid >> $DAEMON_PIDS
731
732 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403
733 pushing to http://localhost:$HGPORT2/
734 searching for changes
735 $ cat other-error.log
736
737 Check final content.
738
739 $ hg -R other log -G
740 o changeset: 7:32af7686d403
741 | tag: tip
742 | user: Nicolas Dumazet <nicdumz.commits@gmail.com>
743 | date: Sat Apr 30 15:24:48 2011 +0200
744 | summary: D
745 |
746 o changeset: 6:5fddd98957c8
747 | user: Nicolas Dumazet <nicdumz.commits@gmail.com>
748 | date: Sat Apr 30 15:24:48 2011 +0200
749 | summary: C
750 |
751 o changeset: 5:42ccdea3bb16
752 | parent: 0:cd010b8cd998
753 | user: Nicolas Dumazet <nicdumz.commits@gmail.com>
754 | date: Sat Apr 30 15:24:48 2011 +0200
755 | summary: B
756 |
757 | o changeset: 4:02de42196ebe
758 | | parent: 2:24b6387c8c8c
759 | | user: Nicolas Dumazet <nicdumz.commits@gmail.com>
760 | | date: Sat Apr 30 15:24:48 2011 +0200
761 | | summary: H
762 | |
763 | | o changeset: 3:eea13746799a
764 | |/| parent: 2:24b6387c8c8c
765 | | | parent: 1:9520eea781bc
766 | | | user: Nicolas Dumazet <nicdumz.commits@gmail.com>
767 | | | date: Sat Apr 30 15:24:48 2011 +0200
768 | | | summary: G
769 | | |
770 | o | changeset: 2:24b6387c8c8c
771 |/ / parent: 0:cd010b8cd998
772 | | user: Nicolas Dumazet <nicdumz.commits@gmail.com>
773 | | date: Sat Apr 30 15:24:48 2011 +0200
774 | | summary: F
775 | |
776 | @ changeset: 1:9520eea781bc
777 |/ user: Nicolas Dumazet <nicdumz.commits@gmail.com>
778 | date: Sat Apr 30 15:24:48 2011 +0200
779 | summary: E
780 |
781 o changeset: 0:cd010b8cd998
782 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
783 date: Sat Apr 30 15:24:48 2011 +0200
784 summary: A
785
General Comments 0
You need to be logged in to leave comments. Login now