# HG changeset patch # User Matt Mackall # Date 1446671872 21600 # Node ID f9984f76fd90e439221425d751e29bae17bec995 # Parent 859f453e8b4e2b42b6b6552b79c5c5e7e2fc1cf7# Parent e7c618cee8df35aefedad15b991d628bae1c60c8 merge with stable diff -r 859f453e8b4e -r f9984f76fd90 hgext/clonebundles.py --- a/hgext/clonebundles.py Mon Nov 02 12:12:24 2015 -0800 +++ b/hgext/clonebundles.py Wed Nov 04 15:17:52 2015 -0600 @@ -211,18 +211,6 @@ return caps -@wireproto.wireprotocommand('clonebundles', '') -def bundles(repo, proto): - """Server command for returning info for available bundles to seed clones. - - Clients will parse this response and determine what bundle to fetch. - - Other extensions may wrap this command to filter or dynamically emit - data depending on the request. e.g. you could advertise URLs for - the closest data center given the client's IP address. - """ - return repo.opener.tryread('clonebundles.manifest') - @exchange.getbundle2partsgenerator('clonebundlesadvertise', 0) def advertiseclonebundlespart(bundler, repo, source, bundlecaps=None, b2caps=None, heads=None, common=None, diff -r 859f453e8b4e -r f9984f76fd90 i18n/check-translation.py --- a/i18n/check-translation.py Mon Nov 02 12:12:24 2015 -0800 +++ b/i18n/check-translation.py Wed Nov 04 15:17:52 2015 -0600 @@ -71,9 +71,7 @@ deprecatedpe = None @scanner() def deprecatedsetup(pofile): - pes = [p for p in pofile - if ((p.msgid == 'DEPRECATED' or p.msgid == '(DEPRECATED)') and - p.msgstr)] + pes = [p for p in pofile if p.msgid == '(DEPRECATED)' and p.msgstr] if len(pes): global deprecatedpe deprecatedpe = pes[0] @@ -82,8 +80,8 @@ def deprecated(pe): """Check for DEPRECATED >>> ped = polib.POEntry( - ... msgid = 'DEPRECATED', - ... msgstr= 'DETACERPED') + ... msgid = '(DEPRECATED)', + ... msgstr= '(DETACERPED)') >>> deprecatedsetup([ped]) >>> pe = polib.POEntry( ... msgid = 'Something (DEPRECATED)', diff -r 859f453e8b4e -r f9984f76fd90 i18n/da.po --- a/i18n/da.po Mon Nov 02 12:12:24 2015 -0800 +++ b/i18n/da.po Wed Nov 04 15:17:52 2015 -0600 @@ -9366,8 +9366,8 @@ msgid "VALUE" msgstr "" -msgid "DEPRECATED" -msgstr "FORÆLDET" +msgid "(DEPRECATED)" +msgstr "(FORÆLDET)" msgid "" "\n" diff -r 859f453e8b4e -r f9984f76fd90 i18n/it.po --- a/i18n/it.po Mon Nov 02 12:12:24 2015 -0800 +++ b/i18n/it.po Wed Nov 04 15:17:52 2015 -0600 @@ -7505,8 +7505,8 @@ msgid "VALUE" msgstr "" -msgid "DEPRECATED" -msgstr "DEPRECATO" +msgid "(DEPRECATED)" +msgstr "(DEPRECATO)" msgid "" "\n" diff -r 859f453e8b4e -r f9984f76fd90 i18n/ro.po --- a/i18n/ro.po Mon Nov 02 12:12:24 2015 -0800 +++ b/i18n/ro.po Wed Nov 04 15:17:52 2015 -0600 @@ -8258,8 +8258,8 @@ msgid "VALUE" msgstr "VALOARE" -msgid "DEPRECATED" -msgstr "ÎNVECHIT" +msgid "(DEPRECATED)" +msgstr "(ÎNVECHIT)" msgid "" "\n" diff -r 859f453e8b4e -r f9984f76fd90 i18n/zh_CN.po --- a/i18n/zh_CN.po Mon Nov 02 12:12:24 2015 -0800 +++ b/i18n/zh_CN.po Wed Nov 04 15:17:52 2015 -0600 @@ -10444,5 +10444,5 @@ msgid "user name not available - set USERNAME environment variable" msgstr "" -msgid "DEPRECATED" -msgstr "不赞成" +msgid "(DEPRECATED)" +msgstr "(不赞成)" diff -r 859f453e8b4e -r f9984f76fd90 mercurial/changegroup.py --- a/mercurial/changegroup.py Mon Nov 02 12:12:24 2015 -0800 +++ b/mercurial/changegroup.py Wed Nov 04 15:17:52 2015 -0600 @@ -406,6 +406,10 @@ % (changesets, revisions, files, htext)) repo.invalidatevolatilesets() + # Call delayupdate again to ensure the transaction writepending + # subscriptions are still in place. + cl.delayupdate(tr) + if changesets > 0: if 'node' not in tr.hookargs: tr.hookargs['node'] = hex(cl.node(clstart)) diff -r 859f453e8b4e -r f9984f76fd90 mercurial/exchange.py --- a/mercurial/exchange.py Mon Nov 02 12:12:24 2015 -0800 +++ b/mercurial/exchange.py Wed Nov 04 15:17:52 2015 -0600 @@ -1658,6 +1658,10 @@ if not repo.ui.configbool('experimental', 'clonebundles', False): return + # Only run if local repo is empty. + if len(repo): + return + if pullop.heads: return diff -r 859f453e8b4e -r f9984f76fd90 mercurial/hook.py --- a/mercurial/hook.py Mon Nov 02 12:12:24 2015 -0800 +++ b/mercurial/hook.py Wed Nov 04 15:17:52 2015 -0600 @@ -122,7 +122,8 @@ # make in-memory changes visible to external process tr = repo.currenttransaction() repo.dirstate.write(tr) - if tr and tr.writepending(): + if tr: + tr.writepending() env['HG_PENDING'] = repo.root for k, v in args.iteritems(): diff -r 859f453e8b4e -r f9984f76fd90 mercurial/templatefilters.py --- a/mercurial/templatefilters.py Mon Nov 02 12:12:24 2015 -0800 +++ b/mercurial/templatefilters.py Wed Nov 04 15:17:52 2015 -0600 @@ -197,7 +197,11 @@ return {None: 'null', False: 'false', True: 'true'}[obj] elif isinstance(obj, int) or isinstance(obj, float): return str(obj) + elif isinstance(obj, encoding.localstr): + u = encoding.fromlocal(obj).decode('utf-8') # can round-trip + return '"%s"' % jsonescape(u) elif isinstance(obj, str): + # no encoding.fromlocal() because it may abort if obj can't be decoded u = unicode(obj, encoding.encoding, 'replace') return '"%s"' % jsonescape(u) elif isinstance(obj, unicode): diff -r 859f453e8b4e -r f9984f76fd90 mercurial/wireproto.py --- a/mercurial/wireproto.py Mon Nov 02 12:12:24 2015 -0800 +++ b/mercurial/wireproto.py Wed Nov 04 15:17:52 2015 -0600 @@ -549,6 +549,17 @@ r.append(encodelist(b) + "\n") return "".join(r) +@wireprotocommand('clonebundles', '') +def clonebundles(repo, proto): + """Server command for returning info for available bundles to seed clones. + + Clients will parse this response and determine what bundle to fetch. + + Extensions may wrap this command to filter or dynamically emit data + depending on the request. e.g. you could advertise URLs for the closest + data center given the client's IP address. + """ + return repo.opener.tryread('clonebundles.manifest') wireprotocaps = ['lookup', 'changegroupsubset', 'branchmap', 'pushkey', 'known', 'getbundle', 'unbundlehash', 'batch'] diff -r 859f453e8b4e -r f9984f76fd90 tests/test-clonebundles.t --- a/tests/test-clonebundles.t Mon Nov 02 12:12:24 2015 -0800 +++ b/tests/test-clonebundles.t Wed Nov 04 15:17:52 2015 -0600 @@ -156,6 +156,25 @@ adding file changes added 1 changesets with 1 changes to 1 files +Incremental pull doesn't fetch bundle + + $ hg clone -r 53245c60e682 -U http://localhost:$HGPORT partial-clone + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + + $ cd partial-clone + $ hg pull + pulling from http://localhost:$HGPORT/ + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) + $ cd .. + Bundle with full content works $ hg -R server bundle --type gzip-v2 --base null -r tip full.hg @@ -205,6 +224,18 @@ searching for changes no changes found +Feature works over SSH + + $ hg clone -U -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/server ssh-full-clone + applying clone bundle from http://localhost:$HGPORT1/full.hg + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + finished applying clone bundle + searching for changes + no changes found + Entry with unknown BUNDLESPEC is filtered and not used $ cat > server/.hg/clonebundles.manifest << EOF diff -r 859f453e8b4e -r f9984f76fd90 tests/test-command-template.t --- a/tests/test-command-template.t Mon Nov 02 12:12:24 2015 -0800 +++ b/tests/test-command-template.t Wed Nov 04 15:17:52 2015 -0600 @@ -3479,3 +3479,26 @@ $ hg log -T "\\xy" -R a hg: parse error: invalid \x escape [255] + +Set up repository for non-ascii encoding tests: + + $ hg init nonascii + $ cd nonascii + $ python < open('utf-8', 'w').write('\xc3\xa9') + > EOF + $ HGENCODING=utf-8 hg branch -q `cat utf-8` + $ HGENCODING=utf-8 hg ci -qAm 'non-ascii branch' utf-8 + +json filter should try round-trip conversion to utf-8: + + $ HGENCODING=ascii hg log -T "{branch|json}\n" -r0 + "\u00e9" + +json filter should not abort if it can't decode bytes: +(not sure the current behavior is right; we might want to use utf-8b encoding?) + + $ HGENCODING=ascii hg log -T "{'`cat utf-8`'|json}\n" -l1 + "\ufffd\ufffd" + + $ cd .. diff -r 859f453e8b4e -r f9984f76fd90 tests/test-hook.t --- a/tests/test-hook.t Mon Nov 02 12:12:24 2015 -0800 +++ b/tests/test-hook.t Wed Nov 04 15:17:52 2015 -0600 @@ -113,7 +113,7 @@ $ hg pull ../a pulling from ../a searching for changes - prechangegroup hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) + prechangegroup hook: HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) adding changesets adding manifests adding file changes @@ -272,7 +272,7 @@ listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} no changes found pretxnopen hook: HG_TXNID=TXN:* HG_TXNNAME=push (glob) - prepushkey.forbid hook: HG_BUNDLE2=1 HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:* HG_URL=push (glob) + prepushkey.forbid hook: HG_BUNDLE2=1 HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:* HG_URL=push (glob) pushkey-abort: prepushkey hook exited with status 1 abort: exporting bookmark baz failed! [255] @@ -306,7 +306,7 @@ $ hg pull ../a pulling from ../a searching for changes - prechangegroup.forbid hook: HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) + prechangegroup.forbid hook: HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:* HG_URL=file:$TESTTMP/a (glob) abort: prechangegroup.forbid hook exited with status 1 [255] @@ -686,6 +686,7 @@ $ cd .. $ hg init to $ echo '[hooks]' >> to/.hg/hgrc + $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc $ echo a >> to/a $ hg --cwd to ci -Ama @@ -698,6 +699,12 @@ $ hg --cwd from push pushing to $TESTTMP/to (glob) searching for changes + changeset: 0:cb9a9f314b8b + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: a + adding changesets adding manifests adding file changes