##// END OF EJS Templates
lfs: add the 'lfs' requirement in the changegroup transaction introducing lfs...
lfs: add the 'lfs' requirement in the changegroup transaction introducing lfs A hook like this is how largefiles manages to do the same. Largefiles uses a changegroup hook, but this uses pretxnchangegroup because that actually causes the transaction to rollback in the unlikely event that writing the requirements out fails. Sadly, the requires file itself isn't rolled back if a subsequent hook fails, but that seems trivial. Now that commit, changegroup and convert are covered, I don't think there's any way to get an lfs repo without the requirement. The grep exit code is blotted out of some test-lfs-serve.t tests now showing the requirement, because run-tests.py doesn't support conditionalizing the exit code.

File last commit:

r33949:0124cf4a default
r35520:6bb940de default
Show More
test-bundle2-pushback.t
110 lines | 2.7 KiB | text/troff | Tads3Lexer
/ tests / test-bundle2-pushback.t
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 $ cat > bundle2.py << EOF
> """A small extension to test bundle2 pushback parts.
> Current bundle2 implementation doesn't provide a way to generate those
> parts, so they must be created by extensions.
> """
Augie Fackler
tests: update test-bundle2-pushback to pass the import checker
r33949 > from __future__ import absolute_import
> from mercurial import bundle2, exchange, pushkey, util
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > def _newhandlechangegroup(op, inpart):
> """This function wraps the changegroup part handler for getbundle.
Pierre-Yves David
bundle2: rename format, parts and config to final names...
r24686 > It issues an additional pushkey part to send a new
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > bookmark back to the client"""
> result = bundle2.handlechangegroup(op, inpart)
Pierre-Yves David
bundle2: rename format, parts and config to final names...
r24686 > if 'pushback' in op.reply.capabilities:
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > params = {'namespace': 'bookmarks',
> 'key': 'new-server-mark',
> 'old': '',
> 'new': 'tip'}
> encodedparams = [(k, pushkey.encode(v)) for (k,v) in params.items()]
Pierre-Yves David
bundle2: rename format, parts and config to final names...
r24686 > op.reply.newpart('pushkey', mandatoryparams=encodedparams)
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > else:
Pierre-Yves David
bundle2: rename format, parts and config to final names...
r24686 > op.reply.newpart('output', data='pushback not enabled')
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > return result
> _newhandlechangegroup.params = bundle2.handlechangegroup.params
Pierre-Yves David
bundle2: rename format, parts and config to final names...
r24686 > bundle2.parthandlermapping['changegroup'] = _newhandlechangegroup
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > EOF
$ cat >> $HGRCPATH <<EOF
> [ui]
Augie Fackler
tests: replace yet more calls to `python` with $PYTHON...
r33262 > ssh = $PYTHON "$TESTDIR/dummyssh"
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 > username = nobody <no.reply@example.com>
>
> [alias]
> tglog = log -G -T "{desc} [{phase}:{node|short}]"
> EOF
Set up server repository
$ hg init server
$ cd server
$ echo c0 > f0
$ hg commit -Am 0
adding f0
Set up client repository
$ cd ..
$ hg clone ssh://user@dummy/server client -q
$ cd client
Enable extension
$ cat >> $HGRCPATH <<EOF
> [extensions]
> bundle2=$TESTTMP/bundle2.py
> EOF
Without config
$ cd ../client
$ echo c1 > f1
$ hg commit -Am 1
adding f1
$ hg push
pushing to ssh://user@dummy/server
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
Pierre-Yves David
bundle2: stop capturing output for ssh again...
r25423 remote: pushback not enabled
Eric Sumner
bundle2-push: provide transaction to reply unbundler...
r23439 $ hg bookmark
no bookmarks set
$ cd ../server
$ hg tglog
o 1 [public:2b9c7234e035]
|
@ 0 [public:6cee5c8f3e5b]
With config
$ cd ../client
$ echo '[experimental]' >> .hg/hgrc
$ echo 'bundle2.pushback = True' >> .hg/hgrc
$ echo c2 > f2
$ hg commit -Am 2
adding f2
$ hg push
pushing to ssh://user@dummy/server
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
$ hg bookmark
new-server-mark 2:0a76dfb2e179
$ cd ../server
$ hg tglog
o 2 [public:0a76dfb2e179]
|
o 1 [public:2b9c7234e035]
|
@ 0 [public:6cee5c8f3e5b]