mercurial@37186: 4 new changesets
4 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/ded5ea279a93 changeset: 37183:ded5ea279a93 user:Danny Hooperdate:Sat Mar 03 14:08:44 2018 -0800 summary: fix: new extension for automatically modifying file contents https://www.mercurial-scm.org/repo/hg/rev/0024961aa493 changeset: 37184:0024961aa493 user:Gregory Szorc date:Fri Mar 30 11:35:17 2018 -0700 summary: contrib: rename clang-format-blacklist to clang-format-ignorelist https://www.mercurial-scm.org/repo/hg/rev/027db60ae756 changeset: 37185:027db60ae756 user:Gregory Szorc date:Fri Mar 30 11:33:21 2018 -0700 summary: tests: add zope.interface to clang-format ignore list https://www.mercurial-scm.org/repo/hg/rev/6d43b39fbaa0 changeset: 37186:6d43b39fbaa0 bookmark:@ tag: tip user:Martin von Zweigbergk date:Fri Mar 30 11:15:58 2018 -0700 summary: narrow: use repo.local() instead of isinstance() -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3067: wireproto: convert human output frames to CBOR
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is easier than rolling our own encoding format. As a bonus, some of our artificial limits around lengths of things went away because we are no longer using fixed length fields to hold sizes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3067 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -136,22 +136,6 @@ ffs(b'1 1 0 command-data eos %s' % data.getvalue()), ]) -def testtextoutputexcessiveargs(self): -"""At most 255 formatting arguments are allowed.""" -with self.assertRaisesRegexp(ValueError, - 'cannot use more than 255 formatting'): -args = [b'x' for i in range(256)] -list(framing.createtextoutputframe(None, 1, - [(b'bleh', args, [])])) - -def testtextoutputexcessivelabels(self): -"""At most 255 labels are allowed.""" -with self.assertRaisesRegexp(ValueError, - 'cannot use more than 255 labels'): -labels = [b'l' for i in range(256)] -list(framing.createtextoutputframe(None, 1, - [(b'bleh', [], labels)])) - def testtextoutputformattingstringtype(self): """Formatting string must be bytes.""" with self.assertRaisesRegexp(ValueError, 'must use bytes formatting '): @@ -168,31 +152,14 @@ list(framing.createtextoutputframe(None, 1, [ (b'foo', [], [b'foo'.decode('ascii')])])) -def testtextoutputtoolongformatstring(self): -with self.assertRaisesRegexp(ValueError, - 'formatting string cannot be longer than'): -list(framing.createtextoutputframe(None, 1, [ -(b'x' * 65536, [], [])])) - -def testtextoutputtoolongargumentstring(self): -with self.assertRaisesRegexp(ValueError, - 'argument string cannot be longer than'): -list(framing.createtextoutputframe(None, 1, [ -(b'bleh', [b'x' * 65536], [])])) - -def testtextoutputtoolonglabelstring(self): -with self.assertRaisesRegexp(ValueError, - 'label string cannot be longer than'): -list(framing.createtextoutputframe(None, 1, [ -(b'bleh', [], [b'x' * 65536])])) - def testtextoutput1simpleatom(self): stream = framing.stream(1) val = list(framing.createtextoutputframe(stream, 1, [ (b'foo', [], [])])) self.assertEqual(val, [ -ffs(br'1 1 stream-begin text-output 0 \x03\x00\x00\x00foo'), +ffs(b'1 1 stream-begin text-output 0 ' +b"cbor:[{b'msg': b'foo'}]"), ]) def testtextoutput2simpleatoms(self): @@ -203,8 +170,8 @@ ])) self.assertEqual(val, [ -ffs(br'1 1 stream-begin text-output 0 ' -br'\x03\x00\x00\x00foo\x03\x00\x00\x00bar'), +ffs(b'1 1 stream-begin text-output 0 ' +b"cbor:[{b'msg': b'foo'}, {b'msg': b'bar'}]") ]) def testtextoutput1arg(self): @@ -214,8 +181,8 @@ ])) self.assertEqual(val, [ -ffs(br'1 1 stream-begin text-output 0 ' -br'\x06\x00\x00\x01\x04\x00foo %sval1'), +ffs(b'1 1 stream-begin text-output 0 ' +b"cbor:[{b'msg': b'foo %s', b'args': [b'val1']}]") ]) def testtextoutput2arg(self): @@ -225,8 +192,8 @@ ])) self.assertEqual(val, [ -ffs(br'1 1 stream-begin text-output 0 ' -br'\x09\x00\x00\x02\x03\x00\x05\x00foo %s %svalvalue'), +ffs(b'1 1 stream-begin text-output 0 ' +b"cbor:[{b'msg': b'foo %s %s', b'args': [b'val', b'value']}]") ]) def testtextoutput1label(self): @@ -236,8 +203,8 @@ ])) self.assertEqual(val, [ -ffs(br'1 1 stream-begin text-output 0 ' -br'\x03\x00\x01\x00\x05foolabel'), +ffs(b'1 1 stream-begin text-output 0 ' +b"cbor:[{b'msg': b'foo', b'labels': [b'label']}]") ]) def testargandlabel(self): @@ -247,8 +214,9 @@ ])) self.assertEqual(val, [ -ffs(br'1 1 stream-begin text-output 0 ' -br'\x06\x00\x01\x01\x05\x03\x00foo %slabelarg'), +ffs(b'1 1 stream-begin text-output 0 ' +b"cbor:[{b'msg': b'foo %s', b'args':
D3065: repair: use repo.file().files() to rebuild fncache
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Previously, the fncache code assumed that .i and .d revlog files were being used. The file storage interface has a files() API to declare the paths of underlying files that are backing storage. It will always return the .i file. And depending on whether the revlog is inline, it will return the .d. This change will make rebuilding the fncache a bit slower since we now have to open revlogs. But this is the only reasonable way to support multiple storage backends with fncache at this juncture. This code is only called from debug* commands, so the perf hit shouldn't matter. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3065 AFFECTED FILES mercurial/repair.py CHANGE DETAILS diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -367,13 +367,10 @@ continue seenfiles.add(f) -i = 'data/%s.i' % f -d = 'data/%s.d' % f - -if repo.store._exists(i): -newentries.add(i) -if repo.store._exists(d): -newentries.add(d) +fl = repo.file(f) +for path in fl.files(): +if repo.store._exists(path): +newentries.add(path) ui.progress(_('rebuilding'), None) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3064: tests: disable tests for advanced clone features with simple store
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY There are a handful of test failures in the simple store with regards to stream clones. Fixing them will require a lot of conditional output. Disabling the tests wholesale is easier at this juncture. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3064 AFFECTED FILES tests/test-clone-uncompressed.t tests/test-clonebundles.t tests/test-http-bundle1.t tests/test-http.t tests/test-ssh-bundle1.t tests/test-ssh.t tests/test-stream-bundle-v2.t CHANGE DETAILS diff --git a/tests/test-stream-bundle-v2.t b/tests/test-stream-bundle-v2.t --- a/tests/test-stream-bundle-v2.t +++ b/tests/test-stream-bundle-v2.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Test creating a consuming stream bundle v2 $ getmainid() { diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -56,6 +56,8 @@ clone remote via stream +#if no-reposimplestore + $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream streaming all changes 4 files to transfer, 602 bytes of data @@ -92,6 +94,8 @@ $ cd .. $ rm -rf local-stream stream2 +#endif + clone remote via pull $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local @@ -530,9 +534,9 @@ Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio - Got arguments 1:user@dummy 2:hg -R remote serve --stdio - Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !) + Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !) + Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !) Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R local serve --stdio diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -66,6 +66,8 @@ clone remote via stream +#if no-reposimplestore + $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream streaming all changes 4 files to transfer, 602 bytes of data @@ -102,6 +104,8 @@ $ cd .. $ rm -rf local-stream stream2 +#endif + clone remote via pull $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local @@ -499,9 +503,9 @@ Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio - Got arguments 1:user@dummy 2:hg -R remote serve --stdio - Got arguments 1:user@dummy 2:hg -R remote serve --stdio + Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !) + Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !) + Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !) Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R local serve --stdio diff --git a/tests/test-http.t b/tests/test-http.t --- a/tests/test-http.t +++ b/tests/test-http.t @@ -26,6 +26,7 @@ clone via stream +#if no-reposimplestore $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1 streaming all changes 6 files to transfer, 606 bytes of data @@ -40,6 +41,7 @@ crosschecking files in changesets and manifests checking files 4 files, 1 changesets, 4 total revisions +#endif try to clone via stream, should use pull instead @@ -213,14 +215,18 @@ 5fed3813f7f5 $ hg id http://user@localhost:$HGPORT2/ 5fed3813f7f5 + +#if no-reposimplestore $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1 streaming all changes 7 files to transfer, 916 bytes of data transferred * bytes in * seconds (*/sec) (glob) searching for changes no changes found updating to branch default 5 files updated, 0 files merged, 0 files removed, 0 files unresolved +#endif + --pull should override server's preferuncompressed $ hg clone --pull http://user:pass@localhost:$HGPORT2/ dest-pull 2>&1 requesting all changes @@ -239,16 +245,16 @@ abort: HTTP Error 403: no [255] - $ hg -R dest tag -r tip top - $ hg -R dest push http://user:pass@localhost:$HGPORT2/ + $ hg -R dest-pull tag -r tip top + $ hg -R dest-pull push http://user:pass@localhost:$HGPORT2/
D3066: tests: teach test-fncache.t about the simple store
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Despite the size, this is pretty straightforward. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3066 AFFECTED FILES tests/test-fncache.t CHANGE DETAILS diff --git a/tests/test-fncache.t b/tests/test-fncache.t --- a/tests/test-fncache.t +++ b/tests/test-fncache.t @@ -7,7 +7,9 @@ adding a $ hg ci -m first $ cat .hg/store/fncache | sort - data/a.i + data/a.i (reporevlogstore !) + data/a/f62022d3d590043fa311a6f49c238b13c9d12709 (reposimplestore !) + data/a/index (reposimplestore !) Testing a.i/b: @@ -17,8 +19,12 @@ adding a.i/b $ hg ci -m second $ cat .hg/store/fncache | sort - data/a.i - data/a.i.hg/b.i + data/a.i (reporevlogstore !) + data/a.i.hg/b.i (reporevlogstore !) + data/a.i.hg/b/87213410d500fe45662db2a54f759a46c27192bb (reposimplestore !) + data/a.i.hg/b/index (reposimplestore !) + data/a/f62022d3d590043fa311a6f49c238b13c9d12709 (reposimplestore !) + data/a/index (reposimplestore !) Testing a.i.hg/c: @@ -28,9 +34,15 @@ adding a.i.hg/c $ hg ci -m third $ cat .hg/store/fncache | sort - data/a.i - data/a.i.hg.hg/c.i - data/a.i.hg/b.i + data/a.i (reporevlogstore !) + data/a.i.hg.hg/c.i (reporevlogstore !) + data/a.i.hg/b.i (reporevlogstore !) + data/a.i.hg.hg/c/d81723aa78f2dd2d77884d165313984fcc9e5893 (reposimplestore !) + data/a.i.hg.hg/c/index (reposimplestore !) + data/a.i.hg/b/87213410d500fe45662db2a54f759a46c27192bb (reposimplestore !) + data/a.i.hg/b/index (reposimplestore !) + data/a/f62022d3d590043fa311a6f49c238b13c9d12709 (reposimplestore !) + data/a/index (reposimplestore !) Testing verify: @@ -48,20 +60,34 @@ checking manifests crosschecking files in changesets and manifests checking files - warning: revlog 'data/a.i' not in fncache! - warning: revlog 'data/a.i.hg/c.i' not in fncache! - warning: revlog 'data/a.i/b.i' not in fncache! + warning: revlog 'data/a.i' not in fncache! (reporevlogstore !) + warning: revlog 'data/a.i.hg/c.i' not in fncache! (reporevlogstore !) + warning: revlog 'data/a.i/b.i' not in fncache! (reporevlogstore !) + warning: revlog 'data/a/f62022d3d590043fa311a6f49c238b13c9d12709' not in fncache! (reposimplestore !) + warning: revlog 'data/a/index' not in fncache! (reposimplestore !) + warning: revlog 'data/a.i.hg/c/index' not in fncache! (reposimplestore !) + warning: revlog 'data/a.i.hg/c/d81723aa78f2dd2d77884d165313984fcc9e5893' not in fncache! (reposimplestore !) + warning: revlog 'data/a.i/b/87213410d500fe45662db2a54f759a46c27192bb' not in fncache! (reposimplestore !) + warning: revlog 'data/a.i/b/index' not in fncache! (reposimplestore !) 3 files, 3 changesets, 3 total revisions - 3 warnings encountered! + 3 warnings encountered! (reporevlogstore !) + 6 warnings encountered! (reposimplestore !) hint: run "hg debugrebuildfncache" to recover from corrupt fncache Follow the hint to make sure it works $ hg debugrebuildfncache - adding data/a.i - adding data/a.i.hg/c.i - adding data/a.i/b.i - 3 items added, 0 removed from fncache + adding data/a.i (reporevlogstore !) + adding data/a.i.hg/c.i (reporevlogstore !) + adding data/a.i/b.i (reporevlogstore !) + adding data/a.i.hg/c/d81723aa78f2dd2d77884d165313984fcc9e5893 (reposimplestore !) + adding data/a.i.hg/c/index (reposimplestore !) + adding data/a.i/b/87213410d500fe45662db2a54f759a46c27192bb (reposimplestore !) + adding data/a.i/b/index (reposimplestore !) + adding data/a/f62022d3d590043fa311a6f49c238b13c9d12709 (reposimplestore !) + adding data/a/index (reposimplestore !) + 3 items added, 0 removed from fncache (reporevlogstore !) + 6 items added, 0 removed from fncache (reposimplestore !) $ hg verify checking changesets @@ -90,7 +116,10 @@ .hg/cache/rbc-revs-v1 .hg/data .hg/data/tst.d.hg - .hg/data/tst.d.hg/foo.i + .hg/data/tst.d.hg/foo.i (reporevlogstore !) + .hg/data/tst.d.hg/foo (reposimplestore !) + .hg/data/tst.d.hg/foo/2ed2a3912a0b24502043eae84ee4b279c18b90dd (reposimplestore !) + .hg/data/tst.d.hg/foo/index (reposimplestore !) .hg/dirstate .hg/fsmonitor.state (fsmonitor !) .hg/last-message.txt @@ -130,7 +159,10 @@ .hg/store/00manifest.i .hg/store/data .hg/store/data/tst.d.hg - .hg/store/data/tst.d.hg/_foo.i + .hg/store/data/tst.d.hg/_foo.i (reporevlogstore !) + .hg/store/data/tst.d.hg/_foo (reposimplestore !) + .hg/store/data/tst.d.hg/_foo/2ed2a3912a0b24502043eae84ee4b279c18b90dd (reposimplestore !) + .hg/store/data/tst.d.hg/_foo/index (reposimplestore !) .hg/store/phaseroots .hg/store/undo .hg/store/undo.backupfiles @@ -194,11 +226,11 @@ $ find .hg/store -name *.i | sort .hg/store/00changelog.i .hg/store/00manifest.i - .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i -
D3058: bundlerepo: use super() when calling file()
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We should be calling the default method, not reimplementing it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3058 AFFECTED FILES mercurial/bundlerepo.py CHANGE DETAILS diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -420,7 +420,7 @@ linkmapper = self.unfiltered().changelog.rev return bundlefilelog(self.svfs, f, self._cgunpacker, linkmapper) else: -return filelog.filelog(self.svfs, f) +return super(bundlerepository, self).file(f) def close(self): """Close assigned bundle file immediately.""" To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3057: tests: remove superfluous config setting
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY format.usegeneraldelta defaults to true. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3057 AFFECTED FILES tests/test-bundle-type.t tests/test-bundle.t tests/test-clonebundles.t tests/test-commit-amend.t tests/test-copy.t tests/test-debugcommands.t tests/test-hgweb-commands.t tests/test-init.t tests/test-lfconvert.t tests/test-patchbomb.t tests/test-rebase-conflicts.t tests/test-rebase-mq-skip.t tests/test-rebase-newancestor.t tests/test-ssh-bundle1.t tests/test-ssh.t tests/test-strip.t tests/test-treemanifest.t CHANGE DETAILS diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -1,8 +1,6 @@ #require killdaemons $ cat << EOF >> $HGRCPATH - > [format] - > usegeneraldelta=yes > [ui] > ssh=$PYTHON "$TESTDIR/dummyssh" > EOF diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -1,5 +1,3 @@ - $ echo "[format]" >> $HGRCPATH - $ echo "usegeneraldelta=yes" >> $HGRCPATH $ echo "[extensions]" >> $HGRCPATH $ echo "strip=" >> $HGRCPATH $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -10,11 +10,6 @@ This test tries to exercise the ssh functionality with a dummy script - $ cat <> $HGRCPATH - > [format] - > usegeneraldelta=yes - > EOF - creating 'remote' repo $ hg init remote diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -15,8 +15,6 @@ > [devel] > # This test is dedicated to interaction through old bundle > legacy.exchange = bundle1 - > [format] # temporary settings - > usegeneraldelta=yes > EOF diff --git a/tests/test-rebase-newancestor.t b/tests/test-rebase-newancestor.t --- a/tests/test-rebase-newancestor.t +++ b/tests/test-rebase-newancestor.t @@ -1,6 +1,4 @@ $ cat >> $HGRCPATH < [format] - > usegeneraldelta=yes > [extensions] > rebase= > drawdag=$TESTDIR/drawdag.py diff --git a/tests/test-rebase-mq-skip.t b/tests/test-rebase-mq-skip.t --- a/tests/test-rebase-mq-skip.t +++ b/tests/test-rebase-mq-skip.t @@ -2,8 +2,6 @@ already has one local mq patch $ cat >> $HGRCPATH < [format] - > usegeneraldelta=yes > [extensions] > rebase= > mq= diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts.t +++ b/tests/test-rebase-conflicts.t @@ -1,6 +1,4 @@ $ cat >> $HGRCPATH < [format] - > usegeneraldelta=yes > [extensions] > rebase= > drawdag=$TESTDIR/drawdag.py diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -24,8 +24,6 @@ > print(l, end='') > EOF $ FILTERBOUNDARY="$PYTHON `pwd`/prune-blank-after-boundary.py" - $ echo "[format]" >> $HGRCPATH - $ echo "usegeneraldelta=yes" >> $HGRCPATH $ echo "[extensions]" >> $HGRCPATH $ echo "patchbomb=" >> $HGRCPATH diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t --- a/tests/test-lfconvert.t +++ b/tests/test-lfconvert.t @@ -1,8 +1,6 @@ $ USERCACHE="$TESTTMP/cache"; export USERCACHE $ mkdir "${USERCACHE}" $ cat >> $HGRCPATH < [format] - > usegeneraldelta=yes > [extensions] > largefiles = > share = diff --git a/tests/test-init.t b/tests/test-init.t --- a/tests/test-init.t +++ b/tests/test-init.t @@ -1,12 +1,5 @@ This test tries to exercise the ssh functionality with a dummy script -(enable general delta early) - - $ cat << EOF >> $HGRCPATH - > [format] - > usegeneraldelta=yes - > EOF - $ checknewrepo() > { >name=$1 diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t +++ b/tests/test-hgweb-commands.t @@ -6,11 +6,6 @@ - unbundle, tested in test-push-http - changegroupsubset, tested in test-pull - $ cat << EOF >> $HGRCPATH - > [format] - > usegeneraldelta=yes - > EOF - Set up the repo $ hg init test diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -1,8 +1,6 @@ $ cat << EOF >> $HGRCPATH > [ui] > interactive=yes - > [format] - > usegeneraldelta=yes > EOF $ hg init debugrevlog diff --git a/tests/test-copy.t b/tests/test-copy.t --- a/tests/test-copy.t +++ b/tests/test-copy.t @@ -1,10 +1,3 @@ -# enable bundle2 in advance - - $ cat << EOF >> $HGRCPATH - > [format] - > usegeneraldelta=yes - > EOF - $ mkdir part1 $ cd part1 diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -1,8 +1,3 @@ - $ cat << EOF >> $HGRCPATH - > [format] -
D3062: tests: disable infinitepush tests for simple store
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Infinitepush relies heavily on bundles and bundlerepo. As such, it won't be easy to make compatible with alternate storage backends at this time. Let's disable the tests when running with our simple store. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3062 AFFECTED FILES tests/test-infinitepush-bundlestore.t tests/test-infinitepush-ci.t tests/test-infinitepush.t CHANGE DETAILS diff --git a/tests/test-infinitepush.t b/tests/test-infinitepush.t --- a/tests/test-infinitepush.t +++ b/tests/test-infinitepush.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Testing infinipush extension and the confi options provided by it Setup diff --git a/tests/test-infinitepush-ci.t b/tests/test-infinitepush-ci.t --- a/tests/test-infinitepush-ci.t +++ b/tests/test-infinitepush-ci.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Testing the case when there is no infinitepush extension present on the client side and the server routes each push to bundlestore. This case is very much similar to CI use case. diff --git a/tests/test-infinitepush-bundlestore.t b/tests/test-infinitepush-bundlestore.t --- a/tests/test-infinitepush-bundlestore.t +++ b/tests/test-infinitepush-bundlestore.t @@ -1,3 +1,4 @@ +#require no-reposimplestore Create an ondisk bundlestore in .hg/scratchbranches $ . "$TESTDIR/library-infinitepush.sh" To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3063: tests: skip largefiles and lfs tests when using simple store
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Getting these tests to pass is more work than it is worth right now. Let's punt on it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3063 AFFECTED FILES tests/test-largefiles-cache.t tests/test-largefiles-misc.t tests/test-largefiles-small-disk.t tests/test-largefiles-update.t tests/test-largefiles-wireproto.t tests/test-largefiles.t tests/test-lfconvert.t tests/test-lfs-bundle.t tests/test-lfs-largefiles.t tests/test-lfs-serve-access.t tests/test-lfs-serve.t tests/test-lfs-test-server.t tests/test-lfs.t CHANGE DETAILS diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + # Initial setup $ cat >> $HGRCPATH << EOF diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t --- a/tests/test-lfs-test-server.t +++ b/tests/test-lfs-test-server.t @@ -1,3 +1,4 @@ +#require no-reposimplestore #testcases git-server hg-server #if git-server diff --git a/tests/test-lfs-serve.t b/tests/test-lfs-serve.t --- a/tests/test-lfs-serve.t +++ b/tests/test-lfs-serve.t @@ -1,5 +1,5 @@ #testcases lfsremote-on lfsremote-off -#require serve +#require serve no-reposimplestore This test splits `hg serve` with and without using the extension into separate tests cases. The tests are broken down as follows, where "LFS"/"No-LFS" diff --git a/tests/test-lfs-serve-access.t b/tests/test-lfs-serve-access.t --- a/tests/test-lfs-serve-access.t +++ b/tests/test-lfs-serve-access.t @@ -1,4 +1,4 @@ -#require serve +#require serve no-reposimplestore $ cat >> $HGRCPATH < [extensions] diff --git a/tests/test-lfs-largefiles.t b/tests/test-lfs-largefiles.t --- a/tests/test-lfs-largefiles.t +++ b/tests/test-lfs-largefiles.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + This tests the interaction between the largefiles and lfs extensions, and conversion from largefiles -> lfs. diff --git a/tests/test-lfs-bundle.t b/tests/test-lfs-bundle.t --- a/tests/test-lfs-bundle.t +++ b/tests/test-lfs-bundle.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + In this test, we want to test LFS bundle application on both LFS and non-LFS repos. diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t --- a/tests/test-lfconvert.t +++ b/tests/test-lfconvert.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + $ USERCACHE="$TESTTMP/cache"; export USERCACHE $ mkdir "${USERCACHE}" $ cat >> $HGRCPATH < criple.py
D3061: tests: conditionalize test output for simple store
indygreg created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3061 AFFECTED FILES tests/test-clone.t tests/test-convert-hg-source.t tests/test-narrow.t CHANGE DETAILS diff --git a/tests/test-narrow.t b/tests/test-narrow.t --- a/tests/test-narrow.t +++ b/tests/test-narrow.t @@ -127,8 +127,12 @@ The following changeset(s) or their ancestors have local changes not on the remote: * (glob) saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d0/f.i + deleting data/d0/f.i (reporevlogstore !) + deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) + deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) + deleting data/d0/f/index (reposimplestore !) deleting meta/d0/00manifest.i (tree !) + $ hg log -T "{node|short}: {desc} {outsidenarrow}\n" *: local change to d3 (glob) *: add d10/f outsidenarrow (glob) @@ -154,8 +158,12 @@ searching for changes looking for local changes to affected paths saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d0/f.i + deleting data/d0/f.i (reporevlogstore !) + deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) + deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) + deleting data/d0/f/index (reposimplestore !) deleting meta/d0/00manifest.i (tree !) + Updates off of stripped commit if necessary $ hg co -r 'desc("local change to d3")' -q $ echo local change >> d6/f @@ -169,7 +177,10 @@ * (glob) 2 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d3/f.i + deleting data/d3/f.i (reporevlogstore !) + deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) + deleting data/d3/f/99fa7136105a15e2045ce3d9152e4837c5349e4d (reposimplestore !) + deleting data/d3/f/index (reposimplestore !) deleting meta/d3/00manifest.i (tree !) $ hg log -T '{desc}\n' -r . add d10/f @@ -189,7 +200,10 @@ * (glob) 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d3/f.i + deleting data/d3/f.i (reporevlogstore !) + deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) + deleting data/d3/f/5ce0767945cbdbca3b924bb9fbf5143f72ab40ac (reposimplestore !) + deleting data/d3/f/index (reposimplestore !) deleting meta/d3/00manifest.i (tree !) $ hg id @@ -209,7 +223,9 @@ comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths - deleting data/d0/f.i + deleting data/d0/f.i (reporevlogstore !) + deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) + deleting data/d0/f/index (reposimplestore !) deleting meta/d0/00manifest.i (tree !) $ hg tracked $ hg files @@ -265,7 +281,9 @@ comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths - deleting data/d6/f.i + deleting data/d6/f.i (reporevlogstore !) + deleting data/d6/f/7339d30678f451ac8c3f38753beeb4cf2e1655c7 (reposimplestore !) + deleting data/d6/f/index (reposimplestore !) deleting meta/d6/00manifest.i (tree !) $ hg tracked I path:d0 @@ -285,7 +303,7 @@ comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths - deleting data/d3/f.i + deleting data/d3/f.i (reporevlogstore !) $ hg tracked I path:d0 I path:d3 @@ -303,7 +321,7 @@ comparing with ssh://user@dummy/master searching for changes looking for local changes to affected paths - deleting data/d0/f.i + deleting data/d0/f.i (reporevlogstore !) deleting meta/d0/00manifest.i (tree !) $ hg tracked I path:d3 diff --git a/tests/test-convert-hg-source.t b/tests/test-convert-hg-source.t --- a/tests/test-convert-hg-source.t +++ b/tests/test-convert-hg-source.t @@ -169,7 +169,12 @@ break it +#if reporevlogstore $ rm .hg/store/data/b.* +#endif +#if reposimplestore + $ rm .hg/store/data/b/* +#endif $ cd .. $ hg --config convert.hg.ignoreerrors=True convert broken fixed initializing destination fixed repository diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -94,7 +94,18 @@ linking: 6 linking: 7 linking: 8 - linked 8 files + linked 8 files (reporevlogstore !) + linking: 9 (reposimplestore !) + linking: 10 (reposimplestore !) + linking: 11 (reposimplestore !) + linking: 12 (reposimplestore !) + linking: 13
D3059: tests: use `hg unbundle` instead of `hg pull` in some tests
indygreg created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY `hg pull ` uses the special "bundlerepo" repository. The bundlerepo code makes many assumptions about the storage of repositories. It will be difficult to teach bundlerepo to use non-revlog storage before a better storage interface is established. Many test failures using our "simple store" are related to bundlerepo: the simple store just isn't compatible with bundlerepo because of storage assumptions in bundlerepo. In order to mitigate the impact of bundlerepo on our code base, this commit changes various tests to use `hg unbundle` instead of `hg pull`. This bypasses the bundlerepo code. Tests exercising exchange functionality have not been altered, as they should be using `hg pull` and going through the bundlerepo code paths. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3059 AFFECTED FILES tests/test-branches.t tests/test-bundle-type.t tests/test-keyword.t tests/test-merge-symlinks.t tests/test-narrow-strip.t tests/test-rebase-conflicts.t tests/test-strip.t tests/test-treemanifest.t CHANGE DETAILS diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -334,9 +334,7 @@ date:Thu Jan 01 00:00:00 1970 + summary: modify dir1/a - $ hg pull .hg/strip-backup/* - pulling from .hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg - searching for changes + $ hg unbundle .hg/strip-backup/* adding changesets adding manifests adding file changes diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -215,13 +215,11 @@ cache:rev-branch-cache -- {} phase-heads -- {} 264128213d290d868c54642d13aeaa3675551a78 draft - $ hg pull .hg/strip-backup/* - pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg - searching for changes + $ hg unbundle .hg/strip-backup/* adding changesets adding manifests adding file changes - added 1 changesets with 0 changes to 0 files (+1 heads) + added 1 changesets with 0 changes to 1 files (+1 heads) new changesets 264128213d29 (run 'hg heads' to see heads, 'hg merge' to merge) $ rm .hg/strip-backup/* @@ -1108,9 +1106,7 @@ summary: commitA - $ hg pull -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg - pulling from $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg - searching for changes + $ hg unbundle -u $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg adding changesets adding manifests adding file changes diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts.t +++ b/tests/test-rebase-conflicts.t @@ -148,16 +148,17 @@ Check that the right ancestors is used while rebasing a merge (issue4041) - $ hg clone "$TESTDIR/bundles/issue4041.hg" issue4041 - requesting all changes + $ hg init issue4041 + $ cd issue4041 + $ hg unbundle "$TESTDIR/bundles/issue4041.hg" adding changesets adding manifests adding file changes added 11 changesets with 8 changes to 3 files (+1 heads) new changesets 24797d4f68de:2f2496ddf49d - updating to branch default + (run 'hg heads' to see heads) + $ hg up default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd issue4041 $ hg log -G ochangeset: 10:2f2496ddf49d |\ branch: f1 diff --git a/tests/test-narrow-strip.t b/tests/test-narrow-strip.t --- a/tests/test-narrow-strip.t +++ b/tests/test-narrow-strip.t @@ -116,9 +116,7 @@ $ hg strip . 1 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob) - $ hg pull .hg/strip-backup/*-backup.hg - pulling from .hg/strip-backup/*-backup.hg (glob) - searching for changes + $ hg unbundle .hg/strip-backup/*-backup.hg adding changesets adding manifests adding file changes @@ -152,9 +150,7 @@ date:Thu Jan 01 00:00:00 1970 + summary: modify inside - $ hg pull .hg/strip-backup/*-backup.hg - pulling from .hg/strip-backup/*-backup.hg (glob) - requesting all changes + $ hg unbundle .hg/strip-backup/*-backup.hg adding changesets adding manifests adding file changes diff --git a/tests/test-merge-symlinks.t b/tests/test-merge-symlinks.t --- a/tests/test-merge-symlinks.t +++ b/tests/test-merge-symlinks.t @@ -31,7 +31,7 @@ $ hg init t $ cd t - $ hg -q pull "$TESTDIR/bundles/test-merge-symlinks.hg" + $ hg -q unbundle "$TESTDIR/bundles/test-merge-symlinks.hg" $ hg up -C 3 3 files updated, 0 files merged, 0 files removed, 0 files unresolved diff --git a/tests/test-keyword.t b/tests/test-keyword.t ---
D3056: tests: disable test-revlog-v2 when using simple store
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Because the simple store has nothing to do with revlogs. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3056 AFFECTED FILES tests/test-revlog-v2.t CHANGE DETAILS diff --git a/tests/test-revlog-v2.t b/tests/test-revlog-v2.t --- a/tests/test-revlog-v2.t +++ b/tests/test-revlog-v2.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + A repo with unknown revlogv2 requirement string cannot be opened $ hg init invalidreq To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3060: tests: disallow using simple store repo with bundlerepo
indygreg created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY bundlerepo is... going to be difficult to port to an alternate store because it assumes revlogs for storage and essentially overlays the contents of a bundle onto a fake revlog-like primitive. It will be a good test case for our eventual new storage interface. Refactoring bundlerepo to make it work with non-revlog storage is going to be a bit of work. So for now, let's refuse to use the simple store repo when a bundlerepo is in play. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3060 AFFECTED FILES tests/simplestorerepo.py tests/test-manifest.t tests/test-mq-pull-from-bundle.t tests/test-narrow-strip.t tests/test-obsolete.t tests/test-shelve.t tests/test-treemanifest.t CHANGE DETAILS diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -325,6 +325,8 @@ rev linkrev nodeid p1 p2 0 4 064927a0648a 1 5 25ecb8cb8618 + +#if no-reposimplestore $ hg incoming .hg/strip-backup/* comparing with .hg/strip-backup/*-backup.hg (glob) searching for changes @@ -334,6 +336,8 @@ date:Thu Jan 01 00:00:00 1970 + summary: modify dir1/a +#endif + $ hg unbundle .hg/strip-backup/* adding changesets adding manifests diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -771,10 +771,12 @@ $ hg shelve shelved as default 0 files updated, 0 files merged, 1 files removed, 0 files unresolved +#if no-reposimplestore $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' o 4 changes to: commit stuff shelve@localhost | ~ +#endif $ hg log -G --template '{rev} {desc|firstline} {author}' @ 3 commit stuff test | diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -1244,6 +1244,7 @@ o 0:4b34ecfb0d56 (draft) [ ] A +#if no-reposimplestore $ hg incoming ../repo-bundleoverlay --bundle ../bundleoverlay.hg comparing with ../repo-bundleoverlay searching for changes @@ -1256,6 +1257,7 @@ |/ o 0:4b34ecfb0d56 (draft) [ ] A +#endif #if serve diff --git a/tests/test-narrow-strip.t b/tests/test-narrow-strip.t --- a/tests/test-narrow-strip.t +++ b/tests/test-narrow-strip.t @@ -128,6 +128,8 @@ $ hg strip 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob) + +#if no-reposimplestore $ hg incoming .hg/strip-backup/*-backup.hg comparing with .hg/strip-backup/*-backup.hg (glob) changeset: 0:* (glob) @@ -150,6 +152,8 @@ date:Thu Jan 01 00:00:00 1970 + summary: modify inside +#endif + $ hg unbundle .hg/strip-backup/*-backup.hg adding changesets adding manifests diff --git a/tests/test-mq-pull-from-bundle.t b/tests/test-mq-pull-from-bundle.t --- a/tests/test-mq-pull-from-bundle.t +++ b/tests/test-mq-pull-from-bundle.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + $ cat <> $HGRCPATH > [extensions] > mq= diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Source bundle was generated with the following script: # hg init diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -24,6 +24,7 @@ ) from mercurial import ( ancestor, +bundlerepo, error, filelog, mdiff, @@ -587,6 +588,9 @@ if not repo.local(): return +if isinstance(repo, bundlerepo.bundlerepository): +raise error.Abort(_('cannot use simple store with bundlerepo')) + class simplestorerepo(repo.__class__): def file(self, f): return filestorage(self.svfs, f) To: indygreg, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3039: tests: conditionalize tests based on presence of custom extensions
indygreg updated this revision to Diff 7597. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3039?vs=7565=7597 REVISION DETAIL https://phab.mercurial-scm.org/D3039 AFFECTED FILES tests/helpers-testrepo.sh tests/hghave.py tests/run-tests.py tests/test-basic.t tests/test-debugextensions.t tests/test-extension.t tests/test-globalopts.t tests/test-help.t CHANGE DETAILS diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -44,6 +44,10 @@ summary summarize working directory state updateupdate working directory (or switch revisions) +Extra extensions will be printed in help output in a non-reliable order since +the extension is unknown. +#if no-extraextensions + $ hg help Mercurial Distributed SCM @@ -283,6 +287,8 @@ win32mbcs allow the use of MBCS paths with problematic encodings zeroconf discover and advertise repositories on the local network +#endif + Verify that deprecated extensions are included if --verbose: $ hg -v help extensions | grep children @@ -816,6 +822,8 @@ Test that default list of commands omits extension commands +#if no-extraextensions + $ hg help Mercurial Distributed SCM @@ -903,6 +911,7 @@ (use 'hg help -v' to show built-in aliases and global options) +#endif Test list of internal help commands diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -289,6 +289,8 @@ Testing -h/--help: +#if no-extraextensions + $ hg -h Mercurial Distributed SCM @@ -372,8 +374,6 @@ (use 'hg help -v' to show built-in aliases and global options) - - $ hg --help Mercurial Distributed SCM @@ -457,5 +457,7 @@ (use 'hg help -v' to show built-in aliases and global options) +#endif + Not tested: --debugger diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -867,9 +867,11 @@ Show extensions: (note that mq force load strip, also checking it's not loaded twice) +#if no-extraextensions $ hg debugextensions mq strip +#endif For extensions, which name matches one of its commands, help message should ask '-v -e' to get list of built-in aliases diff --git a/tests/test-debugextensions.t b/tests/test-debugextensions.t --- a/tests/test-debugextensions.t +++ b/tests/test-debugextensions.t @@ -1,4 +1,6 @@ +#if no-extraextensions $ hg debugextensions +#endif $ debugpath=`pwd`/extwithoutinfos.py @@ -19,6 +21,10 @@ > ext2 = `pwd`/extwithinfos.py > EOF + $ for extension in $HGTESTEXTRAEXTENSIONS; do + > echo "$extension=!" >> $HGRCPATH + > done + $ hg debugextensions ext1 (untested!) ext2 (3.2.1!) diff --git a/tests/test-basic.t b/tests/test-basic.t --- a/tests/test-basic.t +++ b/tests/test-basic.t @@ -1,5 +1,6 @@ Create a repository: +#if no-extraextensions $ hg config devel.all-warnings=true devel.default-date=0 0 @@ -13,6 +14,8 @@ web.address=localhost web\.ipv6=(?:True|False) (re) web.server-header=testing stub value +#endif + $ hg init t $ cd t diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1070,6 +1070,15 @@ env["HGENCODINGMODE"] = "strict" env['HGIPV6'] = str(int(self._useipv6)) +extraextensions = [] +for opt in self._extraconfigopts: +section, key = opt.encode('utf-8').split(b'.', 1) +name = key.split(b'=', 1)[0] +extraextensions.append(name) + +if extraextensions: +env['HGTESTEXTRAEXTENSIONS'] = b' '.join(extraextensions) + # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw # IP addresses. env['LOCALIP'] = self._localip() diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -718,6 +718,10 @@ except (ImportError, AttributeError): return False +@check('extraextensions', 'whether tests are running with extra extensions') +def has_extraextensions(): +return 'HGTESTEXTRAEXTENSIONS' in os.environ + def getrepofeatures(): """Obtain set of repository features in use. diff --git a/tests/helpers-testrepo.sh b/tests/helpers-testrepo.sh --- a/tests/helpers-testrepo.sh +++ b/tests/helpers-testrepo.sh @@ -9,6 +9,13 @@ # The mercurial source repository was typically orignally cloned with the # system mercurial installation, and may require extensions or settings from # the system installation. + +if [ -n $HGTESTEXTRAEXTENSIONS ]; then +for extension in $HGTESTEXTRAEXTENSIONS; do +extraoptions="$extraoptions --config extensions.$extension=!" +done +fi + syshg () { ( syshgenv @@ -48,6 +55,6 @@ alias testrepohg=syshg alias testrepohgenv=syshgenv else -alias
D3042: tests: skip filelog damage tests when not using revlogs
indygreg updated this revision to Diff 7598. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3042?vs=7568=7598 REVISION DETAIL https://phab.mercurial-scm.org/D3042 AFFECTED FILES tests/test-push.t CHANGE DETAILS diff --git a/tests/test-push.t b/tests/test-push.t --- a/tests/test-push.t +++ b/tests/test-push.t @@ -173,6 +173,8 @@ updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved +#if reporevlogstore + Test spurious filelog entries: $ cd test-validation-clone @@ -246,6 +248,8 @@ $ cd .. +#endif + Test push hook locking = To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3055: localrepo: use revsymbol() in lookup()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0a1fb171dc1d: localrepo: use revsymbol() in lookup() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3055?vs=7586=7595 REVISION DETAIL https://phab.mercurial-scm.org/D3055 AFFECTED FILES mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1021,7 +1021,7 @@ pass def lookup(self, key): -return self[key].node() +return scmutil.revsymbol(self, key).node() def lookupbranch(self, key, remote=None): repo = remote or self To: martinvonz, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3055: localrepo: use revsymbol() in lookup()
martinvonz added a comment. In https://phab.mercurial-scm.org/D3055#49290, @indygreg wrote: > `scmutil.revsymbol()` just calls `repo[x]`. So what is your intention here? See https://phab.mercurial-scm.org/D3024, including the discussion with Yuya there. In short, revsymbol will gradually take over responsibility from changectx.__init__ for interpreting strings. > FWIW, we must preserve `repo.lookup('0')` resolving to revision 0 because `share.poolnaming=identity` relies on it. That will continue to work, since '0' is a string. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3055 To: martinvonz, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3052: bisect: avoid repo.lookup() for converting revnum to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe47bd4c71c5e: bisect: avoid repo.lookup() for converting revnum to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3052?vs=7583=7592 REVISION DETAIL https://phab.mercurial-scm.org/D3052 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -805,7 +805,7 @@ # update state if good or bad or skip: if rev: -nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] +nodes = [repo[i].node() for i in scmutil.revrange(repo, [rev])] else: nodes = [repo.lookup('.')] if good: To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3047: push: avoid using repo.lookup() for converting to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4d69668a65d8: push: avoid using repo.lookup() for converting to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3047?vs=7578=7587 REVISION DETAIL https://phab.mercurial-scm.org/D3047 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4148,7 +4148,7 @@ other = hg.peer(repo, opts, dest) if revs: -revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] +revs = [repo[r].node() for r in scmutil.revrange(repo, revs)] if not revs: raise error.Abort(_("specified revisions evaluate to an empty set"), hint=_("use different revision arguments")) To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3048: bundle: avoid repo.lookup() for converting revnum to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0b4692b9646d: bundle: avoid repo.lookup() for converting revnum to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3048?vs=7579=7588 REVISION DETAIL https://phab.mercurial-scm.org/D3048 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1224,8 +1224,8 @@ if dest: raise error.Abort(_("--base is incompatible with specifying " "a destination")) -common = [repo.lookup(rev) for rev in base] -heads = [repo.lookup(r) for r in revs] if revs else None +common = [repo[rev].node() for rev in base] +heads = [repo[r].node() for r in revs] if revs else None outgoing = discovery.outgoing(repo, common, heads) else: dest = ui.expandpath(dest or 'default-push', dest or 'default') To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3054: histedit: avoid repo.lookup() for converting revnum to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8474005fcfe2: histedit: avoid repo.lookup() for converting revnum to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3054?vs=7585=7594 REVISION DETAIL https://phab.mercurial-scm.org/D3054 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -916,7 +916,7 @@ msg = _('there are ambiguous outgoing revisions') hint = _("see 'hg help histedit' for more detail") raise error.Abort(msg, hint=hint) -return repo.lookup(roots[0]) +return repo[roots[0]].node() @command('histedit', [('', 'commands', '', To: martinvonz, durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3053: outgoing: avoid repo.lookup() for converting revnum to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHG70c52800940b: outgoing: avoid repo.lookup() for converting revnum to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3053?vs=7584=7593 REVISION DETAIL https://phab.mercurial-scm.org/D3053 AFFECTED FILES mercurial/hg.py CHANGE DETAILS diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -957,7 +957,7 @@ ui.status(_('comparing with %s\n') % util.hidepassword(dest)) revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) if revs: -revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] +revs = [repo[rev].node() for rev in scmutil.revrange(repo, revs)] other = peer(repo, opts, dest) outgoing = discovery.findcommonoutgoing(repo, other, revs, To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3049: bundle: consistently keep a list of stringified revisions in "revs"
This revision was automatically updated to reflect the committed changes. Closed by commit rHG88a056437061: bundle: consistently keep a list of stringified revisions in revs (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3049?vs=7580=7589 REVISION DETAIL https://phab.mercurial-scm.org/D3049 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1231,6 +1231,7 @@ dest = ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.peer(repo, opts, dest) +revs = [repo[r].hex() for r in revs] revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) heads = revs and map(repo.lookup, revs) or revs outgoing = discovery.findcommonoutgoing(repo, other, To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3051: transplant: avoid repo.lookup() for converting revnum to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2a8939e25d07: transplant: avoid repo.lookup() for converting revnum to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3051?vs=7582=7591 REVISION DETAIL https://phab.mercurial-scm.org/D3051 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -703,16 +703,16 @@ tf = tp.transplantfilter(repo, source, p1) if opts.get('prune'): -prune = set(source.lookup(r) +prune = set(source[r].node() for r in scmutil.revrange(source, opts.get('prune'))) matchfn = lambda x: tf(x) and x not in prune else: matchfn = tf merges = map(source.lookup, opts.get('merge', ())) revmap = {} if revs: for r in scmutil.revrange(source, revs): -revmap[int(r)] = source.lookup(r) +revmap[int(r)] = source[r].node() elif opts.get('all') or not merges: if source != repo: alltransplants = incwalk(source, csets, match=matchfn) To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3050: tests: avoid repo.lookup() for converting revnum to nodeid
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5da299dabdc1: tests: avoid repo.lookup() for converting revnum to nodeid (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3050?vs=7581=7590 REVISION DETAIL https://phab.mercurial-scm.org/D3050 AFFECTED FILES tests/test-bundle2-remote-changegroup.t CHANGE DETAILS diff --git a/tests/test-bundle2-remote-changegroup.t b/tests/test-bundle2-remote-changegroup.t --- a/tests/test-bundle2-remote-changegroup.t +++ b/tests/test-bundle2-remote-changegroup.t @@ -71,8 +71,8 @@ >part.addparam(k, str(v)) > elif verb == 'changegroup': > _common, heads = args.split() - > common.extend(repo.lookup(r) for r in repo.revs(_common)) - > heads = [repo.lookup(r) for r in repo.revs(heads)] + > common.extend(repo[r].node() for r in repo.revs(_common)) + > heads = [repo[r].node() for r in repo.revs(heads)] > outgoing = discovery.outgoing(repo, common, heads) > cg = changegroup.makechangegroup(repo, outgoing, '01', > 'changegroup') To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3055: localrepo: use revsymbol() in lookup()
indygreg added a comment. `scmutil.revsymbol()` just calls `repo[x]`. So what is your intention here? FWIW, we must preserve `repo.lookup('0')` resolving to revision 0 because `share.poolnaming=identity` relies on it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3055 To: martinvonz, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3047: push: avoid using repo.lookup() for converting to nodeid
martinvonz added a comment. In https://phab.mercurial-scm.org/D3047#49274, @indygreg wrote: > I'll likely take this series. But part of me wonders if we should be performing conversion on the changelog instead. I guess it depends on whether the string inputs should resolve names and other things not known to the changelog itself. For converting integer revision numbers to nodes, I would argue we should go through the changelog. > > Anyway, we'll likely have a bikeshed about all of this once we establish a formal interface for the changelog. That's a bit of a ways off, however. These changes seem fine for today. Sure, we can talk about that later :) I think I'm at least moving us closer to that by moving out the handling of user-supplied strings. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3047 To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3047: push: avoid using repo.lookup() for converting to nodeid
indygreg added a comment. I'll likely take this series. But part of me wonders if we should be performing conversion on the changelog instead. I guess it depends on whether the string inputs should resolve names and other things not known to the changelog itself. For converting integer revision numbers to nodes, I would argue we should go through the changelog. Anyway, we'll likely have a bikeshed about all of this once we establish a formal interface for the changelog. That's a bit of a ways off, however. These changes seem fine for today. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3047 To: martinvonz, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5833] New: `hg evolve -aA` with splits and merges can produce ValueError: list.remove(x): x not in list
https://bz.mercurial-scm.org/show_bug.cgi?id=5833 Bug ID: 5833 Summary: `hg evolve -aA` with splits and merges can produce ValueError: list.remove(x): x not in list Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: evolution Assignee: bugzi...@mercurial-scm.org Reporter: h...@pewpew.net CC: mercurial-devel@mercurial-scm.org, pierre-yves.da...@ens-lyon.org Note: this was the bug I was intentionally going to file, but had to file issue5832 first. A user produced this repo and I can't attach it, and I haven't figured out yet how to reproduce it. ≻ hg evo --any --all ** unknown exception encountered, please report by visiting ** http://go/fig-bug ** Python 2.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516] ** Mercurial Distributed SCM (version 4.5.2+1195-a708e1e4d7a8) ** Extensions loaded: histedit, rebase, amend, split, uncommit, backups, morestatus, chistedit, google_hgext, narrowhg, remotefilelog, evolve, blackbox, githelp, hgk, patience, multidiff, pdb_interrupt, extdiff, patchbomb, absorb, graphlog, record, shelve, transplant Traceback (most recent call last): File "/usr/bin/hg", line 41, in dispatch.run() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 88, in run status = (dispatch(req) or 0) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 208, in dispatch ret = _runcatch(req) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 349, in _runcatch return _callcatch(ui, _runcatchfunc) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 357, in _callcatch return scmutil.callcatch(ui, func) File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 154, in callcatch return func() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 339, in _runcatchfunc return _dispatch(req) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 943, in _dispatch cmdpats, cmdoptions) File "/usr/lib/python2.7/dist-packages/remotefilelog/__init__.py", line 440, in runcommand return orig(lui, repo, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 700, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/lib/python2.7/dist-packages/google_hgext/google3/third_party/py/google_hgext/change_numbers.py", line 663, in RunCommand return orig(ui, options, cmd, cmdfunc) File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 951, in _runcommand return cmdfunc() File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 940, in d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1776, in check return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/hgext3rd/evolve/evolvecmd.py", line 1181, in evolve revs = _orderrevs(repo, revs) File "/usr/lib/python2.7/dist-packages/hgext3rd/evolve/evolvecmd.py", line 450, in _orderrevs dependencies[dependent].remove(rev) ValueError: list.remove(x): x not in list Here's some information about the repo, sorry it's not much: ≻ hg x @ 591:85070c0f username tip | desc591 | o 590:a3cf31e4 username |/ desc590 | o 584:0a2bfd84 username | | desc584 (successor of 567) | o 582:cf743e0c username |/ desc582 | *581:15113b6a username orphan | |\ merge +---x 574:bc5d0852 username obsolete (became: 590:a3cf31e4 591:85070c0f) | |desc574 | * 569:93734502 username orphan | | desc569 | x 567:6718c688 username obsolete (became: 584:0a2bfd84) |/ desc567 o 565:cca5f807 base ≻ hg olog -r 574 -a @85070c0f58fe (591) desc591 |\ | | o a3cf31e48e71 (590) desc590 | | | x | | 303ae7d9d4c0 (589) | | |rewritten(content) as 85070c0f58fe using amend by | | | | | x c7147b3a369c (587) | | |rewritten(content) as a3cf31e48e71 using amend by | | | x---+ fad45f54aa13 (588) | |rewritten(parent) as 303ae7d9d4c0 using rebase by / / | x de42d074449e (586) | |rewritten(description, date, parent, content) as c7147b3a369c, fad45f54aa13 using split by | | | x ac75231c8c41 (585) |/ rewritten(content) as de42d074449e using amend by | x bc5d08523521 (574) |rewritten(description, date, content) as 85070c0f58fe by |rewritten(content) as ac75231c8c41 using amend by | x 43ecfd171000 (573) |rewritten(content) as bc5d08523521 using amend by | x 16307908ecb2 (572) |rewritten(content) as 43ecfd171000 using amend by | x b01aa59bb77d (571) |rewritten(parent) as 16307908ecb2 using rebase by | x 48dc7a11320d (570) rewritten(content) as b01aa59bb77d using amend by Running
D3055: localrepo: use revsymbol() in lookup()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY lookup() seems to be about looking up a revision based on a symbol that may come from the user (via the wire protocol), so revsymbol() is appropriate here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3055 AFFECTED FILES mercurial/localrepo.py CHANGE DETAILS diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1021,7 +1021,7 @@ pass def lookup(self, key): -return self[key].node() +return scmutil.revsymbol(self, key).node() def lookupbranch(self, key, remote=None): repo = remote or self To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3052: bisect: avoid repo.lookup() for converting revnum to nodeid
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3052 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -805,7 +805,7 @@ # update state if good or bad or skip: if rev: -nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] +nodes = [repo[i].node() for i in scmutil.revrange(repo, [rev])] else: nodes = [repo.lookup('.')] if good: To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3054: histedit: avoid repo.lookup() for converting revnum to nodeid
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3054 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -916,7 +916,7 @@ msg = _('there are ambiguous outgoing revisions') hint = _("see 'hg help histedit' for more detail") raise error.Abort(msg, hint=hint) -return repo.lookup(roots[0]) +return repo[roots[0]].node() @command('histedit', [('', 'commands', '', To: martinvonz, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3053: outgoing: avoid repo.lookup() for converting revnum to nodeid
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3053 AFFECTED FILES mercurial/hg.py CHANGE DETAILS diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -957,7 +957,7 @@ ui.status(_('comparing with %s\n') % util.hidepassword(dest)) revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) if revs: -revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] +revs = [repo[rev].node() for rev in scmutil.revrange(repo, revs)] other = peer(repo, opts, dest) outgoing = discovery.findcommonoutgoing(repo, other, revs, To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3050: tests: avoid repo.lookup() for converting revnum to nodeid
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3050 AFFECTED FILES tests/test-bundle2-remote-changegroup.t CHANGE DETAILS diff --git a/tests/test-bundle2-remote-changegroup.t b/tests/test-bundle2-remote-changegroup.t --- a/tests/test-bundle2-remote-changegroup.t +++ b/tests/test-bundle2-remote-changegroup.t @@ -71,8 +71,8 @@ >part.addparam(k, str(v)) > elif verb == 'changegroup': > _common, heads = args.split() - > common.extend(repo.lookup(r) for r in repo.revs(_common)) - > heads = [repo.lookup(r) for r in repo.revs(heads)] + > common.extend(repo[r].node() for r in repo.revs(_common)) + > heads = [repo[r].node() for r in repo.revs(heads)] > outgoing = discovery.outgoing(repo, common, heads) > cg = changegroup.makechangegroup(repo, outgoing, '01', > 'changegroup') To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3047: push: avoid using repo.lookup() for converting to nodeid
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY repo.lookup(x) currently simply does repo[x].node(), which supports various types of inputs. As I explained in https://phab.mercurial-scm.org/rHG0194dac77c93912e3073466c440f4f175fc93bc0 (scmutil: add method for looking up a context given a revision symbol, 2018-04-02), I'd like to split that up so we use the new scmutil.revsymbol() for string inputs repo[x] for integer revnums and binary nodeids. Since repo.lookup() seems to exist in order to serve peer.lookup(), I think it should be calling revsymbol. However, we have several callers that use repo.lookup() with something that's not a string, so we need to remove those first. This patch starts doing that. Many more will follow. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3047 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4148,7 +4148,7 @@ other = hg.peer(repo, opts, dest) if revs: -revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] +revs = [repo[r].node() for r in scmutil.revrange(repo, revs)] if not revs: raise error.Abort(_("specified revisions evaluate to an empty set"), hint=_("use different revision arguments")) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3051: transplant: avoid repo.lookup() for converting revnum to nodeid
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3051 AFFECTED FILES hgext/transplant.py CHANGE DETAILS diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -703,16 +703,16 @@ tf = tp.transplantfilter(repo, source, p1) if opts.get('prune'): -prune = set(source.lookup(r) +prune = set(source[r].node() for r in scmutil.revrange(source, opts.get('prune'))) matchfn = lambda x: tf(x) and x not in prune else: matchfn = tf merges = map(source.lookup, opts.get('merge', ())) revmap = {} if revs: for r in scmutil.revrange(source, revs): -revmap[int(r)] = source.lookup(r) +revmap[int(r)] = source[r].node() elif opts.get('all') or not merges: if source != repo: alltransplants = incwalk(source, csets, match=matchfn) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3049: bundle: consistently keep a list of stringified revisions in "revs"
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Before this patch, "revs", in the "not base" branch, would be a list of mixed integral revnums, hex nodeids, and branch names. After this patch, they're all strings. They can still be a mix of hex nodeids and branch names, but the important thing for my future patches is that they're consistently in string form. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3049 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1231,6 +1231,7 @@ dest = ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.peer(repo, opts, dest) +revs = [repo[r].hex() for r in revs] revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) heads = revs and map(repo.lookup, revs) or revs outgoing = discovery.findcommonoutgoing(repo, other, To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3030: tests: conditionalize tests based on presence of revlogs for files
indygreg planned changes to this revision. indygreg added a comment. After porting several more tests, I plan to make some tweaks to this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3030 To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3037: repo: remove now-unused changectx() method (API)
martinvonz added a comment. In https://phab.mercurial-scm.org/D3037#49157, @pulkit wrote: > I know it's pretty obvious to us that repo.__getitem__ should be used instead but I will like to have that in commit description so when we look back, or someone updates their extensions, some time can be saved. Makes sense. Done. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3037 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3046: narrow: move manifestlog overrides to core
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY With this and the previous patch, I couldn't measure any significant difference from `hg files -r .` in a FireFox repo with 65k files. I tried with both a flat-manifest and a tree-manifest version of it. Neither had the narrow extension enabled. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3046 AFFECTED FILES hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1303,6 +1303,9 @@ if node in self._dirmancache.get(dir, ()): return self._dirmancache[dir][node] +if not self._narrowmatch.always(): +if not self._narrowmatch.visitdir(dir[:-1] or '.'): +return excludeddirmanifestctx(dir, node) if dir: if self._revlog._treeondisk: if verify: diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -8,7 +8,6 @@ from __future__ import absolute_import from mercurial import ( - manifest, revlog, util, ) @@ -30,14 +29,6 @@ # load time. pass -def makenarrowmanifestlog(mfl, repo): -class narrowmanifestlog(mfl.__class__): -def get(self, dir, node, verify=True): -if not repo.narrowmatch().visitdir(dir[:-1] or '.'): -return manifest.excludeddirmanifestctx(dir, node) -return super(narrowmanifestlog, self).get(dir, node, verify=verify) -mfl.__class__ = narrowmanifestlog - def makenarrowfilelog(fl, narrowmatch): class narrowfilelog(fl.__class__): def renamed(self, node): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -50,12 +50,6 @@ class narrowrepository(repo.__class__): -@cacheprop('00manifest.i') -def manifestlog(self): -mfl = super(narrowrepository, self).manifestlog -narrowrevlog.makenarrowmanifestlog(mfl, self) -return mfl - def file(self, f): fl = super(narrowrepository, self).file(f) narrowrevlog.makenarrowfilelog(fl, self.narrowmatch()) To: martinvonz, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3044: narrow: move excludeddir and related classes to core
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3044 AFFECTED FILES hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1569,3 +1569,80 @@ def find(self, key): return self.read().find(key) + +class excludeddir(treemanifest): +"""Stand-in for a directory that is excluded from the repository. + +With narrowing active on a repository that uses treemanifests, +some of the directory revlogs will be excluded from the resulting +clone. This is a huge storage win for clients, but means we need +some sort of pseudo-manifest to surface to internals so we can +detect a merge conflict outside the narrowspec. That's what this +class is: it stands in for a directory whose node is known, but +whose contents are unknown. +""" +def __init__(self, dir, node): +super(excludeddir, self).__init__(dir) +self._node = node +# Add an empty file, which will be included by iterators and such, +# appearing as the directory itself (i.e. something like "dir/") +self._files[''] = node +self._flags[''] = 't' + +# Manifests outside the narrowspec should never be modified, so avoid +# copying. This makes a noticeable difference when there are very many +# directories outside the narrowspec. Also, it makes sense for the copy to +# be of the same type as the original, which would not happen with the +# super type's copy(). +def copy(self): +return self + +class excludeddirmanifestctx(treemanifestctx): +"""context wrapper for excludeddir - see that docstring for rationale""" +def __init__(self, dir, node): +self._dir = dir +self._node = node + +def read(self): +return excludeddir(self._dir, self._node) + +def write(self, *args): +raise error.ProgrammingError( +'attempt to write manifest from excluded dir %s' % self._dir) + +class excludedmanifestrevlog(manifestrevlog): +"""Stand-in for excluded treemanifest revlogs. + +When narrowing is active on a treemanifest repository, we'll have +references to directories we can't see due to the revlog being +skipped. This class exists to conform to the manifestrevlog +interface for those directories and proactively prevent writes to +outside the narrowspec. +""" + +def __init__(self, dir): +self._dir = dir + +def __len__(self): +raise error.ProgrammingError( +'attempt to get length of excluded dir %s' % self._dir) + +def rev(self, node): +raise error.ProgrammingError( +'attempt to get rev from excluded dir %s' % self._dir) + +def linkrev(self, node): +raise error.ProgrammingError( +'attempt to get linkrev from excluded dir %s' % self._dir) + +def node(self, rev): +raise error.ProgrammingError( +'attempt to get node from excluded dir %s' % self._dir) + +def add(self, *args, **kwargs): +# We should never write entries in dirlogs outside the narrow clone. +# However, the method still gets called from writesubtree() in +# _addtree(), so we need to handle it. We should possibly make that +# avoid calling add() with a clean manifest (_dirty is always False +# in excludeddir instances). +pass diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -8,7 +8,6 @@ from __future__ import absolute_import from mercurial import ( - error, manifest, revlog, util, @@ -31,83 +30,6 @@ # load time. pass -class excludeddir(manifest.treemanifest): -"""Stand-in for a directory that is excluded from the repository. - -With narrowing active on a repository that uses treemanifests, -some of the directory revlogs will be excluded from the resulting -clone. This is a huge storage win for clients, but means we need -some sort of pseudo-manifest to surface to internals so we can -detect a merge conflict outside the narrowspec. That's what this -class is: it stands in for a directory whose node is known, but -whose contents are unknown. -""" -def __init__(self, dir, node): -super(excludeddir, self).__init__(dir) -self._node = node -# Add an empty file, which will be included by iterators and such, -# appearing as the directory itself (i.e. something like "dir/") -self._files[''] = node -self._flags[''] = 't' - -# Manifests outside the narrowspec should never be modified, so avoid -# copying. This makes a noticeable difference
D3045: narrow: move manifestrevlog overrides to core
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3045 AFFECTED FILES hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1279,6 +1279,7 @@ self._treeinmem = usetreemanifest self._revlog = repo._constructmanifest() +self._narrowmatch = repo.narrowmatch() # A cache of the manifestctx or treemanifestctx for each directory self._dirmancache = {} @@ -1477,6 +1478,10 @@ #self.linkrev = revlog.linkrev(rev) def _revlog(self): +narrowmatch = self._manifestlog._narrowmatch +if not narrowmatch.always(): +if not narrowmatch.visitdir(self._dir[:-1] or '.'): +return excludedmanifestrevlog(self._dir) return self._manifestlog._revlog.dirlog(self._dir) def read(self): diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -30,24 +30,6 @@ # load time. pass -def makenarrowmanifestrevlog(mfrevlog, repo): -if util.safehasattr(mfrevlog, '_narrowed'): -return - -class narrowmanifestrevlog(mfrevlog.__class__): -# This function is called via debug{revlog,index,data}, but also during -# at least some push operations. This will be used to wrap/exclude the -# child directories when using treemanifests. -def dirlog(self, d): -if not repo.narrowmatch().visitdir(d[:-1] or '.'): -return manifest.excludedmanifestrevlog(d) -result = super(narrowmanifestrevlog, self).dirlog(d) -makenarrowmanifestrevlog(result, repo) -return result - -mfrevlog.__class__ = narrowmanifestrevlog -mfrevlog._narrowed = True - def makenarrowmanifestlog(mfl, repo): class narrowmanifestlog(mfl.__class__): def get(self, dir, node, verify=True): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -50,11 +50,6 @@ class narrowrepository(repo.__class__): -def _constructmanifest(self): -manifest = super(narrowrepository, self)._constructmanifest() -narrowrevlog.makenarrowmanifestrevlog(manifest, repo) -return manifest - @cacheprop('00manifest.i') def manifestlog(self): mfl = super(narrowrepository, self).manifestlog To: martinvonz, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] addremove: pass command-level similarity value down to scmutil.addremove()
On Tue, Apr 3, 2018 at 9:09 PM, Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1522761890 -32400 > # Tue Apr 03 22:24:50 2018 +0900 > # Node ID c118bb7c938ae92ffdfbab5ea977f1c029c87599 > # Parent 6ff8bd691fb8fd25a4e16ead04d13bcf7101e549 > addremove: pass command-level similarity value down to scmutil.addremove() > > Since we've changed to carry a similarity value by opts dict, it makes sense > to leave a string '0'-'100' value unmodified. Queued this. Many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3037: repo: remove now-unused changectx() method (API)
pulkit added a comment. I know it's pretty obvious to us that repo.__getitem__ should be used instead but I will like to have that in commit description so when we look back, or someone updates their extensions, some time can be saved. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3037 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@37182: 26 new changesets
26 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/888507ec655e changeset: 37157:888507ec655e parent: 37155:fb7140f1d09d user:Yuya Nishiharadate:Sat Mar 17 20:00:54 2018 +0900 summary: templateutil: move flatten() from templater https://www.mercurial-scm.org/repo/hg/rev/e09d2183e226 changeset: 37158:e09d2183e226 user:Yuya Nishihara date:Sat Mar 17 20:04:20 2018 +0900 summary: templateutil: reimplement stringify() using flatten() https://www.mercurial-scm.org/repo/hg/rev/b56b79185aad changeset: 37159:b56b79185aad user:Yuya Nishihara date:Sat Mar 17 20:13:06 2018 +0900 summary: templater: do not use stringify() to concatenate flattened template output https://www.mercurial-scm.org/repo/hg/rev/53e6b7e05553 changeset: 37160:53e6b7e05553 user:Yuya Nishihara date:Fri Mar 23 20:23:55 2018 +0900 summary: templater: drop bool support from evalastype() https://www.mercurial-scm.org/repo/hg/rev/0023da2910c9 changeset: 37161:0023da2910c9 user:Yuya Nishihara date:Fri Mar 23 21:03:21 2018 +0900 summary: templater: extract type conversion from evalfuncarg() https://www.mercurial-scm.org/repo/hg/rev/9ab3491f84c2 changeset: 37162:9ab3491f84c2 user:Yuya Nishihara date:Fri Mar 23 20:34:12 2018 +0900 summary: templater: extract unwrapinteger() function from evalinteger() https://www.mercurial-scm.org/repo/hg/rev/0fb28899e81a changeset: 37163:0fb28899e81a user:Yuya Nishihara date:Fri Mar 23 20:43:55 2018 +0900 summary: templater: factor out unwrapastype() from evalastype() https://www.mercurial-scm.org/repo/hg/rev/b229fd9adeae changeset: 37164:b229fd9adeae user:Boris Feld date:Fri Mar 30 12:43:08 2018 +0200 summary: bundlespec: introduce an attr-based class for bundlespec https://www.mercurial-scm.org/repo/hg/rev/6c7a6b04b274 changeset: 37165:6c7a6b04b274 user:Boris Feld date:Fri Mar 30 12:43:57 2018 +0200 summary: bundlespec: move computing the bundle contentops in parsebundlespec https://www.mercurial-scm.org/repo/hg/rev/568e9b928c4c changeset: 37166:568e9b928c4c user:Boris Feld date:Wed Jan 31 10:55:15 2018 +0100 summary: streambundlev2: add a new test-file https://www.mercurial-scm.org/repo/hg/rev/6f467adf9f05 changeset: 37167:6f467adf9f05 user:Boris Feld date:Wed Jan 31 11:09:20 2018 +0100 summary: bundle: add the possibility to bundle a stream v2 part https://www.mercurial-scm.org/repo/hg/rev/a2b350d9f6ae changeset: 37168:a2b350d9f6ae user:Boris Feld date:Wed Jan 31 11:10:55 2018 +0100 summary: bundlespec: add support for some variants https://www.mercurial-scm.org/repo/hg/rev/99f28a4b2a3a changeset: 37169:99f28a4b2a3a user:Boris Feld date:Wed Jan 31 11:44:33 2018 +0100 summary: streamclonebundle: add a test for stream clone bundle v2 https://www.mercurial-scm.org/repo/hg/rev/b837655c1509 changeset: 37170:b837655c1509 user:Boris Feld date:Wed Jan 31 17:15:44 2018 +0100 summary: streamclonebundle: make sure we accept new stream clone bundle spec https://www.mercurial-scm.org/repo/hg/rev/d7f3fdab94c4 changeset: 37171:d7f3fdab94c4 user:Martin von Zweigbergk date:Thu Mar 29 21:15:40 2018 -0700 summary: context: remove unwanted assignments in basectx.__new__() (API) https://www.mercurial-scm.org/repo/hg/rev/daef13da66fe changeset: 37172:daef13da66fe user:Martin von Zweigbergk date:Thu Mar 29 21:29:15 2018 -0700 summary: context: avoid using a context object as a changeid https://www.mercurial-scm.org/repo/hg/rev/05ff1a155a21 changeset: 37173:05ff1a155a21 user:Martin von Zweigbergk date:Thu Mar 29 22:22:51 2018 -0700 summary: memctx: create parent contexts using "repo[p]" syntax https://www.mercurial-scm.org/repo/hg/rev/bb47dc2f71a0 changeset: 37174:bb47dc2f71a0 user:Martin von Zweigbergk date:Thu Mar 29 22:51:45 2018 -0700 summary: context: move reuse of context object to repo.__getitem__ (API) https://www.mercurial-scm.org/repo/hg/rev/fbe34945220d changeset: 37175:fbe34945220d user:Martin von Zweigbergk date:Thu Mar 29 23:05:41 2018 -0700 summary: context: set repo property in basectx https://www.mercurial-scm.org/repo/hg/rev/943d77fc07a3 changeset: 37176:943d77fc07a3 user:Gregory Szorc date:Wed Mar 21 19:48:50 2018 -0700
D3036: tests: remove dependence on repo.changectx()
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfeced1629f48: tests: remove dependence on repo.changectx() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3036?vs=7541=7573 REVISION DETAIL https://phab.mercurial-scm.org/D3036 AFFECTED FILES tests/test-context.py CHANGE DETAILS diff --git a/tests/test-context.py b/tests/test-context.py --- a/tests/test-context.py +++ b/tests/test-context.py @@ -52,7 +52,7 @@ data += 'bar\n' return context.memfilectx(repo, memctx, f, data, 'l' in flags, 'x' in flags) -ctxa = repo.changectx(0) +ctxa = repo[0] ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"], getfilectx, ctxa.user(), ctxa.date()) To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3035: log: remove dependence on repo.changectx()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8823615f68a5: log: remove dependence on repo.changectx() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3035?vs=7540=7572 REVISION DETAIL https://phab.mercurial-scm.org/D3035 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1839,7 +1839,7 @@ wanted = set() slowpath = match.anypats() or (not match.always() and opts.get('removed')) fncache = {} -change = repo.changectx +change = repo.__getitem__ # First step is to fill wanted, the set of revisions that we want to yield. # When it does not induce extra cost, we also fill fncache for revisions in To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3034: verify: remove dependence on repo.changectx()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG00f18dd1d3d6: verify: remove dependence on repo.changectx() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3034?vs=7539=7571 REVISION DETAIL https://phab.mercurial-scm.org/D3034 AFFECTED FILES mercurial/verify.py CHANGE DETAILS diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -47,7 +47,7 @@ self.havecl = len(repo.changelog) > 0 self.havemf = len(repo.manifestlog._revlog) > 0 self.revlogv1 = repo.changelog.version != revlog.REVLOGV0 -self.lrugetctx = util.lrucachefunc(repo.changectx) +self.lrugetctx = util.lrucachefunc(repo.__getitem__) self.refersmf = False self.fncachewarned = False # developer config: verify.skipflags To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3033: bookmarks: switch from repo.changectx('.') to repo['.']
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa494cccb673e: bookmarks: switch from repo.changectx(.) to repo[.] (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3033?vs=7538=7570 REVISION DETAIL https://phab.mercurial-scm.org/D3033 AFFECTED FILES mercurial/bookmarks.py CHANGE DETAILS diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -204,7 +204,7 @@ If divergent bookmark are to be deleted, they will be returned as list. """ -cur = self._repo.changectx('.').node() +cur = self._repo['.'].node() if mark in self and not force: if target: if self[mark] == target and target == cur: @@ -818,7 +818,7 @@ Raises an abort error if old is not in the bookmark store. """ marks = repo._bookmarks -cur = repo.changectx('.').node() +cur = repo['.'].node() newact = None changes = [] hiddenrev = None To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3039: tests: conditionalize tests based on presence of custom extensions
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The test harness supports injecting extensions via --extra-config-opt. However, if you do this, various tests that print state about loaded extensions fail. This commit teaches the test harness to recognize when custom extensions are loaded so that tests can use feature sniffing to conditionalize tests based on that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3039 AFFECTED FILES tests/helpers-testrepo.sh tests/hghave.py tests/run-tests.py tests/test-basic.t tests/test-debugextensions.t tests/test-extension.t tests/test-globalopts.t tests/test-help.t CHANGE DETAILS diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -44,6 +44,10 @@ summary summarize working directory state updateupdate working directory (or switch revisions) +Extra extensions will be printed in help output in a non-reliable order since +the extension is unknown. +#if no-extraextensions + $ hg help Mercurial Distributed SCM @@ -283,6 +287,8 @@ win32mbcs allow the use of MBCS paths with problematic encodings zeroconf discover and advertise repositories on the local network +#endif + Verify that deprecated extensions are included if --verbose: $ hg -v help extensions | grep children @@ -816,6 +822,8 @@ Test that default list of commands omits extension commands +#if no-extraextensions + $ hg help Mercurial Distributed SCM @@ -903,6 +911,7 @@ (use 'hg help -v' to show built-in aliases and global options) +#endif Test list of internal help commands diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -289,6 +289,8 @@ Testing -h/--help: +#if no-extraextensions + $ hg -h Mercurial Distributed SCM @@ -372,8 +374,6 @@ (use 'hg help -v' to show built-in aliases and global options) - - $ hg --help Mercurial Distributed SCM @@ -457,5 +457,7 @@ (use 'hg help -v' to show built-in aliases and global options) +#endif + Not tested: --debugger diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -867,9 +867,11 @@ Show extensions: (note that mq force load strip, also checking it's not loaded twice) +#if no-extraextensions $ hg debugextensions mq strip +#endif For extensions, which name matches one of its commands, help message should ask '-v -e' to get list of built-in aliases diff --git a/tests/test-debugextensions.t b/tests/test-debugextensions.t --- a/tests/test-debugextensions.t +++ b/tests/test-debugextensions.t @@ -1,4 +1,6 @@ +#if no-extraextensions $ hg debugextensions +#endif $ debugpath=`pwd`/extwithoutinfos.py @@ -19,6 +21,10 @@ > ext2 = `pwd`/extwithinfos.py > EOF + $ for extension in $HGTESTEXTRAEXTENSIONS; do + > echo "$extension=!" >> $HGRCPATH + > done + $ hg debugextensions ext1 (untested!) ext2 (3.2.1!) diff --git a/tests/test-basic.t b/tests/test-basic.t --- a/tests/test-basic.t +++ b/tests/test-basic.t @@ -1,5 +1,6 @@ Create a repository: +#if no-extraextensions $ hg config devel.all-warnings=true devel.default-date=0 0 @@ -13,6 +14,8 @@ web.address=localhost web\.ipv6=(?:True|False) (re) web.server-header=testing stub value +#endif + $ hg init t $ cd t diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1070,6 +1070,15 @@ env["HGENCODINGMODE"] = "strict" env['HGIPV6'] = str(int(self._useipv6)) +extraextensions = [] +for opt in self._extraconfigopts: +section, key = opt.encode('utf-8').split(b'.', 1) +name = key.split(b'=', 1)[0] +extraextensions.append(name) + +if extraextensions: +env['HGTESTEXTRAEXTENSIONS'] = b' '.join(extraextensions) + # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw # IP addresses. env['LOCALIP'] = self._localip() diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -718,6 +718,10 @@ except (ImportError, AttributeError): return False +@check('extraextensions', 'whether tests are running with extra extensions') +def has_extraextensions(): +return 'HGTESTEXTRAEXTENSIONS' in os.environ + def getrepofeatures(): """Obtain set of repository features in use. diff --git a/tests/helpers-testrepo.sh b/tests/helpers-testrepo.sh --- a/tests/helpers-testrepo.sh +++ b/tests/helpers-testrepo.sh @@ -9,6 +9,13 @@ # The mercurial source repository was typically orignally cloned with the # system mercurial installation, and may require extensions or settings from #
D3030: tests: conditionalize tests based on presence of revlogs for files
indygreg updated this revision to Diff 7564. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3030?vs=7531=7564 REVISION DETAIL https://phab.mercurial-scm.org/D3030 AFFECTED FILES tests/hghave.py tests/simplestorerepo.py tests/test-clone.t tests/test-contrib-perf.t tests/test-convert.t tests/test-copy.t tests/test-hardlinks.t tests/test-http-proxy.t tests/test-push-warn.t tests/test-relink.t tests/test-strip.t tests/test-subrepo-deep-nested-change.t tests/test-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + $ cat >> $HGRCPATH << EOF > [extensions] > share = diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t --- a/tests/test-subrepo-deep-nested-change.t +++ b/tests/test-subrepo-deep-nested-change.t @@ -34,6 +34,7 @@ linking [<=>] 4\r (no-eol) (esc) linking [ <=> ] 5\r (no-eol) (esc) linking [ <=> ] 6\r (no-eol) (esc) + linking [ <=> ] 7\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) updating [===>] 1/1\r (no-eol) (esc) @@ -60,6 +61,9 @@ linking [ <=> ] 6\r (no-eol) (esc) linking [ <=> ] 7\r (no-eol) (esc) linking [<=>] 8\r (no-eol) (esc) + linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !) + linking [ <=>] 11\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) updating [===>] 3/3\r (no-eol) (esc) @@ -71,6 +75,7 @@ linking [<=>] 4\r (no-eol) (esc) linking [ <=> ] 5\r (no-eol) (esc) linking [ <=> ] 6\r (no-eol) (esc) + linking [ <=> ] 7\r (no-eol) (esc) (reposimplestore !) updating [===>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) updating to branch default @@ -161,6 +166,9 @@ linking [ <=> ] 6\r (no-eol) (esc) linking [ <=> ] 7\r (no-eol) (esc) linking [<=>] 8\r (no-eol) (esc) + linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !) + linking [ <=>] 11\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) updating [===>] 3/3\r (no-eol) (esc) @@ -174,15 +182,25 @@ linking [ <=> ] 6\r (no-eol) (esc) linking [ <=> ] 7\r (no-eol) (esc) linking [<=>] 8\r (no-eol) (esc) + linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !) + linking [ <=>] 11\r (no-eol) (esc) (reposimplestore !) updating [===>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) - linking [ <=> ] 1\r (no-eol) (esc) - linking [ <=> ] 2\r (no-eol) (esc) - linking [ <=> ] 3\r (no-eol) (esc) - linking [<=>] 4\r (no-eol) (esc) - linking [ <=> ] 5\r (no-eol) (esc) - linking [ <=> ] 6\r (no-eol) (esc) + linking [ <=> ] 1\r (no-eol) (esc) (no-reposimplestore !) + linking [ <=> ] 2\r (no-eol) (esc)
D3043: narrow: pass node into revlog.revision()
indygreg created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is one of the few (possibly only) places where we pass an int in for filelogs. Other revlogs (notably changelog) are very heavy on int usage. But filelogs are surprisingly node centric. I'd like to formalize the interface around the use of nodes (at least for filelogs). So let's switch to a node. We can't inline revlog.node() because of a check-code rule. I think that rule is suspect. But it may be for performance reasons with changelog code. I'd rather not touch it at this time. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3043 AFFECTED FILES hgext/narrow/narrowchangegroup.py CHANGE DETAILS diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -350,8 +350,9 @@ p2 = node.nullrev else: p1, p2 = sorted(local(p) for p in linkparents) +n = revlog.node(rev) yield ellipsisdata( -self, rev, revlog, p1, p2, revlog.revision(rev), linknode) +self, rev, revlog, p1, p2, revlog.revision(n), linknode) extensions.wrapfunction(changegroup.cg1packer, 'revchunk', revchunk) def deltaparent(orig, self, revlog, rev, p1, p2, prev): To: indygreg, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3040: tests: skip some tests when using simple store
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY generaldelta is a revlog implementation detail. We don't need to test it with the simple store. union repos are heavily revlog based. It should be possible to run them with alternate stores. But it's not worth the trouble at this juncture. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3040 AFFECTED FILES tests/test-generaldelta.t tests/test-unionrepo.t CHANGE DETAILS diff --git a/tests/test-unionrepo.t b/tests/test-unionrepo.t --- a/tests/test-unionrepo.t +++ b/tests/test-unionrepo.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Test unionrepo functionality Create one repository diff --git a/tests/test-generaldelta.t b/tests/test-generaldelta.t --- a/tests/test-generaldelta.t +++ b/tests/test-generaldelta.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Check whether size of generaldelta revlog is not bigger than its regular equivalent. Test would fail if generaldelta was naive implementation of parentdelta: third manifest revision would be fully To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3029: tests: add test extension implementing custom filelog storage
indygreg updated this revision to Diff 7563. indygreg edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3029?vs=7530=7563 REVISION DETAIL https://phab.mercurial-scm.org/D3029 AFFECTED FILES tests/simplestorerepo.py CHANGE DETAILS diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py new file mode 100644 --- /dev/null +++ b/tests/simplestorerepo.py @@ -0,0 +1,589 @@ +# simplestorerepo.py - Extension that swaps in alternate repository storage. +# +# Copyright 2018 Gregory Szorc+# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +from __future__ import absolute_import + +from mercurial.i18n import _ +from mercurial.node import ( +bin, +hex, +nullid, +nullrev, +) +from mercurial.thirdparty import ( +cbor, +) +from mercurial import ( +ancestor, +error, +filelog, +mdiff, +pycompat, +revlog, +) + +# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for +# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should +# be specifying the version(s) of Mercurial they are tested with, or +# leave the attribute unspecified. +testedwith = 'ships-with-hg-core' + +def validatenode(node): +if isinstance(node, int): +raise ValueError('expected node; got int') + +if len(node) != 20: +raise ValueError('expected 20 byte node') + +def validaterev(rev): +if not isinstance(rev, int): +raise ValueError('expected int') + +class filestorage(object): +"""Implements storage for a tracked path. + +Data is stored in the VFS in a directory corresponding to the tracked +path. + +Index data is stored in an ``index`` file using CBOR. + +Fulltext data is stored in files having names of the node. +""" + +def __init__(self, svfs, path): +self._svfs = svfs +self._path = path + +self._storepath = b'/'.join([b'data', path]) +self._indexpath = b'/'.join([self._storepath, b'index']) + +indexdata = self._svfs.tryread(self._indexpath) +if indexdata: +indexdata = cbor.loads(indexdata) + +self._indexdata = indexdata or [] +self._indexbynode = {} +self._indexbyrev = {} +self.index = [] +self._refreshindex() + +# This is used by changegroup code :/ +self._generaldelta = True +self.storedeltachains = False + +self.version = 1 + +def _refreshindex(self): +self._indexbynode.clear() +self._indexbyrev.clear() +self.index = [] + +for i, entry in enumerate(self._indexdata): +self._indexbynode[entry[b'node']] = entry +self._indexbyrev[i] = entry + +self._indexbynode[nullid] = { +b'node': nullid, +b'p1': nullid, +b'p2': nullid, +b'linkrev': nullrev, +b'flags': 0, +} + +self._indexbyrev[nullrev] = { +b'node': nullid, +b'p1': nullid, +b'p2': nullid, +b'linkrev': nullrev, +b'flags': 0, +} + +for i, entry in enumerate(self._indexdata): +p1rev, p2rev = self.parentrevs(self.rev(entry[b'node'])) + +# start, length, rawsize, chainbase, linkrev, p1, p2, node +self.index.append((0, 0, 0, -1, entry[b'linkrev'], p1rev, p2rev, + entry[b'node'])) + +self.index.append((0, 0, 0, -1, -1, -1, -1, nullid)) + +def __len__(self): +return len(self._indexdata) + +def __iter__(self): +return iter(range(len(self))) + +def revs(self, start=0, stop=None): +step = 1 +if stop is not None: +if start > stop: +step = -1 + +stop += step +else: +stop = len(self) + +return range(start, stop, step) + +def parents(self, node): +validatenode(node) + +if node not in self._indexbynode: +raise KeyError('unknown node') + +entry = self._indexbynode[node] + +return entry[b'p1'], entry[b'p2'] + +def parentrevs(self, rev): +p1, p2 = self.parents(self._indexbyrev[rev][b'node']) +return self.rev(p1), self.rev(p2) + +def rev(self, node): +validatenode(node) + +# Will raise KeyError. +self._indexbynode[node] + +for rev, entry in self._indexbyrev.items(): +if entry[b'node'] == node: +return rev + +raise error.ProgrammingError('this should not occur') + +def node(self, rev): +validaterev(rev) + +return self._indexbyrev[rev][b'node'] + +def lookup(self, node): +if isinstance(node, int): +return self.node(node) + +if len(node) == 20: +try:
D3038: setup: add overlooked hgext.infinitepush package declaration
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Will fix infinitepush tests that have been failing when run without --local. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3038 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -816,7 +816,9 @@ 'mercurial.thirdparty.zope.interface', 'mercurial.utils', 'hgext', 'hgext.convert', 'hgext.fsmonitor', -'hgext.fsmonitor.pywatchman', 'hgext.highlight', +'hgext.fsmonitor.pywatchman', +'hgext.infinitepush', +'hgext.highlight', 'hgext.largefiles', 'hgext.lfs', 'hgext.narrow', 'hgext.zeroconf', 'hgext3rd', 'hgdemandimport'] To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@37156: new changeset (1 on stable)
New changeset (1 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/7de7bd407251 changeset: 37156:7de7bd407251 branch: stable tag: tip parent: 36981:177f3b90335f user:Matt Harbisondate:Sun Apr 01 01:27:18 2018 -0400 summary: server: ensure the incoming request falls under the prefix value -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2987: stringutil: add function to pretty print an object
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2f859ad7ed8c: stringutil: add function to pretty print an object (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2987?vs=7450=7561 REVISION DETAIL https://phab.mercurial-scm.org/D2987 AFFECTED FILES mercurial/debugcommands.py mercurial/utils/stringutil.py tests/test-http-protocol.t tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -1345,7 +1345,7 @@ o> bookmarks \n o> namespaces\n o> phases - response: bookmarks \nnamespaces\nphases + response: b'bookmarks\nnamespaces\nphases' testing ssh2 creating ssh peer from handshake results @@ -1376,7 +1376,7 @@ o> bookmarks \n o> namespaces\n o> phases - response: bookmarks \nnamespaces\nphases + response: b'bookmarks\nnamespaces\nphases' $ cd .. @@ -1421,7 +1421,7 @@ i> flush() -> None o> bufferedreadline() -> 2: o> 0\n - response: + response: b'' testing ssh2 creating ssh peer from handshake results @@ -1448,7 +1448,7 @@ i> flush() -> None o> bufferedreadline() -> 2: o> 0\n - response: + response: b'' With a single bookmark set @@ -1483,7 +1483,7 @@ o> bufferedreadline() -> 3: o> 46\n o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f - response: bookA 68986213bd4485ea51533535e3fc9e78007a711f + response: b'bookA68986213bd4485ea51533535e3fc9e78007a711f' testing ssh2 creating ssh peer from handshake results @@ -1511,7 +1511,7 @@ o> bufferedreadline() -> 3: o> 46\n o> bufferedread(46) -> 46: bookA 68986213bd4485ea51533535e3fc9e78007a711f - response: bookA 68986213bd4485ea51533535e3fc9e78007a711f + response: b'bookA68986213bd4485ea51533535e3fc9e78007a711f' With multiple bookmarks set @@ -1548,7 +1548,7 @@ o> bufferedread(93) -> 93: o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d - response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d + response: b'bookA68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d' testing ssh2 creating ssh peer from handshake results @@ -1578,7 +1578,7 @@ o> bufferedread(93) -> 93: o> bookA 68986213bd4485ea51533535e3fc9e78007a711f\n o> bookB 1880f3755e2e52e3199e0ee5638128b08642f34d - response: bookA 68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d + response: b'bookA68986213bd4485ea51533535e3fc9e78007a711f\nbookB 1880f3755e2e52e3199e0ee5638128b08642f34d' Test pushkey for bookmarks @@ -1624,7 +1624,7 @@ o> 2\n o> bufferedread(2) -> 2: o> 1\n - response: 1\n + response: b'1\n' testing ssh2 creating ssh peer from handshake results @@ -1661,7 +1661,7 @@ o> 2\n o> bufferedread(2) -> 2: o> 1\n - response: 1\n + response: b'1\n' $ hg bookmarks bookA 0:68986213bd44 @@ -1707,7 +1707,7 @@ o> bufferedreadline() -> 3: o> 15\n o> bufferedread(15) -> 15: publishingTrue - response: publishing True + response: b'publishing True' testing ssh2 creating ssh peer from handshake results @@ -1735,7 +1735,7 @@ o> bufferedreadline() -> 3: o> 15\n o> bufferedread(15) -> 15: publishingTrue - response: publishing True + response: b'publishing True' Create some commits @@ -1789,7 +1789,7 @@ o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n o> c4750011d906c18ea2f0527419cbc1a544435150 1\n o> publishingTrue - response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True + response: b'20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True' testing ssh2 creating ssh peer from handshake results @@ -1820,7 +1820,7 @@ o> 20b8a89289d80036e6c4e87c2083e3bea1586637 1\n o> c4750011d906c18ea2f0527419cbc1a544435150 1\n o> publishingTrue - response: 20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True + response: b'20b8a89289d80036e6c4e87c2083e3bea1586637 1\nc4750011d906c18ea2f0527419cbc1a544435150 1\npublishing True' Single draft head @@ -1857,7 +1857,7 @@ o> bufferedread(58) -> 58: o> c4750011d906c18ea2f0527419cbc1a544435150 1\n o> publishingTrue - response: c4750011d906c18ea2f0527419cbc1a544435150
D2987: stringutil: add function to pretty print an object
durin42 added inline comments. INLINE COMMENTS > indygreg wrote in stringutil.py:39 > Because of differences with `b''` in Python 3 :/ ï˜ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2987 To: indygreg, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2987: stringutil: add function to pretty print an object
indygreg added inline comments. INLINE COMMENTS > durin42 wrote in stringutil.py:39 > Why this instead of pprint.pformat? Because of differences with `b''` in Python 3 :/ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2987 To: indygreg, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2985: wireproto: implement custom __repr__ for frame
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5ef2da00e935: wireproto: implement custom __repr__ for frame (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2985?vs=7448=7559 REVISION DETAIL https://phab.mercurial-scm.org/D2985 AFFECTED FILES mercurial/wireprotoframing.py CHANGE DETAILS diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -106,6 +106,15 @@ ARGUMENT_RECORD_HEADER = struct.Struct(r'
D3028: debugcommands: drop offset and length from debugindex by default
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd4e62df1c73d: debugcommands: drop offset and length from debugindex by default (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3028?vs=7529=7546 REVISION DETAIL https://phab.mercurial-scm.org/D3028 AFFECTED FILES mercurial/debugcommands.py tests/test-changelog-exec.t tests/test-clone-r.t tests/test-commit-amend.t tests/test-commit.t tests/test-copy.t tests/test-debugcommands.t tests/test-excessive-merge.t tests/test-extra-filelog-entry.t tests/test-filebranch.t tests/test-flags.t tests/test-issue522.t tests/test-merge-commit.t tests/test-merge7.t tests/test-narrow-debugcommands.t tests/test-narrow-update.t tests/test-parseindex.t tests/test-rename-merge1.t tests/test-revlog-packentry.t tests/test-revlog.t tests/test-strip-cross.t tests/test-treemanifest.t CHANGE DETAILS diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -139,13 +139,13 @@ $ cat dir1/b 6 $ hg debugindex --dir dir1 - revoffset length linkrev nodeid p1 p2 - 0 0 54 1 8b3ffd73f901 - 154 68 2 68e9d057c5a8 8b3ffd73f901 - 2 122 12 4 4698198d2624 68e9d057c5a8 - 3 134 55 5 44844058ccce 68e9d057c5a8 - 4 189 55 6 bf3d9b744927 68e9d057c5a8 - 5 244 55 7 dde7c0af2a03 bf3d9b744927 44844058ccce + rev linkrev nodeid p1 p2 + 0 1 8b3ffd73f901 + 1 2 68e9d057c5a8 8b3ffd73f901 + 2 4 4698198d2624 68e9d057c5a8 + 3 5 44844058ccce 68e9d057c5a8 + 4 6 bf3d9b744927 68e9d057c5a8 + 5 7 dde7c0af2a03 bf3d9b744927 44844058ccce Merge keeping directory from parent 1 does not create revlog entry. (Note that dir1's manifest does change, but only because dir1/a's filelog changes.) @@ -285,13 +285,13 @@ Parent of tree root manifest should be flat manifest, and two for merge $ hg debugindex -m - revoffset length linkrev nodeid p1 p2 - 0 0 80 0 40536115ed9e - 180 83 1 f3376063c255 40536115ed9e - 2 163 89 2 5d9b9da231a2 40536115ed9e - 3 252 83 3 d17d663cbd8a 5d9b9da231a2 f3376063c255 - 4 335 124 4 51e32a8c60ee f3376063c255 - 5 459 126 5 cc5baa78b230 5d9b9da231a2 f3376063c255 + rev linkrev nodeid p1 p2 + 0 0 40536115ed9e + 1 1 f3376063c255 40536115ed9e + 2 2 5d9b9da231a2 40536115ed9e + 3 3 d17d663cbd8a 5d9b9da231a2 f3376063c255 + 4 4 51e32a8c60ee f3376063c255 + 5 5 cc5baa78b230 5d9b9da231a2 f3376063c255 Status across flat/tree boundary should work @@ -305,16 +305,16 @@ Turning off treemanifest config has no effect $ hg debugindex --dir dir1 - revoffset length linkrev nodeid p1 p2 - 0 0 127 4 064927a0648a - 1 127 111 5 25ecb8cb8618 + rev linkrev nodeid p1 p2 + 0 4 064927a0648a + 1 5 25ecb8cb8618 $ echo 2 > dir1/a $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a' $ hg debugindex --dir dir1 - revoffset length linkrev nodeid p1 p2 - 0 0 127 4 064927a0648a - 1 127 111 5 25ecb8cb8618 - 2 238 55 6 5b16163a30c6 25ecb8cb8618 + rev linkrev nodeid p1 p2 + 0 4 064927a0648a + 1 5 25ecb8cb8618 + 2 6 5b16163a30c6 25ecb8cb8618 Stripping and recovering changes should work @@ -324,9 +324,9 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg $ hg debugindex --dir dir1 - revoffset length linkrev nodeid p1 p2 - 0 0 127 4 064927a0648a - 1 127 111 5 25ecb8cb8618 + rev linkrev nodeid p1 p2 + 0 4
D2984: keepalive: implement readinto()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG97eedbd5a56c: keepalive: implement readinto() (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2984?vs=7447=7558 REVISION DETAIL https://phab.mercurial-scm.org/D2984 AFFECTED FILES mercurial/keepalive.py CHANGE DETAILS diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -349,7 +349,7 @@ class HTTPResponse(httplib.HTTPResponse): # we need to subclass HTTPResponse in order to -# 1) add readline() and readlines() methods +# 1) add readline(), readlines(), and readinto() methods # 2) add close_connection() methods # 3) add info() and geturl() methods @@ -522,6 +522,14 @@ break return list +def readinto(self, dest): +res = self.read(len(dest)) +if not res: +return 0 + +dest[0:len(res)] = res +return len(res) + def safesend(self, str): """Send `str' to the server. To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2983: wireproto: port protocol handler to zope.interface
This revision was automatically updated to reflect the committed changes. Closed by commit rHG78103e4138b1: wireproto: port protocol handler to zope.interface (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2983?vs=7446=7556 REVISION DETAIL https://phab.mercurial-scm.org/D2983 AFFECTED FILES mercurial/wireprotoserver.py mercurial/wireprototypes.py tests/test-check-interfaces.py CHANGE DETAILS diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py --- a/tests/test-check-interfaces.py +++ b/tests/test-check-interfaces.py @@ -19,6 +19,8 @@ statichttprepo, ui as uimod, unionrepo, +wireprotoserver, +wireprototypes, ) rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) @@ -122,4 +124,23 @@ repo = localrepo.localrepository(ui, rootdir) checkzobject(repo) +ziverify.verifyClass(wireprototypes.baseprotocolhandler, + wireprotoserver.sshv1protocolhandler) +ziverify.verifyClass(wireprototypes.baseprotocolhandler, + wireprotoserver.sshv2protocolhandler) +ziverify.verifyClass(wireprototypes.baseprotocolhandler, + wireprotoserver.httpv1protocolhandler) +ziverify.verifyClass(wireprototypes.baseprotocolhandler, + wireprotoserver.httpv2protocolhandler) + +sshv1 = wireprotoserver.sshv1protocolhandler(None, None, None) +checkzobject(sshv1) +sshv2 = wireprotoserver.sshv2protocolhandler(None, None, None) +checkzobject(sshv2) + +httpv1 = wireprotoserver.httpv1protocolhandler(None, None, None) +checkzobject(httpv1) +httpv2 = wireprotoserver.httpv2protocolhandler(None, None) +checkzobject(httpv2) + main() diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -5,7 +5,9 @@ from __future__ import absolute_import -import abc +from .thirdparty.zope import ( +interface as zi, +) # Names of the SSH protocol implementations. SSHV1 = 'ssh-v1' @@ -95,39 +97,33 @@ def __init__(self, gen=None): self.gen = gen -class baseprotocolhandler(object): +class baseprotocolhandler(zi.Interface): """Abstract base class for wire protocol handlers. A wire protocol handler serves as an interface between protocol command handlers and the wire protocol transport layer. Protocol handlers provide methods to read command arguments, redirect stdio for the duration of the request, handle response types, etc. """ -__metaclass__ = abc.ABCMeta - -@abc.abstractproperty -def name(self): +name = zi.Attribute( """The name of the protocol implementation. Used for uniquely identifying the transport type. -""" +""") -@abc.abstractmethod -def getargs(self, args): +def getargs(args): """return the value for arguments in returns a list of values (same order as )""" -@abc.abstractmethod -def forwardpayload(self, fp): +def forwardpayload(fp): """Read the raw payload and forward to a file. The payload is read in full before the function returns. """ -@abc.abstractmethod -def mayberedirectstdio(self): +def mayberedirectstdio(): """Context manager to possibly redirect stdio. The context manager yields a file-object like object that receives @@ -140,21 +136,18 @@ won't be captured. """ -@abc.abstractmethod -def client(self): +def client(): """Returns a string representation of this client (as bytes).""" -@abc.abstractmethod -def addcapabilities(self, repo, caps): +def addcapabilities(repo, caps): """Adds advertised capabilities specific to this protocol. Receives the list of capabilities collected so far. Returns a list of capabilities. The passed in argument can be returned. """ -@abc.abstractmethod -def checkperm(self, perm): +def checkperm(perm): """Validate that the client has permissions to perform a request. The argument is the permission required to proceed. If the client diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -12,6 +12,9 @@ import threading from .i18n import _ +from .thirdparty.zope import ( +interface as zi, +) from . import ( encoding, error, @@ -58,7 +61,8 @@ return ''.join(chunks) -class httpv1protocolhandler(wireprototypes.baseprotocolhandler): +@zi.implementer(wireprototypes.baseprotocolhandler) +class httpv1protocolhandler(object): def __init__(self, req, ui, checkperm): self._req = req self._ui = ui @@ -574,7 +578,8 @@ }, } -class
D3027: debugcommands: drop base revision from debugindex
This revision was automatically updated to reflect the committed changes. Closed by commit rHG009d0283de5f: debugcommands: drop base revision from debugindex (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3027?vs=7528=7545 REVISION DETAIL https://phab.mercurial-scm.org/D3027 AFFECTED FILES mercurial/debugcommands.py tests/test-changelog-exec.t tests/test-clone-r.t tests/test-commit-amend.t tests/test-commit.t tests/test-copy.t tests/test-debugcommands.t tests/test-excessive-merge.t tests/test-extra-filelog-entry.t tests/test-filebranch.t tests/test-flags.t tests/test-issue522.t tests/test-merge-commit.t tests/test-merge7.t tests/test-narrow-debugcommands.t tests/test-narrow-update.t tests/test-parseindex.t tests/test-rename-merge1.t tests/test-revlog-packentry.t tests/test-revlog.t tests/test-strip-cross.t tests/test-treemanifest.t CHANGE DETAILS diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -139,13 +139,13 @@ $ cat dir1/b 6 $ hg debugindex --dir dir1 - revoffset length delta linkrev nodeid p1 p2 - 0 0 54 -1 1 8b3ffd73f901 - 154 68 0 2 68e9d057c5a8 8b3ffd73f901 - 2 122 12 1 4 4698198d2624 68e9d057c5a8 - 3 134 55 1 5 44844058ccce 68e9d057c5a8 - 4 189 55 1 6 bf3d9b744927 68e9d057c5a8 - 5 244 55 4 7 dde7c0af2a03 bf3d9b744927 44844058ccce + revoffset length linkrev nodeid p1 p2 + 0 0 54 1 8b3ffd73f901 + 154 68 2 68e9d057c5a8 8b3ffd73f901 + 2 122 12 4 4698198d2624 68e9d057c5a8 + 3 134 55 5 44844058ccce 68e9d057c5a8 + 4 189 55 6 bf3d9b744927 68e9d057c5a8 + 5 244 55 7 dde7c0af2a03 bf3d9b744927 44844058ccce Merge keeping directory from parent 1 does not create revlog entry. (Note that dir1's manifest does change, but only because dir1/a's filelog changes.) @@ -285,13 +285,13 @@ Parent of tree root manifest should be flat manifest, and two for merge $ hg debugindex -m - revoffset length delta linkrev nodeid p1 p2 - 0 0 80 -1 0 40536115ed9e - 180 83 0 1 f3376063c255 40536115ed9e - 2 163 89 0 2 5d9b9da231a2 40536115ed9e - 3 252 83 2 3 d17d663cbd8a 5d9b9da231a2 f3376063c255 - 4 335 124 1 4 51e32a8c60ee f3376063c255 - 5 459 126 2 5 cc5baa78b230 5d9b9da231a2 f3376063c255 + revoffset length linkrev nodeid p1 p2 + 0 0 80 0 40536115ed9e + 180 83 1 f3376063c255 40536115ed9e + 2 163 89 2 5d9b9da231a2 40536115ed9e + 3 252 83 3 d17d663cbd8a 5d9b9da231a2 f3376063c255 + 4 335 124 4 51e32a8c60ee f3376063c255 + 5 459 126 5 cc5baa78b230 5d9b9da231a2 f3376063c255 Status across flat/tree boundary should work @@ -305,16 +305,16 @@ Turning off treemanifest config has no effect $ hg debugindex --dir dir1 - revoffset length delta linkrev nodeid p1 p2 - 0 0 127 -1 4 064927a0648a - 1 127 111 0 5 25ecb8cb8618 + revoffset length linkrev nodeid p1 p2 + 0 0 127 4 064927a0648a + 1 127 111 5 25ecb8cb8618 $ echo 2 > dir1/a $ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a' $ hg debugindex --dir dir1 - revoffset length delta linkrev nodeid p1 p2 - 0 0 127 -1 4 064927a0648a - 1 127 111 0 5 25ecb8cb8618 - 2 238 55 1 6 5b16163a30c6 25ecb8cb8618 + revoffset length linkrev nodeid p1 p2 + 0 0 127 4 064927a0648a + 1 127 111 5 25ecb8cb8618 + 2 238 55 6 5b16163a30c6 25ecb8cb8618 Stripping and
D2986: wireproto: add frame flag to denote payloads as CBOR
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe9aadee698cf: wireproto: add frame flag to denote payloads as CBOR (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2986?vs=7449=7560 REVISION DETAIL https://phab.mercurial-scm.org/D2986 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py CHANGE DETAILS diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -79,10 +79,12 @@ FLAG_BYTES_RESPONSE_CONTINUATION = 0x01 FLAG_BYTES_RESPONSE_EOS = 0x02 +FLAG_BYTES_RESPONSE_CBOR = 0x04 FLAGS_BYTES_RESPONSE = { b'continuation': FLAG_BYTES_RESPONSE_CONTINUATION, b'eos': FLAG_BYTES_RESPONSE_EOS, +b'cbor': FLAG_BYTES_RESPONSE_CBOR, } FLAG_ERROR_RESPONSE_PROTOCOL = 0x01 diff --git a/mercurial/help/internals/wireprotocol.txt b/mercurial/help/internals/wireprotocol.txt --- a/mercurial/help/internals/wireprotocol.txt +++ b/mercurial/help/internals/wireprotocol.txt @@ -631,19 +631,21 @@ server. The command has been fully issued and no new data for this command will be sent. The next frame will belong to a new command. -Bytes Response Data (``0x04``) --- +Response Data (``0x04``) + -This frame contains raw bytes response data to an issued command. +This frame contains raw response data to an issued command. The following flag values are defined for this type: 0x01 - Data continuation. When set, an additional frame containing raw - response data will follow. + Data continuation. When set, an additional frame containing response data + will follow. 0x02 - End of data. When sent, the response data has been fully sent and + End of data. When set, the response data has been fully sent and no additional frames for this response will be sent. +0x04 + CBOR data. When set, the frame payload consists of CBOR data. The ``0x01`` flag is mutually exclusive with the ``0x02`` flag. To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2951: wireproto: use CBOR for command requests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3d0e2cd86e05: wireproto: use CBOR for command requests (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2951?vs=7439=7553 REVISION DETAIL https://phab.mercurial-scm.org/D2951 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -2,6 +2,9 @@ import unittest +from mercurial.thirdparty import ( +cbor, +) from mercurial import ( util, wireprotoframing as framing, @@ -96,7 +99,8 @@ frames = list(framing.createcommandframes(stream, 1, b'command', {}, data)) self.assertEqual(frames, [ -ffs(b'1 1 stream-begin command-name have-data command'), +ffs(b'1 1 stream-begin command-request new|have-data ' +b"cbor:{b'name': b'command'}"), ffs(b'1 1 0 command-data continuation %s' % data.getvalue()), ffs(b'1 1 0 command-data eos ') ]) @@ -108,7 +112,8 @@ frames = list(framing.createcommandframes(stream, 1, b'command', {}, data)) self.assertEqual(frames, [ -ffs(b'1 1 stream-begin command-name have-data command'), +ffs(b'1 1 stream-begin command-request new|have-data ' +b"cbor:{b'name': b'command'}"), ffs(b'1 1 0 command-data continuation %s' % ( b'x' * framing.DEFAULT_MAX_FRAME_SIZE)), ffs(b'1 1 0 command-data eos x'), @@ -125,10 +130,9 @@ }, data)) self.assertEqual(frames, [ -ffs(b'1 1 stream-begin command-name have-args|have-data command'), -ffs(br'1 1 0 command-argument 0 \x04\x00\x09\x00key1key1value'), -ffs(br'1 1 0 command-argument 0 \x04\x00\x09\x00key2key2value'), -ffs(br'1 1 0 command-argument eoa \x04\x00\x09\x00key3key3value'), +ffs(b'1 1 stream-begin command-request new|have-data ' +b"cbor:{b'name': b'command', b'args': {b'key1': b'key1value', " +b"b'key2': b'key2value', b'key3': b'key3value'}}"), ffs(b'1 1 0 command-data eos %s' % data.getvalue()), ]) @@ -286,10 +290,9 @@ stream = framing.stream(1) results = list(sendcommandframes(reactor, stream, 41, b'mycommand', {b'foo': b'bar'})) -self.assertEqual(len(results), 2) -self.assertaction(results[0], 'wantframe') -self.assertaction(results[1], 'runcommand') -self.assertEqual(results[1][1], { +self.assertEqual(len(results), 1) +self.assertaction(results[0], 'runcommand') +self.assertEqual(results[0][1], { 'requestid': 41, 'command': b'mycommand', 'args': {b'foo': b'bar'}, @@ -301,11 +304,9 @@ stream = framing.stream(1) results = list(sendcommandframes(reactor, stream, 1, b'mycommand', {b'foo': b'bar', b'biz': b'baz'})) -self.assertEqual(len(results), 3) -self.assertaction(results[0], 'wantframe') -self.assertaction(results[1], 'wantframe') -self.assertaction(results[2], 'runcommand') -self.assertEqual(results[2][1], { +self.assertEqual(len(results), 1) +self.assertaction(results[0], 'runcommand') +self.assertEqual(results[0][1], { 'requestid': 1, 'command': b'mycommand', 'args': {b'foo': b'bar', b'biz': b'baz'}, @@ -329,7 +330,8 @@ def testmultipledataframes(self): frames = [ -ffs(b'1 1 stream-begin command-name have-data mycommand'), +ffs(b'1 1 stream-begin command-request new|have-data ' +b"cbor:{b'name': b'mycommand'}"), ffs(b'1 1 0 command-data continuation data1'), ffs(b'1 1 0 command-data continuation data2'), ffs(b'1 1 0 command-data eos data3'), @@ -350,9 +352,9 @@ def testargumentanddata(self): frames = [ -ffs(b'1 1 stream-begin command-name have-args|have-data command'), -ffs(br'1 1 0 command-argument 0 \x03\x00\x03\x00keyval'), -ffs(br'1 1 0 command-argument eoa \x03\x00\x03\x00foobar'), +ffs(b'1 1 stream-begin command-request new|have-data ' +b"cbor:{b'name': b'command', b'args': {b'key': b'val'," +b"b'foo': b'bar'}}"), ffs(b'1 1 0 command-data continuation value1'), ffs(b'1 1
D2981: wireproto: mark SSHv2 as a version 1 transport
This revision was automatically updated to reflect the committed changes. Closed by commit rHG27527d8cff5c: wireproto: mark SSHv2 as a version 1 transport (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2981?vs=7444=7555 REVISION DETAIL https://phab.mercurial-scm.org/D2981 AFFECTED FILES mercurial/wireprototypes.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -1098,9 +1098,9 @@ i> write(6) -> 6: i> hello\n o> readline() -> 4: - o> 385\n - o> readline() -> 385: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n + o> 403\n + o> readline() -> 403: + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n Multiple upgrades is not allowed @@ -1279,30 +1279,32 @@ Legacy commands are not exposed to version 2 of protocol - $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF - > command branches - > nodes - > EOF - creating ssh peer from handshake results - sending branches command - response: +TODO re-enable these once we're back to actually using v2 commands + +$ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF +> command branches +> nodes +> EOF +creating ssh peer from handshake results +sending branches command +response: - $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF - > command changegroup - > roots - > EOF - creating ssh peer from handshake results - sending changegroup command - response: +$ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF +> command changegroup +> roots +> EOF +creating ssh peer from handshake results +sending changegroup command +response: - $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF - > command changegroupsubset - > bases - > heads - > EOF - creating ssh peer from handshake results - sending changegroupsubset command - response: +$ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF +> command changegroupsubset +> bases +> heads +> EOF +creating ssh peer from handshake results +sending changegroupsubset command +response: $ cd .. diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -22,7 +22,8 @@ }, SSHV2: { 'transport': 'ssh', -'version': 2, +# TODO mark as version 2 once all commands are implemented. +'version': 1, }, 'http-v1': { 'transport': 'http', To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2948: wireproto: syntax for encoding CBOR into frames
This revision was automatically updated to reflect the committed changes. Closed by commit rHGcc5a040fe150: wireproto: syntax for encoding CBOR into frames (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2948?vs=7437=7551 REVISION DETAIL https://phab.mercurial-scm.org/D2948 AFFECTED FILES mercurial/debugcommands.py mercurial/utils/stringutil.py mercurial/wireprotoframing.py tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -35,6 +35,59 @@ framing.createcommandframes(stream, rid, cmd, args, datafh)) +class FrameHumanStringTests(unittest.TestCase): +def testbasic(self): +self.assertEqual(ffs(b'1 1 0 1 0 '), + b'\x00\x00\x00\x01\x00\x01\x00\x10') + +self.assertEqual(ffs(b'2 4 0 1 0 '), + b'\x00\x00\x00\x02\x00\x04\x00\x10') + +self.assertEqual(ffs(b'2 4 0 1 0 foo'), + b'\x03\x00\x00\x02\x00\x04\x00\x10foo') + +def testcborint(self): +self.assertEqual(ffs(b'1 1 0 1 0 cbor:15'), + b'\x01\x00\x00\x01\x00\x01\x00\x10\x0f') + +self.assertEqual(ffs(b'1 1 0 1 0 cbor:42'), + b'\x02\x00\x00\x01\x00\x01\x00\x10\x18*') + +self.assertEqual(ffs(b'1 1 0 1 0 cbor:1048576'), + b'\x05\x00\x00\x01\x00\x01\x00\x10\x1a' + b'\x00\x10\x00\x00') + +self.assertEqual(ffs(b'1 1 0 1 0 cbor:0'), + b'\x01\x00\x00\x01\x00\x01\x00\x10\x00') + +self.assertEqual(ffs(b'1 1 0 1 0 cbor:-1'), + b'\x01\x00\x00\x01\x00\x01\x00\x10 ') + +self.assertEqual(ffs(b'1 1 0 1 0 cbor:-342542'), + b'\x05\x00\x00\x01\x00\x01\x00\x10:\x00\x05:\r') + +def testcborstrings(self): +# String literals should be unicode. +self.assertEqual(ffs(b"1 1 0 1 0 cbor:'foo'"), + b'\x04\x00\x00\x01\x00\x01\x00\x10cfoo') + +self.assertEqual(ffs(b"1 1 0 1 0 cbor:b'foo'"), + b'\x04\x00\x00\x01\x00\x01\x00\x10Cfoo') + +self.assertEqual(ffs(b"1 1 0 1 0 cbor:u'foo'"), + b'\x04\x00\x00\x01\x00\x01\x00\x10cfoo') + +def testcborlists(self): +self.assertEqual(ffs(b"1 1 0 1 0 cbor:[None, True, False, 42, b'foo']"), + b'\n\x00\x00\x01\x00\x01\x00\x10\x85\xf6\xf5\xf4' + b'\x18*Cfoo') + +def testcbordicts(self): +self.assertEqual(ffs(b"1 1 0 1 0 " + b"cbor:{b'foo': b'val1', b'bar': b'val2'}"), + b'\x13\x00\x00\x01\x00\x01\x00\x10\xa2' + b'CbarDval2CfooDval1') + class FrameTests(unittest.TestCase): def testdataexactframesize(self): data = util.bytesio(b'x' * framing.DEFAULT_MAX_FRAME_SIZE) diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -16,6 +16,7 @@ from .i18n import _ from .thirdparty import ( attr, +cbor, ) from . import ( error, @@ -156,6 +157,9 @@ def makeframefromhumanstring(s): """Create a frame from a human readable string +DANGER: NOT SAFE TO USE WITH UNTRUSTED INPUT BECAUSE OF POTENTIAL +eval() USAGE. DO NOT USE IN CORE. + Strings have the form: @@ -169,6 +173,11 @@ named constant. Flags can be delimited by `|` to bitwise OR them together. + +If the payload begins with ``cbor:``, the following string will be +evaluated as Python code and the resulting object will be fed into +a CBOR encoder. Otherwise, the payload is interpreted as a Python +byte string literal. """ fields = s.split(b' ', 5) requestid, streamid, streamflags, frametype, frameflags, payload = fields @@ -196,7 +205,11 @@ else: finalflags |= int(flag) -payload = stringutil.unescapestr(payload) +if payload.startswith(b'cbor:'): +payload = cbor.dumps(stringutil.evalpython(payload[5:]), canonical=True) + +else: +payload = stringutil.unescapestr(payload) return makeframe(requestid=requestid, streamid=streamid, streamflags=finalstreamflags, typeid=frametype, diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -9,6 +9,7 @@ from __future__ import absolute_import +import __future__ import codecs import re as remod import textwrap @@ -497,3 +498,29 @@ If s is not a valid boolean, returns None. """
D2902: wireproto: define frame to represent progress updates
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb0041036214e: wireproto: define frame to represent progress updates (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2902?vs=7438=7552 REVISION DETAIL https://phab.mercurial-scm.org/D2902 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py CHANGE DETAILS diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -45,6 +45,7 @@ FRAME_TYPE_BYTES_RESPONSE = 0x04 FRAME_TYPE_ERROR_RESPONSE = 0x05 FRAME_TYPE_TEXT_OUTPUT = 0x06 +FRAME_TYPE_PROGRESS = 0x07 FRAME_TYPE_STREAM_SETTINGS = 0x08 FRAME_TYPES = { @@ -54,6 +55,7 @@ b'bytes-response': FRAME_TYPE_BYTES_RESPONSE, b'error-response': FRAME_TYPE_ERROR_RESPONSE, b'text-output': FRAME_TYPE_TEXT_OUTPUT, +b'progress': FRAME_TYPE_PROGRESS, b'stream-settings': FRAME_TYPE_STREAM_SETTINGS, } @@ -107,6 +109,7 @@ FRAME_TYPE_BYTES_RESPONSE: FLAGS_BYTES_RESPONSE, FRAME_TYPE_ERROR_RESPONSE: FLAGS_ERROR_RESPONSE, FRAME_TYPE_TEXT_OUTPUT: {}, +FRAME_TYPE_PROGRESS: {}, FRAME_TYPE_STREAM_SETTINGS: {}, } diff --git a/mercurial/help/internals/wireprotocol.txt b/mercurial/help/internals/wireprotocol.txt --- a/mercurial/help/internals/wireprotocol.txt +++ b/mercurial/help/internals/wireprotocol.txt @@ -740,6 +740,44 @@ The last atom in the frame SHOULD end with a newline (``\n``). If it doesn't, clients MAY add a newline to facilitate immediate printing. +Progress Update (``0x07``) +-- + +This frame holds the progress of an operation on the peer. Consumption +of these frames allows clients to display progress bars, estimated +completion times, etc. + +Each frame defines the progress of a single operation on the peer. The +payload consists of a CBOR map with the following bytestring keys: + +topic + Topic name (string) +pos + Current numeric position within the topic (integer) +total + Total/end numeric position of this topic (unsigned integer) +label (optional) + Unit label (string) +item (optional) + Item name (string) + +Progress state is created when a frame is received referencing a +*topic* that isn't currently tracked. Progress tracking for that +*topic* is finished when a frame is received reporting the current +position of that topic as ``-1``. + +Multiple *topics* may be active at any given time. + +Rendering of progress information is not mandated or governed by this +specification: implementations MAY render progress information however +they see fit, including not at all. + +The string data describing the topic SHOULD be static strings to +facilitate receivers localizing that string data. The emitter +MUST normalize all string data to valid UTF-8 and receivers SHOULD +validate that received data conforms to UTF-8. The topic name +SHOULD be ASCII. + Stream Encoding Settings (``0x08``) --- To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2907: wireproto: add streams to frame-based protocol
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9bfcbe4f4745: wireproto: add streams to frame-based protocol (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2907?vs=7435=7549 REVISION DETAIL https://phab.mercurial-scm.org/D2907 AFFECTED FILES mercurial/debugcommands.py mercurial/help/internals/wireprotocol.txt mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -23,6 +23,8 @@ assert len(payload) == header.length yield reactor.onframerecv(framing.frame(header.requestid, +header.streamid, +header.streamflags, header.typeid, header.flags, payload)) @@ -37,44 +39,44 @@ def testdataexactframesize(self): data = util.bytesio(b'x' * framing.DEFAULT_MAX_FRAME_SIZE) -stream = framing.stream() +stream = framing.stream(1) frames = list(framing.createcommandframes(stream, 1, b'command', {}, data)) self.assertEqual(frames, [ -ffs(b'1 command-name have-data command'), -ffs(b'1 command-data continuation %s' % data.getvalue()), -ffs(b'1 command-data eos ') +ffs(b'1 1 stream-begin command-name have-data command'), +ffs(b'1 1 0 command-data continuation %s' % data.getvalue()), +ffs(b'1 1 0 command-data eos ') ]) def testdatamultipleframes(self): data = util.bytesio(b'x' * (framing.DEFAULT_MAX_FRAME_SIZE + 1)) -stream = framing.stream() +stream = framing.stream(1) frames = list(framing.createcommandframes(stream, 1, b'command', {}, data)) self.assertEqual(frames, [ -ffs(b'1 command-name have-data command'), -ffs(b'1 command-data continuation %s' % ( +ffs(b'1 1 stream-begin command-name have-data command'), +ffs(b'1 1 0 command-data continuation %s' % ( b'x' * framing.DEFAULT_MAX_FRAME_SIZE)), -ffs(b'1 command-data eos x'), +ffs(b'1 1 0 command-data eos x'), ]) def testargsanddata(self): data = util.bytesio(b'x' * 100) -stream = framing.stream() +stream = framing.stream(1) frames = list(framing.createcommandframes(stream, 1, b'command', { b'key1': b'key1value', b'key2': b'key2value', b'key3': b'key3value', }, data)) self.assertEqual(frames, [ -ffs(b'1 command-name have-args|have-data command'), -ffs(br'1 command-argument 0 \x04\x00\x09\x00key1key1value'), -ffs(br'1 command-argument 0 \x04\x00\x09\x00key2key2value'), -ffs(br'1 command-argument eoa \x04\x00\x09\x00key3key3value'), -ffs(b'1 command-data eos %s' % data.getvalue()), +ffs(b'1 1 stream-begin command-name have-args|have-data command'), +ffs(br'1 1 0 command-argument 0 \x04\x00\x09\x00key1key1value'), +ffs(br'1 1 0 command-argument 0 \x04\x00\x09\x00key2key2value'), +ffs(br'1 1 0 command-argument eoa \x04\x00\x09\x00key3key3value'), +ffs(b'1 1 0 command-data eos %s' % data.getvalue()), ]) def testtextoutputexcessiveargs(self): @@ -128,64 +130,68 @@ (b'bleh', [], [b'x' * 65536])])) def testtextoutput1simpleatom(self): -stream = framing.stream() +stream = framing.stream(1) val = list(framing.createtextoutputframe(stream, 1, [ (b'foo', [], [])])) self.assertEqual(val, [ -ffs(br'1 text-output 0 \x03\x00\x00\x00foo'), +ffs(br'1 1 stream-begin text-output 0 \x03\x00\x00\x00foo'), ]) def testtextoutput2simpleatoms(self): -stream = framing.stream() +stream = framing.stream(1) val = list(framing.createtextoutputframe(stream, 1, [ (b'foo', [], []), (b'bar', [], []), ])) self.assertEqual(val, [ -ffs(br'1 text-output 0 \x03\x00\x00\x00foo\x03\x00\x00\x00bar'), +ffs(br'1 1 stream-begin text-output 0 ' +br'\x03\x00\x00\x00foo\x03\x00\x00\x00bar'), ]) def testtextoutput1arg(self): -stream = framing.stream() +stream = framing.stream(1) val =
D2906: wireproto: start to associate frame generation with a stream
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3ed344546d9e: wireproto: start to associate frame generation with a stream (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2906?vs=7434=7548 REVISION DETAIL https://phab.mercurial-scm.org/D2906 AFFECTED FILES mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -27,25 +27,31 @@ header.flags, payload)) -def sendcommandframes(reactor, rid, cmd, args, datafh=None): +def sendcommandframes(reactor, stream, rid, cmd, args, datafh=None): """Generate frames to run a command and send them to a reactor.""" return sendframes(reactor, - framing.createcommandframes(rid, cmd, args, datafh)) + framing.createcommandframes(stream, rid, cmd, args, + datafh)) class FrameTests(unittest.TestCase): def testdataexactframesize(self): data = util.bytesio(b'x' * framing.DEFAULT_MAX_FRAME_SIZE) -frames = list(framing.createcommandframes(1, b'command', {}, data)) +stream = framing.stream() +frames = list(framing.createcommandframes(stream, 1, b'command', + {}, data)) self.assertEqual(frames, [ ffs(b'1 command-name have-data command'), ffs(b'1 command-data continuation %s' % data.getvalue()), ffs(b'1 command-data eos ') ]) def testdatamultipleframes(self): data = util.bytesio(b'x' * (framing.DEFAULT_MAX_FRAME_SIZE + 1)) -frames = list(framing.createcommandframes(1, b'command', {}, data)) + +stream = framing.stream() +frames = list(framing.createcommandframes(stream, 1, b'command', {}, + data)) self.assertEqual(frames, [ ffs(b'1 command-name have-data command'), ffs(b'1 command-data continuation %s' % ( @@ -56,7 +62,8 @@ def testargsanddata(self): data = util.bytesio(b'x' * 100) -frames = list(framing.createcommandframes(1, b'command', { +stream = framing.stream() +frames = list(framing.createcommandframes(stream, 1, b'command', { b'key1': b'key1value', b'key2': b'key2value', b'key3': b'key3value', @@ -75,59 +82,63 @@ with self.assertRaisesRegexp(ValueError, 'cannot use more than 255 formatting'): args = [b'x' for i in range(256)] -list(framing.createtextoutputframe(1, [(b'bleh', args, [])])) +list(framing.createtextoutputframe(None, 1, + [(b'bleh', args, [])])) def testtextoutputexcessivelabels(self): """At most 255 labels are allowed.""" with self.assertRaisesRegexp(ValueError, 'cannot use more than 255 labels'): labels = [b'l' for i in range(256)] -list(framing.createtextoutputframe(1, [(b'bleh', [], labels)])) +list(framing.createtextoutputframe(None, 1, + [(b'bleh', [], labels)])) def testtextoutputformattingstringtype(self): """Formatting string must be bytes.""" with self.assertRaisesRegexp(ValueError, 'must use bytes formatting '): -list(framing.createtextoutputframe(1, [ +list(framing.createtextoutputframe(None, 1, [ (b'foo'.decode('ascii'), [], [])])) def testtextoutputargumentbytes(self): with self.assertRaisesRegexp(ValueError, 'must use bytes for argument'): -list(framing.createtextoutputframe(1, [ +list(framing.createtextoutputframe(None, 1, [ (b'foo', [b'foo'.decode('ascii')], [])])) def testtextoutputlabelbytes(self): with self.assertRaisesRegexp(ValueError, 'must use bytes for labels'): -list(framing.createtextoutputframe(1, [ +list(framing.createtextoutputframe(None, 1, [ (b'foo', [], [b'foo'.decode('ascii')])])) def testtextoutputtoolongformatstring(self): with self.assertRaisesRegexp(ValueError, 'formatting string cannot be longer than'): -list(framing.createtextoutputframe(1, [ +list(framing.createtextoutputframe(None, 1, [ (b'x' * 65536, [], [])])) def testtextoutputtoolongargumentstring(self):
D2947: wireproto: explicit API to create outgoing streams
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5fadc63ac99f: wireproto: explicit API to create outgoing streams (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2947?vs=7436=7550 REVISION DETAIL https://phab.mercurial-scm.org/D2947 AFFECTED FILES mercurial/wireprotoframing.py mercurial/wireprotoserver.py tests/test-http-api-httpv2.t tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -375,7 +375,7 @@ """Multiple fully serviced commands with same request ID is allowed.""" reactor = makereactor() results = [] -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() results.append(self._sendsingleframe( reactor, ffs(b'1 1 stream-begin command-name eos command'))) result = reactor.onbytesresponseready(outstream, 1, b'response1') @@ -530,7 +530,7 @@ instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() result = reactor.onbytesresponseready(outstream, 1, b'response') self.assertaction(result, 'sendframes') self.assertframesequal(result[1]['framegen'], [ @@ -546,7 +546,7 @@ instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() result = reactor.onbytesresponseready(outstream, 1, first + second) self.assertaction(result, 'sendframes') self.assertframesequal(result[1]['framegen'], [ @@ -559,7 +559,7 @@ instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'mycommand', {})) -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() result = reactor.onapplicationerror(outstream, 1, b'some message') self.assertaction(result, 'sendframes') self.assertframesequal(result[1]['framegen'], [ @@ -575,7 +575,7 @@ self.assertEqual(len(results), 1) self.assertaction(results[0], 'runcommand') -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() result = reactor.onbytesresponseready(outstream, 1, b'response') self.assertaction(result, 'noop') result = reactor.oninputeof() @@ -590,7 +590,7 @@ list(sendcommandframes(reactor, instream, 1, b'command1', {})) list(sendcommandframes(reactor, instream, 3, b'command2', {})) -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() result = reactor.onbytesresponseready(outstream, 1, b'response1') self.assertaction(result, 'noop') result = reactor.onbytesresponseready(outstream, 3, b'response2') @@ -610,7 +610,7 @@ list(sendcommandframes(reactor, instream, 5, b'command3', {})) # Register results for commands out of order. -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() reactor.onbytesresponseready(outstream, 3, b'response3') reactor.onbytesresponseready(outstream, 1, b'response1') reactor.onbytesresponseready(outstream, 5, b'response5') @@ -640,7 +640,7 @@ reactor = makereactor() instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'command1', {})) -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() reactor.onbytesresponseready(outstream, 1, b'response') # We've registered the response but haven't sent it. From the @@ -672,7 +672,7 @@ reactor = makereactor() instream = framing.stream(1) list(sendcommandframes(reactor, instream, 1, b'command1', {})) -outstream = framing.stream(2) +outstream = reactor.makeoutputstream() res = reactor.onbytesresponseready(outstream, 1, b'response') list(res[1]['framegen']) diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t --- a/tests/test-http-api-httpv2.t +++ b/tests/test-http-api-httpv2.t @@ -472,7 +472,7 @@ s> \x1d\x00\x00\x01\x00\x02\x01Bcustomreadonly bytes response s> \r\n s> 25\r\n - s> \x1d\x00\x00\x03\x00\x02\x01Bcustomreadonly bytes response + s> \x1d\x00\x00\x03\x00\x02\x00Bcustomreadonly bytes response s> \r\n s> 0\r\n s> \r\n @@ -511,7 +511,7 @@ s> \x00\x00\x00\x03\x00\x02\x01B s> \r\n s> 26\r\n - s> \x1e\x00\x00\x01\x00\x02\x01Bbookmarks\n + s> \x1e\x00\x00\x01\x00\x02\x00Bbookmarks\n
D2950: tests: fix duplicate and failing test
This revision was automatically updated to reflect the committed changes. Closed by commit rHG12bfc724217d: tests: fix duplicate and failing test (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2950?vs=7433=7547 REVISION DETAIL https://phab.mercurial-scm.org/D2950 AFFECTED FILES tests/test-wireproto-serverreactor.py CHANGE DETAILS diff --git a/tests/test-wireproto-serverreactor.py b/tests/test-wireproto-serverreactor.py --- a/tests/test-wireproto-serverreactor.py +++ b/tests/test-wireproto-serverreactor.py @@ -174,8 +174,8 @@ ]) class ServerReactorTests(unittest.TestCase): -def _sendsingleframe(self, reactor, s): -results = list(sendframes(reactor, [ffs(s)])) +def _sendsingleframe(self, reactor, f): +results = list(sendframes(reactor, [f])) self.assertEqual(len(results), 1) return results[0] @@ -296,7 +296,7 @@ def testunexpectedcommandargument(self): """Command argument frame when not running a command is an error.""" result = self._sendsingleframe(makereactor(), - b'1 command-argument 0 ignored') + ffs(b'1 command-argument 0 ignored')) self.assertaction(result, 'error') self.assertEqual(result[1], { 'message': b'expected command frame; got 2', @@ -318,7 +318,7 @@ def testunexpectedcommanddata(self): """Command argument frame when not running a command is an error.""" result = self._sendsingleframe(makereactor(), - b'1 command-data 0 ignored') + ffs(b'1 command-data 0 ignored')) self.assertaction(result, 'error') self.assertEqual(result[1], { 'message': b'expected command frame; got 3', @@ -340,19 +340,32 @@ def testmissingcommandframeflags(self): """Command name frame must have flags set.""" result = self._sendsingleframe(makereactor(), - b'1 command-name 0 command') + ffs(b'1 command-name 0 command')) self.assertaction(result, 'error') self.assertEqual(result[1], { 'message': b'missing frame flags on command frame', }) -def testconflictingrequestid(self): +def testconflictingrequestidallowed(self): """Multiple fully serviced commands with same request ID is allowed.""" -results = list(sendframes(makereactor(), [ -ffs(b'1 command-name eos command'), -ffs(b'1 command-name eos command'), -ffs(b'1 command-name eos command'), -])) +reactor = makereactor() +results = [] +results.append(self._sendsingleframe( +reactor, ffs(b'1 command-name eos command'))) +result = reactor.onbytesresponseready(1, b'response1') +self.assertaction(result, 'sendframes') +list(result[1]['framegen']) +results.append(self._sendsingleframe( +reactor, ffs(b'1 command-name eos command'))) +result = reactor.onbytesresponseready(1, b'response2') +self.assertaction(result, 'sendframes') +list(result[1]['framegen']) +results.append(self._sendsingleframe( +reactor, ffs(b'1 command-name eos command'))) +result = reactor.onbytesresponseready(1, b'response3') +self.assertaction(result, 'sendframes') +list(result[1]['framegen']) + for i in range(3): self.assertaction(results[i], 'runcommand') self.assertEqual(results[i][1], { To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3025: tests: don't use revlog paths in tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG435481393198: tests: dont use revlog paths in tests (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3025?vs=7526=7543 REVISION DETAIL https://phab.mercurial-scm.org/D3025 AFFECTED FILES tests/test-annotate.t tests/test-debugindexdot.t tests/test-lfs-test-server.t tests/test-parseindex.t CHANGE DETAILS diff --git a/tests/test-parseindex.t b/tests/test-parseindex.t --- a/tests/test-parseindex.t +++ b/tests/test-parseindex.t @@ -143,11 +143,11 @@ > open(n + "/.hg/store/00changelog.i", "wb").write(d) > EOF - $ hg debugindex -f1 limit/.hg/store/00changelog.i + $ hg -R limit debugindex -f1 -c rev flag offset length size base link p1 p2 nodeid 0 0 63 62 0 0 2 -1 7c31755bf9b5 1 63 66 65 1 1 0 2 26333235a41c - $ hg debugindex -f1 segv/.hg/store/00changelog.i + $ hg -R segv debugindex -f1 -c rev flag offset length size base link p1 p2 nodeid 0 0 63 62 0 0 65536 -1 7c31755bf9b5 1 63 66 65 1 1 0 65536 26333235a41c diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t --- a/tests/test-lfs-test-server.t +++ b/tests/test-lfs-test-server.t @@ -823,7 +823,7 @@ $ hg commit -m 'test' $ echo a > a $ hg commit -m 'largefile' - $ hg debugdata .hg/store/data/a.i 1 # verify this is no the file content but includes "oid", the LFS "pointer". + $ hg debugdata a 1 # verify this is no the file content but includes "oid", the LFS "pointer". version https://git-lfs.github.com/spec/v1 oid sha256:bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a size 6 diff --git a/tests/test-debugindexdot.t b/tests/test-debugindexdot.t --- a/tests/test-debugindexdot.t +++ b/tests/test-debugindexdot.t @@ -13,7 +13,7 @@ $ HGMERGE=true hg merge -q $ hg ci -m merge -d '3 0' - $ hg debugindexdot .hg/store/data/a.i + $ hg debugindexdot a digraph G { -1 -> 0 0 -> 1 diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -456,7 +456,7 @@ > EOF $ hg debugsetparents 17 17 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2" - $ hg debugindexdot .hg/store/data/baz.i + $ hg debugindexdot baz digraph G { -1 -> 0 0 -> 1 @@ -488,7 +488,7 @@ > EOF $ hg debugsetparents 19 18 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4" - $ hg debugindexdot .hg/store/data/baz.i + $ hg debugindexdot baz digraph G { -1 -> 0 0 -> 1 To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3026: tests: use debugdeltachain where appropriate
This revision was automatically updated to reflect the committed changes. Closed by commit rHG806b07d7c7d6: tests: use debugdeltachain where appropriate (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3026?vs=7527=7544 REVISION DETAIL https://phab.mercurial-scm.org/D3026 AFFECTED FILES tests/test-generaldelta.t tests/test-parseindex.t tests/test-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -645,11 +645,11 @@ > EOF $ hg config format format.maxchainlen=9001 - $ hg debugindex file - revoffset length delta linkrev nodeid p1 p2 - 0 0 77 -1 0 bcc1d3df78b2 - 177 21 0 1 af3e29f7a72e bcc1d3df78b2 - 298 84 -1 2 8daf79c5522b af3e29f7a72e + $ hg debugdeltachain file + rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio +0 11 -1base 77182 77 0.4230877 00.0 +1 120 p1 21191 98 0.5130998 00.0 +2 21 -1base 84200 84 0.4200084 00.0 $ hg debugupgraderepo --run --optimize redeltaall upgrade will perform the following actions: @@ -684,11 +684,11 @@ removing temporary repository $TESTTMP/localconfig/.hg/upgrade.* (glob) copy of old repository backed up at $TESTTMP/localconfig/.hg/upgradebackup.* (glob) the old repository will not be deleted; remove it to free up disk space once the upgraded repository is verified - $ hg debugindex file - revoffset length delta linkrev nodeid p1 p2 - 0 0 77 -1 0 bcc1d3df78b2 - 177 21 0 1 af3e29f7a72e bcc1d3df78b2 - 298 21 1 2 8daf79c5522b af3e29f7a72e + $ hg debugdeltachain file + rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio +0 11 -1base 77182 77 0.4230877 00.0 +1 120 p1 21191 98 0.5130998 00.0 +2 131 p1 21200119 0.59500 119 00.0 $ cd .. $ cat << EOF >> $HGRCPATH diff --git a/tests/test-parseindex.t b/tests/test-parseindex.t --- a/tests/test-parseindex.t +++ b/tests/test-parseindex.t @@ -147,11 +147,22 @@ rev flag offset length size base link p1 p2 nodeid 0 0 63 62 0 0 2 -1 7c31755bf9b5 1 63 66 65 1 1 0 2 26333235a41c + + $ hg -R limit debugdeltachain -c + rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio +0 11 -1base 63 62 63 1.0161363 00.0 +1 21 -1base 66 65 66 1.0153866 00.0 + $ hg -R segv debugindex -f1 -c rev flag offset length size base link p1 p2 nodeid 0 0 63 62 0 0 65536 -1 7c31755bf9b5 1 63 66 65 1 1 0 65536 26333235a41c + $ hg -R segv debugdeltachain -c + rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio +0 11 -1base 63 62 63 1.0161363 00.0 +1 21 -1base 66 65 66 1.0153866 00.0 + $ cat < test.py > import sys > from mercurial import changelog, vfs diff --git a/tests/test-generaldelta.t b/tests/test-generaldelta.t --- a/tests/test-generaldelta.t +++ b/tests/test-generaldelta.t @@ -67,9 +67,9 @@ $ hg init client --config format.generaldelta=false --config format.usegeneraldelta=false $ cd client $ hg pull -q ../server -r 4 - $ hg debugindex x - revoffset length base linkrev nodeid p1 p2 - 0 0 3 0 1 1406e7411862 + $ hg debugdeltachain x + rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist
Re: [PATCH 8 of 8 V2] templater: define interface for objects requiring unwrapvalue()
On Tue, Apr 3, 2018 at 8:40 AM Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1521288196 -32400 > # Sat Mar 17 21:03:16 2018 +0900 > # Node ID b9a554cd2c3bb5d0701f24c67d36e24386b54f6a > # Parent 7404b3400212b00845411af13a69ac753bff6bb2 > templater: define interface for objects requiring unwrapvalue() > Queued, thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2987: stringutil: add function to pretty print an object
durin42 added inline comments. INLINE COMMENTS > stringutil.py:39 > > +def pprint(o): > +"""Pretty print an object.""" Why this instead of pprint.pformat? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2987 To: indygreg, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3034: verify: remove dependence on repo.changectx()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This was one of few remaining uses of repo.changectx() in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3034 AFFECTED FILES mercurial/verify.py CHANGE DETAILS diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -47,7 +47,7 @@ self.havecl = len(repo.changelog) > 0 self.havemf = len(repo.manifestlog._revlog) > 0 self.revlogv1 = repo.changelog.version != revlog.REVLOGV0 -self.lrugetctx = util.lrucachefunc(repo.changectx) +self.lrugetctx = util.lrucachefunc(repo.__getitem__) self.refersmf = False self.fncachewarned = False # developer config: verify.skipflags To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3037: repo: remove now-unused changectx() method (API)
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3037 AFFECTED FILES mercurial/localrepo.py mercurial/repository.py CHANGE DETAILS diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -493,12 +493,6 @@ def file(f): """Obtain a filelog for a tracked path.""" -def changectx(changeid): -"""Obtains a changectx for a revision. - -Identical to __getitem__. -""" - def setparents(p1, p2): """Set the parent nodes of the working directory.""" diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1073,9 +1073,6 @@ f = f[1:] return filelog.filelog(self.svfs, f) -def changectx(self, changeid): -return self[changeid] - def setparents(self, p1, p2=nullid): with self.dirstate.parentchange(): copies = self.dirstate.setparents(p1, p2) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3035: log: remove dependence on repo.changectx()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This was one of few remaining uses of repo.changectx() in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3035 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1839,7 +1839,7 @@ wanted = set() slowpath = match.anypats() or (not match.always() and opts.get('removed')) fncache = {} -change = repo.changectx +change = repo.__getitem__ # First step is to fill wanted, the set of revisions that we want to yield. # When it does not induce extra cost, we also fill fncache for revisions in To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3036: tests: remove dependence on repo.changectx()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This was one of few remaining uses of repo.changectx() in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3036 AFFECTED FILES tests/test-context.py CHANGE DETAILS diff --git a/tests/test-context.py b/tests/test-context.py --- a/tests/test-context.py +++ b/tests/test-context.py @@ -52,7 +52,7 @@ data += 'bar\n' return context.memfilectx(repo, memctx, f, data, 'l' in flags, 'x' in flags) -ctxa = repo.changectx(0) +ctxa = repo[0] ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"], getfilectx, ctxa.user(), ctxa.date()) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3033: bookmarks: switch from repo.changectx('.') to repo['.']
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The two forms are synonymous and the new form is by far the more common form. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3033 AFFECTED FILES mercurial/bookmarks.py CHANGE DETAILS diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -204,7 +204,7 @@ If divergent bookmark are to be deleted, they will be returned as list. """ -cur = self._repo.changectx('.').node() +cur = self._repo['.'].node() if mark in self and not force: if target: if self[mark] == target and target == cur: @@ -818,7 +818,7 @@ Raises an abort error if old is not in the bookmark store. """ marks = repo._bookmarks -cur = repo.changectx('.').node() +cur = repo['.'].node() newact = None changes = [] hiddenrev = None To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3024: scmutil: add method for looking up a context given a revision symbol
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0194dac77c93: scmutil: add method for looking up a context given a revision symbol (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3024?vs=7525=7537 REVISION DETAIL https://phab.mercurial-scm.org/D3024 AFFECTED FILES mercurial/revset.py mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -433,6 +433,19 @@ hexfunc = short return '%d:%s' % (rev, hexfunc(node)) +def revsymbol(repo, symbol): +"""Returns a context given a single revision symbol (as string). + +This is similar to revsingle(), but accepts only a single revision symbol, +i.e. things like ".", "tip", "1234", "deadbeef", "my-bookmark" work, but +not "max(public())". +""" +if not isinstance(symbol, bytes): +msg = ("symbol (%s of type %s) was not a string, did you mean " + "repo[symbol]?" % (symbol, type(symbol))) +raise error.ProgrammingError(msg) +return repo[symbol] + def revsingle(repo, revspec, default='.', localalias=None): if not revspec and revspec != 0: return repo[default] diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -118,7 +118,7 @@ def stringset(repo, subset, x, order): if not x: raise error.ParseError(_("empty string is not a valid revision")) -x = scmutil.intrev(repo[x]) +x = scmutil.intrev(scmutil.revsymbol(repo, x)) if (x in subset or x == node.nullrev and isinstance(subset, fullreposet)): return baseset([x]) To: martinvonz, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3024: scmutil: add method for looking up a context given a revision symbol
yuja accepted this revision as: yuja. yuja added a comment. I'm not pretty sure about the details (such as `repo[revset]` vs `repo[rev_or_node]`), but the direction sounds generally good to me. Queued, thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3024 To: martinvonz, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 8 V2] templater: drop unneeded generator from mappable object
# HG changeset patch # User Yuya Nishihara# Date 1521287908 -32400 # Sat Mar 17 20:58:28 2018 +0900 # Node ID 82d9c4a417c425734bb7db227d7c648be8b2d94a # Parent 2f4dc45b1eba20fbbbc80c59e2fcb2777eb68a7d templater: drop unneeded generator from mappable object Per the definition of the show() interface, it can return a bytes. diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -113,15 +113,11 @@ class mappable(wrapped): """ def __init__(self, gen, key, value, makemap): -if gen is not None: -self._gen = gen # generator or function returning generator +self._gen = gen # generator or function returning generator self._key = key self._value = value # may be generator of strings self._makemap = makemap -def _gen(self): -yield pycompat.bytestr(self._value) - def tomap(self): return self._makemap(self._key) @@ -131,6 +127,8 @@ class mappable(wrapped): def show(self, context, mapping): # TODO: switch gen to (context, mapping) API? gen = self._gen +if gen is None: +return pycompat.bytestr(self._value) if callable(gen): return gen() return gen ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 6 of 8 V2] templater: pass (context, mapping) down to unwrapvalue()
# HG changeset patch # User Yuya Nishihara# Date 1521382461 -32400 # Sun Mar 18 23:14:21 2018 +0900 # Node ID df181b84d8341bd2560964165624c04a1d5c84fe # Parent 82d9c4a417c425734bb7db227d7c648be8b2d94a templater: pass (context, mapping) down to unwrapvalue() The same reason as why I made unwraphybrid() take a (context, mapping) pair. diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -319,7 +319,7 @@ def join(context, mapping, args): # TODO: perhaps this should be evalfuncarg(), but it can't because hgweb # abuses generator as a keyword that returns a list of dicts. joinset = evalrawexp(context, mapping, args[0]) -joinset = templateutil.unwrapvalue(joinset) +joinset = templateutil.unwrapvalue(context, mapping, joinset) joinfmt = getattr(joinset, 'joinfmt', pycompat.identity) joiner = " " if len(args) > 1: diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -157,7 +157,7 @@ def unwraphybrid(context, mapping, thing return thing return thing.show(context, mapping) -def unwrapvalue(thing): +def unwrapvalue(context, mapping, thing): """Move the inner value object out of the wrapper""" if not util.safehasattr(thing, '_value'): return thing @@ -327,7 +327,7 @@ def evalfuncarg(context, mapping, arg): # is fixed. we can't do that right now because join() has to take a generator # of byte strings as it is, not a lazy byte string. def _unwrapvalue(context, mapping, thing): -thing = unwrapvalue(thing) +thing = unwrapvalue(context, mapping, thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator. if isinstance(thing, types.GeneratorType): @@ -344,7 +344,7 @@ def evalboolean(context, mapping, arg): thing = stringutil.parsebool(data) else: thing = func(context, mapping, data) -thing = unwrapvalue(thing) +thing = unwrapvalue(context, mapping, thing) if isinstance(thing, bool): return thing # other objects are evaluated as strings, which means 0 is True, but ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 8 of 8 V2] templater: define interface for objects requiring unwrapvalue()
# HG changeset patch # User Yuya Nishihara# Date 1521288196 -32400 # Sat Mar 17 21:03:16 2018 +0900 # Node ID b9a554cd2c3bb5d0701f24c67d36e24386b54f6a # Parent 7404b3400212b00845411af13a69ac753bff6bb2 templater: define interface for objects requiring unwrapvalue() unwrapvalue() is changed to not return a lazy bytes generator for "wrapped" types because I want to define the tovalue() interface as such. It's a baby step to unify unwrapvalue() and _unwrapvalue(). diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -29,7 +29,11 @@ class TemplateNotFound(error.Abort): class wrapped(object): """Object requiring extra conversion prior to displaying or processing -as value""" +as value + +Use unwrapvalue(), unwrapastype(), or unwraphybrid() to obtain the inner +object. +""" __metaclass__ = abc.ABCMeta @@ -42,6 +46,13 @@ class wrapped(object): not printable. """ +@abc.abstractmethod +def tovalue(self, context, mapping): +"""Move the inner value object out or create a value representation + +A returned value must be serializable by templaterfilters.json(). +""" + # stub for representing a date type; may be a real date type that can # provide a readable string value class date(object): @@ -85,6 +96,10 @@ class hybrid(wrapped): return gen() return gen +def tovalue(self, context, mapping): +# TODO: return self._values and get rid of proxy methods +return self + def __contains__(self, x): return x in self._values def __getitem__(self, key): @@ -108,8 +123,7 @@ class mappable(wrapped): - "{manifest.rev}" Unlike a hybrid, this does not simulate the behavior of the underling -value. Use unwrapvalue(), unwrapastype(), or unwraphybrid() to obtain -the inner object. +value. """ def __init__(self, gen, key, value, makemap): @@ -133,6 +147,9 @@ class mappable(wrapped): return gen() return gen +def tovalue(self, context, mapping): +return _unthunk(context, mapping, self._value) + def hybriddict(data, key='key', value='value', fmt=None, gen=None): """Wrap data to support both dict-like and string-like operations""" prefmt = pycompat.identity @@ -159,9 +176,9 @@ def unwraphybrid(context, mapping, thing def unwrapvalue(context, mapping, thing): """Move the inner value object out of the wrapper""" -if not util.safehasattr(thing, '_value'): +if not isinstance(thing, wrapped): return thing -return thing._value +return thing.tovalue(context, mapping) def wraphybridvalue(container, key, value): """Wrap an element of hybrid container to be mappable ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 8 V2] templater: mark .gen as a private attribute
# HG changeset patch # User Yuya Nishihara# Date 1521287802 -32400 # Sat Mar 17 20:56:42 2018 +0900 # Node ID 2f4dc45b1eba20fbbbc80c59e2fcb2777eb68a7d # Parent b37a96bd6c1bcea5d24c6fc04a92fc6bd407e75e templater: mark .gen as a private attribute diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -61,12 +61,13 @@ class hybrid(wrapped): def __init__(self, gen, values, makemap, joinfmt, keytype=None): if gen is not None: -self.gen = gen # generator or function returning generator +self._gen = gen # generator or function returning generator self._values = values self._makemap = makemap self.joinfmt = joinfmt self.keytype = keytype # hint for 'x in y' where type(x) is unresolved -def gen(self): + +def _gen(self): """Default generator to stringify this as {join(self, ' ')}""" for i, x in enumerate(self._values): if i > 0: @@ -79,7 +80,7 @@ class hybrid(wrapped): def show(self, context, mapping): # TODO: switch gen to (context, mapping) API? -gen = self.gen +gen = self._gen if callable(gen): return gen() return gen @@ -113,12 +114,12 @@ class mappable(wrapped): def __init__(self, gen, key, value, makemap): if gen is not None: -self.gen = gen # generator or function returning generator +self._gen = gen # generator or function returning generator self._key = key self._value = value # may be generator of strings self._makemap = makemap -def gen(self): +def _gen(self): yield pycompat.bytestr(self._value) def tomap(self): @@ -129,7 +130,7 @@ class mappable(wrapped): def show(self, context, mapping): # TODO: switch gen to (context, mapping) API? -gen = self.gen +gen = self._gen if callable(gen): return gen() return gen ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 8 V2] templater: define interface for objects requiring unwraphybrid()
# HG changeset patch # User Yuya Nishihara# Date 1521287570 -32400 # Sat Mar 17 20:52:50 2018 +0900 # Node ID b02b53e4cc2049324d69e3c4a16357f79400a5e4 # Parent 164e39f1fc56cebdaa441458dfa6436939c97267 templater: define interface for objects requiring unwraphybrid() Prepares for introducing another hybrid-like data type. show() takes context as an argument so a wrapper class may render its items by pre-configured template: def show(self, context, mapping): return (context.expand(self._tmpl, mapping + lm) for lm in self._mappings) diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -7,6 +7,7 @@ from __future__ import absolute_import +import abc import types from .i18n import _ @@ -26,12 +27,27 @@ class ResourceUnavailable(error.Abort): class TemplateNotFound(error.Abort): pass +class wrapped(object): +"""Object requiring extra conversion prior to displaying or processing +as value""" + +__metaclass__ = abc.ABCMeta + +@abc.abstractmethod +def show(self, context, mapping): +"""Return a bytes or (possibly nested) generator of bytes representing +the underlying object + +A pre-configured template may be rendered if the underlying object is +not printable. +""" + # stub for representing a date type; may be a real date type that can # provide a readable string value class date(object): pass -class hybrid(object): +class hybrid(wrapped): """Wrapper for list or dict to support legacy template This class allows us to handle both: @@ -60,6 +76,14 @@ class hybrid(object): makemap = self._makemap for x in self._values: yield makemap(x) + +def show(self, context, mapping): +# TODO: switch gen to (context, mapping) API? +gen = self.gen +if callable(gen): +return gen() +return gen + def __contains__(self, x): return x in self._values def __getitem__(self, key): @@ -74,7 +98,7 @@ class hybrid(object): raise AttributeError(name) return getattr(self._values, name) -class mappable(object): +class mappable(wrapped): """Wrapper for non-list/dict object to support map operation This class allows us to handle both: @@ -103,6 +127,13 @@ class mappable(object): def itermaps(self): yield self.tomap() +def show(self, context, mapping): +# TODO: switch gen to (context, mapping) API? +gen = self.gen +if callable(gen): +return gen() +return gen + def hybriddict(data, key='key', value='value', fmt=None, gen=None): """Wrap data to support both dict-like and string-like operations""" prefmt = pycompat.identity @@ -123,12 +154,9 @@ def hybridlist(data, name, fmt=None, gen def unwraphybrid(context, mapping, thing): """Return an object which can be stringified possibly by using a legacy template""" -gen = getattr(thing, 'gen', None) -if gen is None: +if not isinstance(thing, wrapped): return thing -if callable(gen): -return gen() -return gen +return thing.show(context, mapping) def unwrapvalue(thing): """Move the inner value object out of the wrapper""" ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 8 V2] templatekw: do not directly call .gen
# HG changeset patch # User Yuya Nishihara# Date 1521299496 -32400 # Sun Mar 18 00:11:36 2018 +0900 # Node ID b37a96bd6c1bcea5d24c6fc04a92fc6bd407e75e # Parent b02b53e4cc2049324d69e3c4a16357f79400a5e4 templatekw: do not directly call .gen diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -613,10 +613,7 @@ def showsuccessorssets(context, mapping) # Format the successorssets def render(d): -t = [] -for i in d.gen(): -t.append(i) -return "".join(t) +return templateutil.stringify(context, mapping, d) def gen(data): yield "; ".join(render(d) for d in data) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 8 V2] templater: pass (context, mapping) down to unwraphybrid()
# HG changeset patch # User Yuya Nishihara# Date 1521284945 -32400 # Sat Mar 17 20:09:05 2018 +0900 # Node ID 164e39f1fc56cebdaa441458dfa6436939c97267 # Parent c118bb7c938ae92ffdfbab5ea977f1c029c87599 templater: pass (context, mapping) down to unwraphybrid() See the subsequent patches for why. I initially thought it would be wrong to pass a mapping to flatten() and stringify() since these functions may be applied to a tree of generators, where each node should be bound to the mapping when it was evaluated. But, actually that isn't a problem. If an intermediate node has to override a mapping dict, it can do on unwraphybrid() and yield "unwrapped" generator of byte strings: "{f(g(v))}" # literal template example. # g() want to override a mapping, so it returns a wrapped # object 'G{V}' with partial mapping 'lm' attached. ^^^# f() stringifies 'G{V}', starting from a mapping 'm'. # when unwrapping 'G{}', it updates 'm' with 'lm', and # passes it to 'V'. This structure is important for the formatter (and the hgweb) to build a static template keyword, which can't access a mapping dict until evaluation phase. diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -283,7 +283,8 @@ def ifcontains(context, mapping, args): keytype = getattr(haystack, 'keytype', None) try: needle = evalrawexp(context, mapping, args[0]) -needle = templateutil.unwrapastype(needle, keytype or bytes) +needle = templateutil.unwrapastype(context, mapping, needle, + keytype or bytes) found = (needle in haystack) except error.ParseError: found = False diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -679,7 +679,7 @@ class engine(object): if extramapping: extramapping.update(mapping) mapping = extramapping -return templateutil.flatten(func(self, mapping, data)) +return templateutil.flatten(self, mapping, func(self, mapping, data)) engines = {'default': engine} diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -120,7 +120,7 @@ def hybridlist(data, name, fmt=None, gen prefmt = pycompat.bytestr return hybrid(gen, data, lambda x: {name: x}, lambda x: fmt % prefmt(x)) -def unwraphybrid(thing): +def unwraphybrid(context, mapping, thing): """Return an object which can be stringified possibly by using a legacy template""" gen = getattr(thing, 'gen', None) @@ -241,9 +241,9 @@ def _showcompatlist(context, mapping, na if context.preload(endname): yield context.process(endname, mapping) -def flatten(thing): +def flatten(context, mapping, thing): """Yield a single stream from a possibly nested set of iterators""" -thing = unwraphybrid(thing) +thing = unwraphybrid(context, mapping, thing) if isinstance(thing, bytes): yield thing elif isinstance(thing, str): @@ -257,7 +257,7 @@ def flatten(thing): yield pycompat.bytestr(thing) else: for i in thing: -i = unwraphybrid(i) +i = unwraphybrid(context, mapping, i) if isinstance(i, bytes): yield i elif i is None: @@ -265,14 +265,14 @@ def flatten(thing): elif not util.safehasattr(i, '__iter__'): yield pycompat.bytestr(i) else: -for j in flatten(i): +for j in flatten(context, mapping, i): yield j -def stringify(thing): +def stringify(context, mapping, thing): """Turn values into bytes by converting into text and concatenating them""" if isinstance(thing, bytes): return thing # retain localstr to be round-tripped -return b''.join(flatten(thing)) +return b''.join(flatten(context, mapping, thing)) def findsymbolicname(arg): """Find symbolic name for the given compiled expression; returns None @@ -294,17 +294,17 @@ def evalrawexp(context, mapping, arg): def evalfuncarg(context, mapping, arg): """Evaluate given argument as value type""" -return _unwrapvalue(evalrawexp(context, mapping, arg)) +return _unwrapvalue(context, mapping, evalrawexp(context, mapping, arg)) # TODO: unify this with unwrapvalue() once the bug of templatefunc.join() # is fixed. we can't do that right now because join() has to take a generator # of byte strings as it is, not a lazy byte string. -def _unwrapvalue(thing): +def _unwrapvalue(context, mapping, thing): thing = unwrapvalue(thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator.
[PATCH] addremove: pass command-level similarity value down to scmutil.addremove()
# HG changeset patch # User Yuya Nishihara# Date 1522761890 -32400 # Tue Apr 03 22:24:50 2018 +0900 # Node ID c118bb7c938ae92ffdfbab5ea977f1c029c87599 # Parent 6ff8bd691fb8fd25a4e16ead04d13bcf7101e549 addremove: pass command-level similarity value down to scmutil.addremove() Since we've changed to carry a similarity value by opts dict, it makes sense to leave a string '0'-'100' value unmodified. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -247,13 +247,8 @@ def addremove(ui, repo, *pats, **opts): Returns 0 if all files are successfully added. """ opts = pycompat.byteskwargs(opts) -try: -sim = float(opts.get('similarity') or 100) -except ValueError: -raise error.Abort(_('similarity must be a number')) -if sim < 0 or sim > 100: -raise error.Abort(_('similarity must be between 0 and 100')) -opts['similarity'] = sim / 100.0 +if not opts.get('similarity'): +opts['similarity'] = '100' matcher = scmutil.match(repo[None], pats, opts) return scmutil.addremove(repo, matcher, "", opts) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -741,7 +741,13 @@ def addremove(repo, matcher, prefix, opt opts = {} m = matcher dry_run = opts.get('dry_run') -similarity = float(opts.get('similarity') or 0) +try: +similarity = float(opts.get('similarity') or 0) +except ValueError: +raise error.Abort(_('similarity must be a number')) +if similarity < 0 or similarity > 100: +raise error.Abort(_('similarity must be between 0 and 100')) +similarity /= 100.0 ret = 0 join = lambda f: os.path.join(prefix, f) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2948: wireproto: syntax for encoding CBOR into frames
durin42 added a comment. I have misgivings about this code that serves testing living in core, but I don't see a better solution offhand. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2948 To: indygreg, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3024: scmutil: add method for looking up a context given a revision symbol
martinvonz added a comment. In https://phab.mercurial-scm.org/D3024#48946, @yuja wrote: > Seems fine. > > What the final state of `repo[x]`, `x in repo`, and `repo.lookup(x)` will be? `repo.lookup(x)` will simply delegate to `scmutil.revsymbol(x)`. IIUC, `repo.lookup()` is there partly to serve the "lookup" wire protocol command, so it makes sense to me to have it call `scmutil.revsymbol()`. Btw, perhaps the reason one can't do `repo['.^']` is because `repo[x]` was backing the wire protocol command, and we didn't want to expose that functionality. If we remove support for looking up branches etc from `repo[x]`, then perhaps we can add it back to a new method, if we think that's useful enough. Since that new method won't be backing the wire protocol command, I think we might as well make it support revsets so `repo['.^']` would work. Note that there's already a `repo.changectx()` that seems to have very few users and perhaps we could repurpose it. `repo[x]` and `x in repo` won't change (but `changectx.__init__` will be much smaller), at least not to start with. Once `changectx.__init__` only accepts a nodeid or a revnum, then perhaps we should move that into `repo[x]`, but that's far down the road. I'm a little hesitant to drop support for `repo['.']` and tell people to use `repo.lookup('.')`, even though that seems like the right thing to do. In hindsight, I'm actually a little surprised we didn't have a function like revsymbol() before. It seems like an obvious thing to have, but I guess for historical reasons it ended up being inside changectx's constructor. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3024 To: martinvonz, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH STABLE] server: ensure the incoming request falls under the prefix value
On Mon, 02 Apr 2018 18:42:14 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1522560438 14400 > # Sun Apr 01 01:27:18 2018 -0400 > # Branch stable > # Node ID 0d5e334fc39e821a2dcd07db4d901adf37b4b80c > # Parent 177f3b90335fc49c23a8880de57dc865f0832849 > server: ensure the incoming request falls under the prefix value Queued for stable, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3000: addremove: remove dry_run, similarity from scmutil.addremove
This revision was automatically updated to reflect the committed changes. Closed by commit rHG14cd5290c4e6: addremove: remove dry_run, similarity from scmutil.addremove (API) (authored by khanchi97, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3000?vs=7524=7535#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3000?vs=7524=7535 REVISION DETAIL https://phab.mercurial-scm.org/D3000 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ def add(self, ui, match, prefix, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts, dry_run, similarity): +def addremove(self, matcher, prefix, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -510,15 +510,14 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts, dry_run, similarity): +def addremove(self, m, prefix, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts, - dry_run, similarity) + self.wvfs.reljoin(prefix, self._path), opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -736,14 +736,12 @@ if tostrip: repair.delayedstrip(repo.ui, repo, tostrip, operation) -def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): +def addremove(repo, matcher, prefix, opts=None): if opts is None: opts = {} m = matcher -if dry_run is None: -dry_run = opts.get('dry_run') -if similarity is None: -similarity = float(opts.get('similarity') or 0) +dry_run = opts.get('dry_run') +similarity = float(opts.get('similarity') or 0) ret = 0 join = lambda f: os.path.join(prefix, f) @@ -754,7 +752,7 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) try: -if sub.addremove(submatch, prefix, opts, dry_run, similarity): +if sub.addremove(submatch, prefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -253,8 +253,9 @@ raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: raise error.Abort(_('similarity must be between 0 and 100')) +opts['similarity'] = sim / 100.0 matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) +return scmutil.addremove(repo, matcher, "", opts) @command('^annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1214,12 +1214,11 @@ finally: repo.lfstatus = False -def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None, - similarity=None): +def scmutiladdremove(orig, repo, matcher, prefix, opts=None): if opts is None: opts = {} if not lfutil.islfilesrepo(repo): -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Get the list of missing largefiles so we can remove them lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), @@ -1250,7 +1249,7 @@ # function to take care of the rest. Make sure it doesn't do anything with # largefiles by passing a matcher that will ignore them. matcher = composenormalfilematcher(matcher, repo[None].manifest(), added) -return orig(repo, matcher, prefix, opts, dry_run, similarity) +return orig(repo, matcher, prefix, opts) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening. diff --git a/contrib/perf.py b/contrib/perf.py ---
D3032: narrow: add trailing slash to dir earlier for debug{revlog, index, data}
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6ff8bd691fb8: narrow: add trailing slash to dir earlier for debug{revlog,index,data} (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3032?vs=7533=7536 REVISION DETAIL https://phab.mercurial-scm.org/D3032 AFFECTED FILES hgext/narrow/narrowrevlog.py mercurial/cmdutil.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1160,8 +1160,6 @@ if dir: assert self._treeondisk, 'opts is %r' % opts -if not dir.endswith('/'): -dir = dir + '/' if indexfile is None: indexfile = '00manifest.i' diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1058,6 +1058,8 @@ if 'treemanifest' not in repo.requirements: raise error.Abort(_("--dir can only be used on repos with " "treemanifest enabled")) +if not dir.endswith('/'): +dir = dir + '/' dirlog = repo.manifestlog._revlog.dirlog(dir) if len(dirlog): r = dirlog diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -117,8 +117,6 @@ # at least some push operations. This will be used to wrap/exclude the # child directories when using treemanifests. def dirlog(self, d): -if d and not d.endswith('/'): -d = d + '/' if not repo.narrowmatch().visitdir(d[:-1] or '.'): return excludedmanifestrevlog(d) result = super(narrowmanifestrevlog, self).dirlog(d) To: martinvonz, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3024: scmutil: add method for looking up a context given a revision symbol
yuja added a comment. Seems fine. What the final state of `repo[x]`, `x in repo`, and `repo.lookup(x)` will be? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3024 To: martinvonz, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 8] rust-hglib: import the latest version and update URLs
On Mon, 2 Apr 2018 18:06:56 -0700, Gregory Szorc wrote: > On Mon, Apr 2, 2018 at 5:53 PM, Kevin Bullock < > kbullock+mercur...@ringworld.org> wrote: > > > On Apr 1, 2018, at 13:53, Gregory Szorcwrote: > > > On Sun, Apr 1, 2018 at 4:14 AM, Yuya Nishihara wrote: > > > # HG changeset patch > > > # User Kevin Bullock > > > # Date 1522477348 -32400 > > > # Sat Mar 31 15:22:28 2018 +0900 > > > # Node ID 9e25c96124d51e11022b0ce64783f5f333ede7fb > > > # Parent 2ed180117f7658d0cbf6a1ece20944465c55c947 > > > rust-hglib: import the latest version and update URLs > > > > > > Queued parts 1-3 because vendoring rust-hglib has been talked about and > > agreed upon IIRC. > > > > Hmm, it has? Have we talked about vendoring other hglibs (c-hglib, > > python-hglib)? > > > > I recall talking about consolidating them onto m-s.o. If we decide to > > vendor them into the hg repo I think we should talk more about source > > layout first, and start w/python-hglib. > > > > That being said, I'm excited to see interest around rust-hglib! > > > > I could be mistaken. > > Obviously since I queued this, I have no problems taking the hglib clients > into the main repo. I'm also fine putting rust-hglib on another repo on > m-s.o/repo. Dropped the patches from hg-committed for now. Only reason I vendored rust-hglib was otherwise it would get complicated to rewrite chg in Rust. But we can instead put chg into rust-hglib repository (or a temporary fork of it.) That's probably less controversial and easier to throw them away if the porting work turns out to be impractical. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3031: histedit: make errror message translatable
This revision was automatically updated to reflect the committed changes. Closed by commit rHGffa79073e4ca: histedit: make errror message translatable (authored by sangeet259, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3031?vs=7532=7534 REVISION DETAIL https://phab.mercurial-scm.org/D3031 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -436,7 +436,7 @@ rulehash = _ctx.hex() rev = node.bin(rulehash) except error.RepoLookupError: -raise error.ParseError("invalid changeset %s" % ruleid) +raise error.ParseError(_("invalid changeset %s") % ruleid) return cls(state, rev) def verify(self, prev, expected, seen): To: sangeet259, durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel