D3177: wireproto: crude support for version 2 HTTP peer
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As part of implementing the server-side bits of the wire protocol command handlers for version 2, we want a way to easily test those commands. Currently, we use the "httprequest" action of `hg debugwireproto`. But this requires explicitly specifying the HTTP request headers, low-level frame details, and the data structure to encode with CBOR. That's a lot of boilerplate and a lot of it can change as the wire protocol evolves. `hg debugwireproto` has a mechanism to issue commands via the peer interface. That is *much* easier to use and we prefer to test with that going forward. This commit implements enough parts of the peer API to send basic requests via the HTTP version 2 transport. The peer code is super hacky. Again, the goal is to facilitate server testing, not robustly implement a client. The client code will receive love at a later time. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3177 AFFECTED FILES mercurial/debugcommands.py mercurial/httppeer.py tests/test-http-api-httpv2.t tests/test-http-protocol.t tests/wireprotohelpers.sh CHANGE DETAILS diff --git a/tests/wireprotohelpers.sh b/tests/wireprotohelpers.sh --- a/tests/wireprotohelpers.sh +++ b/tests/wireprotohelpers.sh @@ -5,6 +5,10 @@ hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ } +sendhttpv2peer() { + hg --verbose debugwireproto --peer http2 http://$LOCALIP:$HGPORT/ +} + cat > dummycommands.py << EOF from mercurial import ( wireprototypes, diff --git a/tests/test-http-protocol.t b/tests/test-http-protocol.t --- a/tests/test-http-protocol.t +++ b/tests/test-http-protocol.t @@ -179,7 +179,7 @@ s> Accept-Encoding: identity\r\n s> accept: application/mercurial-0.1\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) - s> user-agent: mercurial/proto-1.0 (Mercurial *)\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n s> \r\n s> makefile('rb', None) s> HTTP/1.1 200 Script output follows\r\n @@ -197,7 +197,7 @@ s> x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n s> accept: application/mercurial-0.1\r\n s> host: $LOCALIP:$HGPORT\r\n (glob) - s> user-agent: mercurial/proto-1.0 (Mercurial *)\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n s> \r\n s> makefile('rb', None) s> HTTP/1.1 200 Script output follows\r\n 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 @@ -180,6 +180,36 @@ s> 0\r\n s> \r\n + $ sendhttpv2peer << EOF + > command customreadonly + > EOF + creating http peer for wire protocol version 2 + sending customreadonly command + s> POST /api/exp-http-v2-0001/ro/customreadonly HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 29\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> \x15\x00\x00\x01\x00\x01\x01\x11\xa1DnameNcustomreadonly + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 25\r\n + s> \x1d\x00\x00\x01\x00\x02\x01B + s> customreadonly bytes response + s> \r\n + received frame(size=29; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos) + s> 0\r\n + s> \r\n + response: [b'customreadonly bytes response'] + Request to read-write command fails because server is read-only by default GET to read-write request yields 405 diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -16,6 +16,9 @@ import tempfile from .i18n import _ +from .thirdparty import ( +cbor, +) from . import ( bundle2, error, @@ -25,6 +28,8 @@ url as urlmod, util, wireproto, +wireprotoframing, +wireprotoserver, ) httplib = util.httplib @@ -467,6 +472,95 @@ def _abort(self, exception): raise exception +# TODO implement interface for version 2 peers +class httpv2peer(object): +def __init__(self, ui, repourl, opener): +self.ui = ui + +if repourl.endswith('/'): +repourl = repourl[:-1] + +self.url = repourl +self._opener = opener +# This is an its own attribute to facilitate extensions overriding +# the default type. +self._requestbuilder = urlreq.request + +def close(self): +pass + +# TODO require to be part of a
D3184: wireproto: only expose "debugwireargs" to version 1 transports
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I'm not even sure this command should be enabled for version 1 transports. It is just a reflection endpoint for argument data. We definitely don't need to support it in version 2. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3184 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -931,7 +931,7 @@ return wireprototypes.streamres(gen=gen) @wireprotocommand('debugwireargs', 'one two *', - permission='pull') + permission='pull', transportpolicy=POLICY_V1_ONLY) def debugwireargs(repo, proto, one, two, others): # only accept optional args from the known set opts = options('debugwireargs', ['three', 'four'], others) 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
D3182: wireproto: port branchmap to wire protocol v2
indygreg 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/D3182 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireproto.py tests/test-wireproto-command-branchmap.t CHANGE DETAILS diff --git a/tests/test-wireproto-command-branchmap.t b/tests/test-wireproto-command-branchmap.t new file mode 100644 --- /dev/null +++ b/tests/test-wireproto-command-branchmap.t @@ -0,0 +1,72 @@ + $ . $TESTDIR/wireprotohelpers.sh + + $ hg init server + $ enablehttpv2 server + $ cd server + $ hg debugdrawdag << EOF + > C D + > |/ + > B + > | + > A + > EOF + + $ hg up B + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg branch branch1 + marked working directory as branch branch1 + (branches are permanent and global, did you want a bookmark?) + $ echo b1 > foo + $ hg -q commit -A -m 'branch 1' + $ hg up B + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg branch branch2 + marked working directory as branch branch2 + $ echo b2 > foo + $ hg -q commit -A -m 'branch 2' + + $ hg log -T '{rev}:{node} {branch} {desc}\n' + 5:224161c7589aa48fa83a48feff5e95b56ae327fc branch2 branch 2 + 4:b5faacdfd2633768cb3152336cc0953381266688 branch1 branch 1 + 3:be0ef73c17ade3fc89dc41701eb9fc3a91b58282 default D + 2:26805aba1e600a82e93661149f2313866a221a7b default C + 1:112478962961147124edd43549aedd1a335e44bf default B + 0:426bada5c67598ca65036d57d9e4b64b0c1ce7a0 default A + + $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log + $ cat hg.pid > $DAEMON_PIDS + +No arguments returns something reasonable + + $ sendhttpv2peer << EOF + > command branchmap + > EOF + creating http peer for wire protocol version 2 + sending branchmap command + s> POST /api/exp-http-v2-0001/ro/branchmap HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 24\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> \x10\x00\x00\x01\x00\x01\x01\x11\xa1DnameIbranchmap + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 78\r\n + s> p\x00\x00\x01\x00\x02\x01F + s> \xa3Gbranch1\x81T\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81\x88Gbranch2\x81T"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfcGdefault\x82T&\x80Z\xba\x1e`\n + s> \x82\xe96a\x14\x9f#\x13\x86j"\x1a{T\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82 + s> \r\n + received frame(size=112; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [{b'branch1': [b'\xb5\xfa\xac\xdf\xd2c7h\xcb1R3l\xc0\x953\x81\x88'], b'branch2': [b'"Aa\xc7X\x9a\xa4\x8f\xa8:H\xfe\xff^\x95\xb5j\xe3\'\xfc'], b'default': [b'&\x80Z\xba\x1e`\n\x82\xe96a\x14\x9f#\x13\x86j"\x1a{', b'\xbe\x0e\xf7<\x17\xad\xe3\xfc\x89\xdcAp\x1e\xb9\xfc:\x91\xb5\x82\x82']}] + + $ cat error.log diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -828,7 +828,8 @@ return wireprototypes.bytesresponse(''.join(r)) -@wireprotocommand('branchmap', permission='pull') +@wireprotocommand('branchmap', permission='pull', + transportpolicy=POLICY_V1_ONLY) def branchmap(repo, proto): branchmap = repo.branchmap() heads = [] @@ -1210,6 +1211,14 @@ # Wire protocol version 2 commands only past this point. +@wireprotocommand('branchmap', permission='pull', + transportpolicy=POLICY_V2_ONLY) +def branchmapv2(repo, proto): +branchmap = {encoding.fromlocal(k): v + for k, v in repo.branchmap().iteritems()} + +return wireprototypes.cborresponse(branchmap) + @wireprotocommand('heads', args='publiconly', permission='pull', transportpolicy=POLICY_V2_ONLY) def headsv2(repo, proto, publiconly=False): 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 @@ -1670,6 +1670,16 @@ TODO require node type be specified, as N bytes of binary node value could be ambiguous once SHA-1 is replaced. +branchmap +- + +Obtain heads in named branches. + +Receives no arguments. + +The response is a map with bytestring keys defining the branch name. +Values are arrays of bytestring defining raw changeset nodes. + heads - To: indygreg, #hg-reviewers Cc: mercurial-devel
D3183: wireproto: only expose "hello" command to version 1 transports
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This command is only ever used for the handshake in the SSH protocol. We probably don't even need for it to be a proper command. Let's not carry it forward to version 2 because I don't see a use for it there. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3183 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -1010,7 +1010,7 @@ h = repo.heads() return wireprototypes.bytesresponse(encodelist(h) + '\n') -@wireprotocommand('hello', permission='pull') +@wireprotocommand('hello', permission='pull', transportpolicy=POLICY_V1_ONLY) def hello(repo, proto): """Called as part of SSH handshake to obtain server info. 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
D3176: tests: extract wire protocol shell helpers to standalone file
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will make it easier for other tests to get up and running without the boilerplate. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3176 AFFECTED FILES tests/test-http-api-httpv2.t tests/wireprotohelpers.sh CHANGE DETAILS diff --git a/tests/wireprotohelpers.sh b/tests/wireprotohelpers.sh new file mode 100644 --- /dev/null +++ b/tests/wireprotohelpers.sh @@ -0,0 +1,41 @@ +HTTPV2=exp-http-v2-0001 +MEDIATYPE=application/mercurial-exp-framing-0003 + +sendhttpraw() { + hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ +} + +cat > dummycommands.py << EOF +from mercurial import ( +wireprototypes, +wireproto, +) + +@wireproto.wireprotocommand('customreadonly', permission='pull') +def customreadonly(repo, proto): +return wireprototypes.bytesresponse(b'customreadonly bytes response') + +@wireproto.wireprotocommand('customreadwrite', permission='push') +def customreadwrite(repo, proto): +return wireprototypes.bytesresponse(b'customreadwrite bytes response') +EOF + +cat >> $HGRCPATH << EOF +[extensions] +drawdag = $TESTDIR/drawdag.py +EOF + +enabledummycommands() { + cat >> $HGRCPATH << EOF +[extensions] +dummycommands = $TESTTMP/dummycommands.py +EOF +} + +enablehttpv2() { + cat >> $1/.hg/hgrc << EOF +[experimental] +web.apiserver = true +web.api.http-v2 = true +EOF +} 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 @@ -1,24 +1,5 @@ - $ HTTPV2=exp-http-v2-0001 - $ MEDIATYPE=application/mercurial-exp-framing-0003 - - $ send() { - > hg --verbose debugwireproto --peer raw http://$LOCALIP:$HGPORT/ - > } - - $ cat > dummycommands.py << EOF - > from mercurial import wireprototypes, wireproto - > @wireproto.wireprotocommand('customreadonly', permission='pull') - > def customreadonly(repo, proto): - > return wireprototypes.bytesresponse(b'customreadonly bytes response') - > @wireproto.wireprotocommand('customreadwrite', permission='push') - > def customreadwrite(repo, proto): - > return wireprototypes.bytesresponse(b'customreadwrite bytes response') - > EOF - - $ cat >> $HGRCPATH << EOF - > [extensions] - > dummycommands = $TESTTMP/dummycommands.py - > EOF + $ . $TESTDIR/wireprotohelpers.sh + $ enabledummycommands $ hg init server $ cat > server/.hg/hgrc << EOF @@ -30,7 +11,7 @@ HTTP v2 protocol not enabled by default - $ send << EOF + $ sendhttpraw << EOF > httprequest GET api/$HTTPV2 > user-agent: test > EOF @@ -52,18 +33,13 @@ Restart server with support for HTTP v2 API $ killdaemons.py - $ cat > server/.hg/hgrc << EOF - > [experimental] - > web.apiserver = true - > web.api.http-v2 = true - > EOF - + $ enablehttpv2 server $ hg -R server serve -p $HGPORT -d --pid-file hg.pid $ cat hg.pid > $DAEMON_PIDS Request to unknown command yields 404 - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/ro/badcommand > user-agent: test > EOF @@ -84,7 +60,7 @@ GET to read-only command yields a 405 - $ send << EOF + $ sendhttpraw << EOF > httprequest GET api/$HTTPV2/ro/customreadonly > user-agent: test > EOF @@ -105,7 +81,7 @@ Missing Accept header results in 406 - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > user-agent: test > EOF @@ -126,7 +102,7 @@ Bad Accept header results in 406 - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > accept: invalid > user-agent: test @@ -149,7 +125,7 @@ Bad Content-Type header results in 415 - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > accept: $MEDIATYPE > user-agent: test @@ -174,7 +150,7 @@ Request to read-only command works out of the box - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/ro/customreadonly > accept: $MEDIATYPE > content-type: $MEDIATYPE @@ -208,7 +184,7 @@ GET to read-write request yields 405 - $ send << EOF + $ sendhttpraw << EOF > httprequest GET api/$HTTPV2/rw/customreadonly > user-agent: test > EOF @@ -229,7 +205,7 @@ Even for unknown commands - $ send << EOF + $ sendhttpraw << EOF > httprequest GET api/$HTTPV2/rw/badcommand > user-agent: test > EOF @@ -250,7 +226,7 @@ SSL required by default - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/rw/customreadonly > user-agent: test > EOF @@ -285,7 +261,7 @@ Authorized request for valid read-write command works - $ send << EOF + $ sendhttpraw << EOF > httprequest POST api/$HTTPV2/rw/customreadonly > user-agent: test > accept: $MEDIATYPE @@ -317,7 +293,7 @@
D3180: wireproto: port keep command to wire protocol v2
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is pretty straightforward. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3180 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireproto.py tests/test-wireproto-command-known.t CHANGE DETAILS diff --git a/tests/test-wireproto-command-known.t b/tests/test-wireproto-command-known.t new file mode 100644 --- /dev/null +++ b/tests/test-wireproto-command-known.t @@ -0,0 +1,121 @@ + $ . $TESTDIR/wireprotohelpers.sh + + $ hg init server + $ enablehttpv2 server + $ cd server + $ hg debugdrawdag << EOF + > C D + > |/ + > B + > | + > A + > EOF + + $ hg log -T '{rev}:{node} {desc}\n' + 3:be0ef73c17ade3fc89dc41701eb9fc3a91b58282 D + 2:26805aba1e600a82e93661149f2313866a221a7b C + 1:112478962961147124edd43549aedd1a335e44bf B + 0:426bada5c67598ca65036d57d9e4b64b0c1ce7a0 A + + $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log + $ cat hg.pid > $DAEMON_PIDS + +No arguments returns something reasonable + + $ sendhttpv2peer << EOF + > command known + > EOF + creating http peer for wire protocol version 2 + sending known command + s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 20\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> \x0c\x00\x00\x01\x00\x01\x01\x11\xa1DnameEknown + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 9\r\n + s> \x01\x00\x00\x01\x00\x02\x01F + s> @ + s> \r\n + received frame(size=1; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [] + +Single known node works + + $ sendhttpv2peer << EOF + > command known + > nodes eval:[b'\x42\x6b\xad\xa5\xc6\x75\x98\xca\x65\x03\x6d\x57\xd9\xe4\xb6\x4b\x0c\x1c\xe7\xa0'] + > EOF + creating http peer for wire protocol version 2 + sending known command + s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 54\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> .\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1Enodes\x81TBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0DnameEknown + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> a\r\n + s> \x02\x00\x00\x01\x00\x02\x01F + s> A1 + s> \r\n + received frame(size=2; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [b'1'] + +Multiple nodes works + + $ sendhttpv2peer << EOF + > command known + > nodes eval:[b'\x42\x6b\xad\xa5\xc6\x75\x98\xca\x65\x03\x6d\x57\xd9\xe4\xb6\x4b\x0c\x1c\xe7\xa0', b'0' * 20, b'\x11\x24\x78\x96\x29\x61\x14\x71\x24\xed\xd4\x35\x49\xae\xdd\x1a\x33\x5e\x44\xbf'] + > EOF + creating http peer for wire protocol version 2 + sending known command + s> POST /api/exp-http-v2-0001/ro/known HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 96\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> X\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1Enodes\x83TBk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0TT\x11$x\x96)a\x14q$\xed\xd45I\xae\xdd\x1a3^D\xbfDnameEknown + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> c\r\n + s> \x04\x00\x00\x01\x00\x02\x01F + s> C101 + s> \r\n + received frame(size=4; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [b'101'] + + $ cat error.log diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++
D3181: wireproto: port listkeys commands to wire protocol v2
indygreg 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/D3181 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireproto.py tests/test-http-api-httpv2.t tests/test-wireproto-command-listkeys.t CHANGE DETAILS diff --git a/tests/test-wireproto-command-listkeys.t b/tests/test-wireproto-command-listkeys.t new file mode 100644 --- /dev/null +++ b/tests/test-wireproto-command-listkeys.t @@ -0,0 +1,125 @@ + $ . $TESTDIR/wireprotohelpers.sh + + $ hg init server + $ enablehttpv2 server + $ cd server + $ hg debugdrawdag << EOF + > C D + > |/ + > B + > | + > A + > EOF + + $ hg phase --public -r C + $ hg book -r C @ + + $ hg log -T '{rev}:{node} {desc}\n' + 3:be0ef73c17ade3fc89dc41701eb9fc3a91b58282 D + 2:26805aba1e600a82e93661149f2313866a221a7b C + 1:112478962961147124edd43549aedd1a335e44bf B + 0:426bada5c67598ca65036d57d9e4b64b0c1ce7a0 A + + $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log + $ cat hg.pid > $DAEMON_PIDS + +Request for namespaces works + + $ sendhttpv2peer << EOF + > command listkeys + > namespace namespaces + > EOF + creating http peer for wire protocol version 2 + sending listkeys command + s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 50\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> *\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1InamespaceJnamespacesDnameHlistkeys + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 28\r\n + s> \x00\x00\x01\x00\x02\x01F + s> \xa3Fphases@Ibookmarks@Jnamespaces@ + s> \r\n + received frame(size=32; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [{b'bookmarks': b'', b'namespaces': b'', b'phases': b''}] + +Request for phases works + + $ sendhttpv2peer << EOF + > command listkeys + > namespace phases + > EOF + creating http peer for wire protocol version 2 + sending listkeys command + s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 46\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> &\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1InamespaceFphasesDnameHlistkeys + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 45\r\n + s> =\x00\x00\x01\x00\x02\x01F + s> \xa2JpublishingDTrueX(be0ef73c17ade3fc89dc41701eb9fc3a91b58282A1 + s> \r\n + received frame(size=61; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [{b'be0ef73c17ade3fc89dc41701eb9fc3a91b58282': b'1', b'publishing': b'True'}] + +Request for bookmarks works + + $ sendhttpv2peer << EOF + > command listkeys + > namespace bookmarks + > EOF + creating http peer for wire protocol version 2 + sending listkeys command + s> POST /api/exp-http-v2-0001/ro/listkeys HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 49\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> )\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1InamespaceIbookmarksDnameHlistkeys + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 35\r\n + s> -\x00\x00\x01\x00\x02\x01F + s> \xa1A@X(26805aba1e600a82e93661149f2313866a221a7b + s> \r\n + received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [{b'@': b'26805aba1e600a82e93661149f2313866a221a7b'}] + + $ cat error.log diff --git a/tests/test-http-api-httpv2.t b/tests/test-http-api-httpv2.t ---
D3179: wireproto: port heads command to wire protocol v2
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY After much thought and consideration, wire protocol version 2's commands will be defined in different functions from the existing commands. This will make it easier to implement these commands because it won't require shoehorning things like response formatting and argument declaration into the same APIs. For example, wire protocol version 1 requires that commands declare a fixed and ordered list of argument names. It isn't really possible to insert new arguments or have optional arguments without breaking backwards compatibility. Wire protocol version 2, however, uses CBOR maps for passing arguments. So arguments a) can be optional b) can be added without BC c) can be strongly typed. This commit starts our trek towards reimplementing the wire protocol for version 2 with the heads command. It is pretty similar to the existing heads command. One added feature is it can be told to operate on only public phase changesets. This is useful for making discovery faster when a repo has tens of thousands of draft phase heads (such as Mozilla's "try" repository). The HTTPv2 server-side protocol has had its `getargs()` implementation updated to reflect that arguments are a map and not a list. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3179 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/wireproto.py mercurial/wireprotoframing.py mercurial/wireprotoserver.py mercurial/wireprototypes.py tests/test-wireproto-command-heads.t CHANGE DETAILS diff --git a/tests/test-wireproto-command-heads.t b/tests/test-wireproto-command-heads.t new file mode 100644 --- /dev/null +++ b/tests/test-wireproto-command-heads.t @@ -0,0 +1,96 @@ + $ . $TESTDIR/wireprotohelpers.sh + + $ hg init server + $ enablehttpv2 server + $ cd server + $ hg debugdrawdag << EOF + > H I J + > | | | + > E F G + > | |/ + > C D + > |/ + > B + > | + > A + > EOF + + $ hg phase --force --secret J + $ hg phase --public E + + $ hg log -r 'E + H + I + G + J' -T '{rev}:{node} {desc} {phase}\n' + 4:78d2dca436b2f5b188ac267e29b81e07266d38fc E public + 7:ae492e36b0c8339ffaf328d00b85b4525de1165e H draft + 8:1d6f6b91d44aaba6d5e580bc30a9948530dbe00b I draft + 6:29446d2dc5419c5f97447a8bc062e4cc328bf241 G draft + 9:dec04b246d7cbb670c6689806c05ad17c835284e J secret + + $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log + $ cat hg.pid > $DAEMON_PIDS + +All non-secret heads returned by default + + $ sendhttpv2peer << EOF + > command heads + > EOF + creating http peer for wire protocol version 2 + sending heads command + s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 20\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> \x0c\x00\x00\x01\x00\x01\x01\x11\xa1DnameEheads + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 48\r\n + s> @\x00\x00\x01\x00\x02\x01F + s> \x83T\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0bT\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^T)Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A + s> \r\n + received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) + s> 0\r\n + s> \r\n + response: [[b'\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0b', b'\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^', b')Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A']] + +Requesting just the public heads works + + $ sendhttpv2peer << EOF + > command heads + > publiconly 1 + > EOF + creating http peer for wire protocol version 2 + sending heads command + s> POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n + s> Accept-Encoding: identity\r\n + s> accept: application/mercurial-exp-framing-0003\r\n + s> content-type: application/mercurial-exp-framing-0003\r\n + s> content-length: 39\r\n + s> host: $LOCALIP:$HGPORT\r\n (glob) + s> user-agent: Mercurial debugwireproto\r\n + s> \r\n + s> \x1f\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1JpubliconlyA1DnameEheads + s> makefile('rb', None) + s> HTTP/1.1 200 OK\r\n + s> Server: testing stub value\r\n + s> Date: $HTTP_DATE$\r\n + s> Content-Type: application/mercurial-exp-framing-0003\r\n + s> Transfer-Encoding: chunked\r\n + s> \r\n + s> 1e\r\n + s>
D3178: largefiles: wrap heads command handler more directly
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY extensions.wrapfunction() is a more robust method for wrapping a function, since it allows multiple wrappers. While we're here, wrap the function registered with the command instead of installing a new command handler. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3178 AFFECTED FILES hgext/largefiles/proto.py hgext/largefiles/uisetup.py CHANGE DETAILS diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py --- a/hgext/largefiles/uisetup.py +++ b/hgext/largefiles/uisetup.py @@ -174,7 +174,7 @@ wireproto.heads) # ... and wrap some existing ones -wireproto.commands['heads'].func = proto.heads +extensions.wrapfunction(wireproto.commands['heads'], 'func', proto.heads) # TODO also wrap wireproto.commandsv2 once heads is implemented there. extensions.wrapfunction(webcommands, 'decodepath', overrides.decodepath) diff --git a/hgext/largefiles/proto.py b/hgext/largefiles/proto.py --- a/hgext/largefiles/proto.py +++ b/hgext/largefiles/proto.py @@ -168,12 +168,13 @@ caps.append('largefiles=serve') return caps -def heads(repo, proto): +def heads(orig, repo, proto): '''Wrap server command - largefile capable clients will know to call lheads instead''' if lfutil.islfilesrepo(repo): return wireprototypes.ooberror(LARGEFILES_REQUIRED_MSG) -return wireproto.heads(repo, proto) + +return orig(repo, proto) def sshrepocallstream(self, cmd, **args): if cmd == 'heads' and self.capable('largefiles'): 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
D3154: filelog: wrap revlog instead of inheriting it (API)
indygreg updated this revision to Diff 7860. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3154?vs=7768=7860 REVISION DETAIL https://phab.mercurial-scm.org/D3154 AFFECTED FILES mercurial/bundlerepo.py mercurial/filelog.py mercurial/unionrepo.py CHANGE DETAILS diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py --- a/mercurial/unionrepo.py +++ b/mercurial/unionrepo.py @@ -92,7 +92,7 @@ return mdiff.textdiff(self.revision(rev1), self.revision(rev2)) -def revision(self, nodeorrev, raw=False): +def revision(self, nodeorrev, _df=None, raw=False): """return an uncompressed revision of a given node or revision number. """ @@ -163,13 +163,15 @@ def baserevdiff(self, rev1, rev2): return manifest.manifestrevlog.revdiff(self, rev1, rev2) -class unionfilelog(unionrevlog, filelog.filelog): +class unionfilelog(filelog.filelog): def __init__(self, opener, path, opener2, linkmapper, repo): filelog.filelog.__init__(self, opener, path) filelog2 = filelog.filelog(opener2, path) -unionrevlog.__init__(self, opener, self.indexfile, filelog2, - linkmapper) +self._revlog = unionrevlog(opener, self.indexfile, + filelog2._revlog, linkmapper) self._repo = repo +self.repotiprev = self._revlog.repotiprev +self.revlog2 = self._revlog.revlog2 def baserevision(self, nodeorrev): return filelog.filelog.revision(self, nodeorrev) diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -11,18 +11,112 @@ interface as zi, ) from . import ( +error, repository, revlog, ) @zi.implementer(repository.ifilestorage) -class filelog(revlog.revlog): +class filelog(object): def __init__(self, opener, path): -super(filelog, self).__init__(opener, -"/".join(("data", path + ".i")), - censorable=True) +self._revlog = revlog.revlog(opener, + '/'.join(('data', path + '.i')), + censorable=True) # full name of the user visible file, relative to the repository root self.filename = path +self.index = self._revlog.index +self.version = self._revlog.version +self.storedeltachains = self._revlog.storedeltachains +self._generaldelta = self._revlog._generaldelta + +def __len__(self): +return len(self._revlog) + +def __iter__(self): +return self._revlog.__iter__() + +def revs(self, start=0, stop=None): +return self._revlog.revs(start=start, stop=stop) + +def parents(self, node): +return self._revlog.parents(node) + +def parentrevs(self, rev): +return self._revlog.parentrevs(rev) + +def rev(self, node): +return self._revlog.rev(node) + +def node(self, rev): +return self._revlog.node(rev) + +def lookup(self, node): +return self._revlog.lookup(node) + +def linkrev(self, rev): +return self._revlog.linkrev(rev) + +def flags(self, rev): +return self._revlog.flags(rev) + +def commonancestorsheads(self, node1, node2): +return self._revlog.commonancestorsheads(node1, node2) + +def descendants(self, revs): +return self._revlog.descendants(revs) + +def headrevs(self): +return self._revlog.headrevs() + +def heads(self, start=None, stop=None): +return self._revlog.heads(start, stop) + +def children(self, node): +return self._revlog.children(node) + +def deltaparent(self, rev): +return self._revlog.deltaparent(rev) + +def candelta(self, baserev, rev): +return self._revlog.candelta(baserev, rev) + +def iscensored(self, rev): +return self._revlog.iscensored(rev) + +def rawsize(self, rev): +return self._revlog.rawsize(rev) + +def checkhash(self, text, node, p1=None, p2=None, rev=None): +return self._revlog.checkhash(text, node, p1=p1, p2=p2, rev=rev) + +def revision(self, node, _df=None, raw=False): +return self._revlog.revision(node, _df=_df, raw=raw) + +def revdiff(self, rev1, rev2): +return self._revlog.revdiff(rev1, rev2) + +def addrevision(self, revisiondata, transaction, linkrev, p1, p2, +node=None, flags=revlog.REVIDX_DEFAULT_FLAGS, +cachedelta=None): +return self._revlog.addrevision(revisiondata, transaction, linkrev, +p1, p2, node=node, flags=flags, +cachedelta=cachedelta) + +def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None): +return self._revlog.addgroup(deltas, linkmapper, transaction, +
D3162: bookmarks: introduce a repo._bookmarks.changectx(mark) method and use it
This revision was automatically updated to reflect the committed changes. Closed by commit rHG81d35d5d35f9: bookmarks: introduce a repo._bookmarks.changectx(mark) method and use it (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3162?vs=7818=7856 REVISION DETAIL https://phab.mercurial-scm.org/D3162 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 @@ -119,6 +119,9 @@ def update(self, *others): raise error.ProgrammingError("use 'bookmarks.applychanges' instead") +def changectx(self, mark): +return self._repo[self[mark]] + def applychanges(self, repo, tr, changes): """Apply a list of changes to bookmarks """ @@ -212,8 +215,8 @@ return [] rev = self._repo[target].rev() anc = self._repo.changelog.ancestors([rev]) -bmctx = self._repo[self[mark]] -divs = [self._repo[b].node() for b in self +bmctx = self.changectx(mark) +divs = [self[b] for b in self if b.split('@', 1)[0] == mark.split('@', 1)[0]] # allow resolving a single divergent bookmark even if moving @@ -370,11 +373,11 @@ bmchanges = [] if marks[active] in parents: new = repo[node] -divs = [repo[b] for b in marks +divs = [marks.changectx(b) for b in marks if b.split('@', 1)[0] == active.split('@', 1)[0]] anc = repo.changelog.ancestors([new.rev()]) deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] -if validdest(repo, repo[marks[active]], new): +if validdest(repo, marks.changectx(active), new): bmchanges.append((active, new.node())) for bm in divergent2delete(repo, deletefrom, active): 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
D3163: discovery: look up bookmarks only among bookmarks
This revision was automatically updated to reflect the committed changes. Closed by commit rHG444ed53f93df: discovery: look up bookmarks only among bookmarks (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3163?vs=7819=7857 REVISION DETAIL https://phab.mercurial-scm.org/D3163 AFFECTED FILES mercurial/discovery.py CHANGE DETAILS diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -297,12 +297,12 @@ for bm in localbookmarks: rnode = remotebookmarks.get(bm) if rnode and rnode in repo: -lctx, rctx = repo[bm], repo[rnode] +lctx, rctx = localbookmarks.changectx(bm), repo[rnode] if bookmarks.validdest(repo, rctx, lctx): bookmarkedheads.add(lctx.node()) else: if bm in newbookmarks and bm not in remotebookmarks: -bookmarkedheads.add(repo[bm].node()) +bookmarkedheads.add(localbookmarks[bm]) return bookmarkedheads 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
D3164: destutil: look up bookmarks only among bookmarks
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2b38c80557a4: destutil: look up bookmarks only among bookmarks (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3164?vs=7791=7858 REVISION DETAIL https://phab.mercurial-scm.org/D3164 AFFECTED FILES mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -58,7 +58,7 @@ node = None activemark, movemark = bookmarks.calculateupdate(repo.ui, repo) if activemark is not None: -node = repo.lookup(activemark) +node = repo._bookmarks[activemark] return node, movemark, activemark def _destupdatebranch(repo, clean): @@ -236,7 +236,7 @@ """find merge destination in the active bookmark case""" node = None bmheads = bookmarks.headsforactive(repo) -curhead = repo[repo._activebookmark].node() +curhead = repo._bookmarks[repo._activebookmark] if len(bmheads) == 2: if curhead == bmheads[0]: node = bmheads[1] @@ -361,7 +361,7 @@ def _statusotherbook(ui, repo): bmheads = bookmarks.headsforactive(repo) -curhead = repo[repo._activebookmark].node() +curhead = repo._bookmarks[repo._activebookmark] if repo.revs('%n and parents()', curhead): # we are on the active bookmark bmheads = [b for b in bmheads if curhead != b] 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
D3165: infinitepush: look up bookmarks only among bookmarks
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2735d08e9788: infinitepush: look up bookmarks only among bookmarks (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3165?vs=7820=7859 REVISION DETAIL https://phab.mercurial-scm.org/D3165 AFFECTED FILES hgext/infinitepush/bundleparts.py CHANGE DETAILS diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py --- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -46,8 +46,9 @@ params['bookmark'] = bookmark # 'prevbooknode' is necessary for pushkey reply part params['bookprevnode'] = '' -if bookmark in repo: -params['bookprevnode'] = repo[bookmark].hex() +bookmarks = repo._bookmarks +if bookmark in bookmarks: +params['bookprevnode'] = bookmarks.changectx(bookmark).hex() # Do not send pushback bundle2 part with bookmarks if remotenames extension # is enabled. It will be handled manually in `_push()` To: martinvonz, #hg-reviewers, indygreg Cc: indygreg, smf, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3165: infinitepush: look up bookmarks only among bookmarks
indygreg added subscribers: smf, indygreg. indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. These changes all seem reasonable to me. And I'm pretty sure I use you and @smf discussing this in IRC. So LGTM. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3165 To: martinvonz, #hg-reviewers, indygreg Cc: indygreg, smf, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] py3: convert parsed message items to bytes in patch.extract()
# HG changeset patch # User Yuya Nishihara# Date 1523076157 -32400 # Sat Apr 07 13:42:37 2018 +0900 # Node ID e500a16779ebbd095bacc793a42ff57a91c47737 # Parent 5f401721fa2a4ba1e5b5ea570c9c0978481a20f7 py3: convert parsed message items to bytes in patch.extract() Appears that BytesParser() parses bytes into unicode, sigh. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -228,7 +228,8 @@ def extract(ui, fileobj): data['user'] = msg['From'] and mail.headdecode(msg['From']) if not subject and not data['user']: # Not an email, restore parsed headers if any -subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n' +subject = '\n'.join(': '.join(map(encoding.strtolocal, h)) +for h in msg.items()) + '\n' # should try to parse msg['Date'] parents = [] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] py3: byte-stringify test-import.t
# HG changeset patch # User Yuya Nishihara# Date 1523076392 -32400 # Sat Apr 07 13:46:32 2018 +0900 # Node ID b4c8e3550154dc61a5f6fbfac3bd8923c2b022f9 # Parent e500a16779ebbd095bacc793a42ff57a91c47737 py3: byte-stringify test-import.t Still the test doesn't pass. # skip-blame because just adding some b'' diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -1839,17 +1839,17 @@ Importing some extra header > import mercurial.cmdutil > > def processfoo(repo, data, extra, opts): - > if 'foo' in data: - > extra['foo'] = data['foo'] + > if b'foo' in data: + > extra[b'foo'] = data[b'foo'] > def postimport(ctx): - > if 'foo' in ctx.extra(): - > ctx.repo().ui.write('imported-foo: %s\n' % ctx.extra()['foo']) + > if b'foo' in ctx.extra(): + > ctx.repo().ui.write(b'imported-foo: %s\n' % ctx.extra()[b'foo']) > - > mercurial.patch.patchheadermap.append(('Foo', 'foo')) - > mercurial.cmdutil.extrapreimport.append('foo') - > mercurial.cmdutil.extrapreimportmap['foo'] = processfoo - > mercurial.cmdutil.extrapostimport.append('foo') - > mercurial.cmdutil.extrapostimportmap['foo'] = postimport + > mercurial.patch.patchheadermap.append((b'Foo', b'foo')) + > mercurial.cmdutil.extrapreimport.append(b'foo') + > mercurial.cmdutil.extrapreimportmap[b'foo'] = processfoo + > mercurial.cmdutil.extrapostimport.append(b'foo') + > mercurial.cmdutil.extrapostimportmap[b'foo'] = postimport > EOF $ cat >> $HGRCPATH < [extensions] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] py3: silence warning about deprecation of imp module
# HG changeset patch # User Yuya Nishihara# Date 1523074919 -32400 # Sat Apr 07 13:21:59 2018 +0900 # Node ID 5f401721fa2a4ba1e5b5ea570c9c0978481a20f7 # Parent a0d71618074f3c90180b4e6615544ab20b2cdda4 py3: silence warning about deprecation of imp module Well, we could fix that, but we aren't yet to reach the state caring about deprecation on the Python 3 line. So let's silence it for now to fix tons of "minor" Py2/3 incompatibilities by relying on our test suite. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -194,6 +194,9 @@ if _dowarn and pycompat.ispy3: r'mercurial') warnings.filterwarnings(r'ignore', r'invalid escape sequence', DeprecationWarning, r'mercurial') +# TODO: reinvent imp.is_frozen() +warnings.filterwarnings(r'ignore', r'the imp module is deprecated', +DeprecationWarning, r'mercurial') def nouideprecwarn(msg, version, stacklevel=1): """Issue an python native deprecation warning ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3154: filelog: wrap revlog instead of inheriting it (API)
indygreg added a comment. In https://phab.mercurial-scm.org/D3154#51010, @durin42 wrote: > test-unionrepo.t: > + t = self.revision(node) > +File "/tmp/hgtests.wmoy8H/install/lib/python/mercurial/filelog.py", line 93, in revision > + return self._revlog.revision(node, _df=_df, raw=raw) > + TypeError: revision() got an unexpected keyword argument '_df' > + [1] > I remember this error and I thought I fixed it! But alas I can reproduce locally. I must have fixed it on a different class. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3154 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
D2941: node: rename wdirnodes to clarify they are for manifest/filelogs
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd7114f883505: node: rename wdirnodes to clarify they are for manifest/filelogs (authored by yuja, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2941?vs=7282=7854 REVISION DETAIL https://phab.mercurial-scm.org/D2941 AFFECTED FILES mercurial/context.py mercurial/copies.py mercurial/node.py CHANGE DETAILS diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -30,7 +30,7 @@ addednodeid = ('0' * 15) + 'added' modifiednodeid = ('0' * 12) + 'modified' -wdirnodes = {newnodeid, addednodeid, modifiednodeid} +wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid} # pseudo identifiers for working directory # (they are experimental, so don't add too many dependencies on them) diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -280,7 +280,7 @@ ac = repo.changelog.ancestors(revs, inclusive=True) ctx._ancestrycontext = ac def makectx(f, n): -if n in node.wdirnodes: # in a working context? +if n in node.wdirfilenodeids: # in a working context? if ctx.rev() is None: return ctx.filectx(f) return repo[None][f] diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -22,8 +22,8 @@ nullid, nullrev, short, +wdirfilenodeids, wdirid, -wdirnodes, wdirrev, ) from . import ( @@ -138,7 +138,7 @@ removed.append(fn) elif flag1 != flag2: modified.append(fn) -elif node2 not in wdirnodes: +elif node2 not in wdirfilenodeids: # When comparing files between two commits, we save time by # not comparing the file contents when the nodeids differ. # Note that this means we incorrectly report a reverted change To: yuja, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2942: revlog: detect pseudo file nodeids to raise WdirUnsupported exception
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa0d71618074f: revlog: detect pseudo file nodeids to raise WdirUnsupported exception (authored by yuja, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2942?vs=7283=7855 REVISION DETAIL https://phab.mercurial-scm.org/D2942 AFFECTED FILES mercurial/revlog.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -245,7 +245,7 @@ $ hg stat M port2 $ hg grep -r 'wdir()' port - abort: data/port2.i@303030303030: no node! + abort: working directory revision cannot be specified [255] $ cd .. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -29,6 +29,7 @@ hex, nullid, nullrev, +wdirfilenodeids, wdirhex, wdirid, wdirrev, @@ -807,7 +808,7 @@ raise except RevlogError: # parsers.c radix tree lookup failed -if node == wdirid: +if node == wdirid or node in wdirfilenodeids: raise error.WdirUnsupported raise LookupError(node, self.indexfile, _('no node')) except KeyError: @@ -823,7 +824,7 @@ if v == node: self._nodepos = r - 1 return r -if node == wdirid: +if node == wdirid or node in wdirfilenodeids: raise error.WdirUnsupported raise LookupError(node, self.indexfile, _('no node')) @@ -1436,6 +1437,7 @@ pass def _partialmatch(self, id): +# we don't care wdirfilenodeids as they should be always full hash maybewdir = wdirhex.startswith(id) try: partial = self.index.partialmatch(id) @@ -2114,7 +2116,7 @@ if node == nullid: raise RevlogError(_("%s: attempt to add null revision") % (self.indexfile)) -if node == wdirid: +if node == wdirid or node in wdirfilenodeids: raise RevlogError(_("%s: attempt to add wdir revision") % (self.indexfile)) To: yuja, 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
D2940: workingctx: build _manifest on filenode() or flags() request
This revision was automatically updated to reflect the committed changes. Closed by commit rHG067e8d1178a2: workingctx: build _manifest on filenode() or flags() request (authored by yuja, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2940?vs=7281=7853 REVISION DETAIL https://phab.mercurial-scm.org/D2940 AFFECTED FILES mercurial/context.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -237,6 +237,17 @@ $ hg grep -f port [1] +Test wdir +(at least, this shouldn't crash) + + $ hg up -q + $ echo wport >> port2 + $ hg stat + M port2 + $ hg grep -r 'wdir()' port + abort: data/port2.i@303030303030: no node! + [255] + $ cd .. $ hg init t2 $ cd t2 diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1330,6 +1330,11 @@ p = p[:-1] return [changectx(self._repo, x) for x in p] +def _fileinfo(self, path): +# populate __dict__['_manifest'] as workingctx has no _manifestdelta +self._manifest +return super(workingctx, self)._fileinfo(path) + def filectx(self, path, filelog=None): """get a file context from the working directory""" return workingfilectx(self._repo, path, workingctx=self, To: yuja, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3168: tests: enter full hex hash in plain text in bundle part
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd46d4f14300a: tests: enter full hex hash in plain text in bundle part (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3168?vs=7805=7852 REVISION DETAIL https://phab.mercurial-scm.org/D3168 AFFECTED FILES tests/test-bundle2-exchange.t CHANGE DETAILS diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -787,7 +787,7 @@ > enc = pushkey.encode > part = bundler.newpart('pushkey') > part.addparam('namespace', enc('phases')) - > part.addparam('key', enc(pushop.repo['cd010b8cd998'].hex())) + > part.addparam('key', enc('cd010b8cd998f3981a5a8115f94f8da4ab506089')) > part.addparam('old', enc(str(0))) # successful update > part.addparam('new', enc(str(0))) > def fail(pushop, exc): To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3154: filelog: wrap revlog instead of inheriting it (API)
durin42 added a comment. test-unionrepo.t: + t = self.revision(node) +File "/tmp/hgtests.wmoy8H/install/lib/python/mercurial/filelog.py", line 93, in revision + return self._revlog.revision(node, _df=_df, raw=raw) + TypeError: revision() got an unexpected keyword argument '_df' + [1] REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3154 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
D3117: tests: make test-convert-git.t more deterministic
indygreg added a comment. In https://phab.mercurial-scm.org/D3117#50998, @durin42 wrote: > This seems to break things with git 1.8.3.1, which is what's on gcc112. Should we just ratchet our test requirements forward, or try and figure out what changed? You can drop it for now. I don’t think it is important to the series. I was just poking around as part of investigating a test failure. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3117 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
D3117: tests: make test-convert-git.t more deterministic
durin42 added a comment. This seems to break things with git 1.8.3.1, which is what's on gcc112. Should we just ratchet our test requirements forward, or try and figure out what changed? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3117 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
D3147: tests: run some largefiles and lfs tests with simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHG556984ae0005: tests: run some largefiles and lfs tests with simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3147?vs=7761=7845 REVISION DETAIL https://phab.mercurial-scm.org/D3147 AFFECTED FILES tests/test-largefiles-cache.t tests/test-largefiles-misc.t tests/test-largefiles-small-disk.t tests/test-largefiles-wireproto.t tests/test-largefiles.t tests/test-lfconvert.t tests/test-lfs-bundle.t CHANGE DETAILS 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,5 +1,3 @@ -#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,5 +1,3 @@ -#require no-reposimplestore - $ USERCACHE="$TESTTMP/cache"; export USERCACHE $ mkdir "${USERCACHE}" $ cat >> $HGRCPATH < criple.py
D3152: upgrade: sniff for filelog type
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc8666a9e9e11: upgrade: sniff for filelog type (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3152?vs=7766=7850 REVISION DETAIL https://phab.mercurial-scm.org/D3152 AFFECTED FILES mercurial/upgrade.py CHANGE DETAILS diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -480,11 +480,13 @@ mrevcount += len(rl) msrcsize += datasize mrawsize += rawsize -elif isinstance(rl, revlog.revlog): +elif isinstance(rl, filelog.filelog): fcount += 1 frevcount += len(rl) fsrcsize += datasize frawsize += rawsize +else: +error.ProgrammingError('unknown revlog type') if not revcount: return 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
D3119: commands: don't violate storage abstractions in `manifest --all`
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7b7ca9ba2de5: commands: dont violate storage abstractions in `manifest --all` (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3119?vs=7760=7844 REVISION DETAIL https://phab.mercurial-scm.org/D3119 AFFECTED FILES mercurial/commands.py tests/test-convert-git.t tests/test-manifest.t CHANGE DETAILS diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -68,9 +68,9 @@ l $ hg manifest --all - a (no-reposimplestore !) - b/a (no-reposimplestore !) - l (no-reposimplestore !) + a + b/a + l The next two calls are expected to abort: diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t --- a/tests/test-convert-git.t +++ b/tests/test-convert-git.t @@ -878,7 +878,7 @@ $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True $ hg -R no-submodules manifest --all - .gitmodules-renamed (no-reposimplestore !) + .gitmodules-renamed convert using a different remote prefix $ git init git-repo7 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3491,19 +3491,13 @@ if rev or node: raise error.Abort(_("can't specify a revision with --all")) -res = [] -# TODO this is a massive layering violation. It assumes the repo is -# backed by revlogs with a well-defined naming scheme. -prefix = "data/" -suffix = ".i" -plen = len(prefix) -slen = len(suffix) -with repo.lock(): -for fn, b, size in repo.store.datafiles(): -if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: -res.append(fn[plen:-slen]) +res = set() +for rev in repo: +ctx = repo[rev] +res |= set(ctx.files()) + ui.pager('manifest') -for f in res: +for f in sorted(res): fm.startitem() fm.write("path", '%s\n', f) fm.end() 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
D3151: revlog: move censor logic into main revlog class
This revision was automatically updated to reflect the committed changes. Closed by commit rHG65250a66b55c: revlog: move censor logic into main revlog class (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3151?vs=7765=7849 REVISION DETAIL https://phab.mercurial-scm.org/D3151 AFFECTED FILES mercurial/filelog.py mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -117,6 +117,10 @@ metatext = "".join("%s: %s\n" % (k, meta[k]) for k in keys) return "\1\n%s\1\n%s" % (metatext, text) +def _censoredtext(text): +m, offs = parsemeta(text) +return m and "censored" in m + def addflagprocessor(flag, processor): """Register a flag processor on a revision data flag. @@ -574,9 +578,11 @@ If mmaplargeindex is True, and an mmapindexthreshold is set, the index will be mmapped rather than read if it is larger than the configured threshold. + +If censorable is True, the revlog can have censored revisions. """ def __init__(self, opener, indexfile, datafile=None, checkambig=False, - mmaplargeindex=False): + mmaplargeindex=False, censorable=False): """ create a revlog object @@ -589,6 +595,7 @@ # When True, indexfile is opened with checkambig=True at writing, to # avoid file stat ambiguity. self._checkambig = checkambig +self._censorable = censorable # 3-tuple of (node, rev, text) for a raw revision. self._cache = None # Maps rev to chain base rev. @@ -1867,14 +1874,19 @@ Available as a function so that subclasses can extend hash mismatch behaviors as needed. """ -if p1 is None and p2 is None: -p1, p2 = self.parents(node) -if node != self.hash(text, p1, p2): -revornode = rev -if revornode is None: -revornode = templatefilters.short(hex(node)) -raise RevlogError(_("integrity check failed on %s:%s") -% (self.indexfile, pycompat.bytestr(revornode))) +try: +if p1 is None and p2 is None: +p1, p2 = self.parents(node) +if node != self.hash(text, p1, p2): +revornode = rev +if revornode is None: +revornode = templatefilters.short(hex(node)) +raise RevlogError(_("integrity check failed on %s:%s") +% (self.indexfile, pycompat.bytestr(revornode))) +except RevlogError: +if self._censorable and _censoredtext(text): +raise error.CensoredNodeError(self.indexfile, node, text) +raise def _enforceinlinesize(self, tr, fp=None): """Check if the revlog is too big for inline and convert if so. @@ -2300,11 +2312,33 @@ def iscensored(self, rev): """Check if a file revision is censored.""" -return False +if not self._censorable: +return False + +return self.flags(rev) & REVIDX_ISCENSORED def _peek_iscensored(self, baserev, delta, flush): """Quickly check if a delta produces a censored revision.""" -return False +if not self._censorable: +return False + +# Fragile heuristic: unless new file meta keys are added alphabetically +# preceding "censored", all censored revisions are prefixed by +# "\1\ncensored:". A delta producing such a censored revision must be a +# full-replacement delta, so we inspect the first and only patch in the +# delta for this prefix. +hlen = struct.calcsize(">lll") +if len(delta) <= hlen: +return False + +oldlen = self.rawsize(baserev) +newlen = len(delta) - hlen +if delta[:hlen] != mdiff.replacediffheader(oldlen, newlen): +return False + +add = "\1\ncensored:" +addlen = len(add) +return newlen >= addlen and delta[hlen:hlen + addlen] == add def getstrippoint(self, minlink): """find the minimum rev that must be stripped to strip the linkrev diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -7,27 +7,20 @@ from __future__ import absolute_import -import struct - from .thirdparty.zope import ( interface as zi, ) from . import ( -error, -mdiff, repository, revlog, ) -def _censoredtext(text): -m, offs = revlog.parsemeta(text) -return m and "censored" in m - @zi.implementer(repository.ifilestorage) class filelog(revlog.revlog): def __init__(self, opener, path): super(filelog, self).__init__(opener, -"/".join(("data", path + ".i"))) +"/".join(("data", path + ".i")), +
D3118: commands: document the layering violation in `manifest --all`
This revision was automatically updated to reflect the committed changes. Closed by commit rHG814e080a1215: commands: document the layering violation in `manifest --all` (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3118?vs=7700=7843 REVISION DETAIL https://phab.mercurial-scm.org/D3118 AFFECTED FILES mercurial/commands.py tests/test-convert-git.t tests/test-manifest.t CHANGE DETAILS diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -1,5 +1,3 @@ -#require repobundlerepo - Source bundle was generated with the following script: # hg init @@ -12,7 +10,13 @@ # hg ci -Amb -d'1 0' $ hg init - $ hg -q pull "$TESTDIR/bundles/test-manifest.hg" + $ hg unbundle "$TESTDIR/bundles/test-manifest.hg" + adding changesets + adding manifests + adding file changes + added 2 changesets with 3 changes to 3 files + new changesets b73562a03cfe:5bdc995175ba + (run 'hg update' to get a working copy) The next call is expected to return nothing: @@ -64,9 +68,9 @@ l $ hg manifest --all - a - b/a - l + a (no-reposimplestore !) + b/a (no-reposimplestore !) + l (no-reposimplestore !) The next two calls are expected to abort: diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t --- a/tests/test-convert-git.t +++ b/tests/test-convert-git.t @@ -878,7 +878,7 @@ $ hg convert -q git-repo6 no-submodules --config convert.git.skipsubmodules=True $ hg -R no-submodules manifest --all - .gitmodules-renamed + .gitmodules-renamed (no-reposimplestore !) convert using a different remote prefix $ git init git-repo7 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3492,6 +3492,8 @@ raise error.Abort(_("can't specify a revision with --all")) res = [] +# TODO this is a massive layering violation. It assumes the repo is +# backed by revlogs with a well-defined naming scheme. prefix = "data/" suffix = ".i" plen = len(prefix) 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
D3150: revlog: move parsemeta() and packmeta() from filelog (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0596d27457c6: revlog: move parsemeta() and packmeta() from filelog (API) (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3150?vs=7769=7848 REVISION DETAIL https://phab.mercurial-scm.org/D3150 AFFECTED FILES hgext/censor.py hgext/lfs/wrapper.py mercurial/filelog.py mercurial/revlog.py tests/simplestorerepo.py CHANGE DETAILS diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -32,7 +32,6 @@ bundlerepo, error, extensions, -filelog, localrepo, mdiff, pycompat, @@ -326,7 +325,7 @@ return False fulltext = self.revision(node) -m = filelog.parsemeta(fulltext)[0] +m = revlog.parsemeta(fulltext)[0] if m and 'copy' in m: return m['copy'], bin(m['copyrev']) @@ -415,7 +414,7 @@ def add(self, text, meta, transaction, linkrev, p1, p2): if meta or text.startswith(b'\1\n'): -text = filelog.packmeta(meta, text) +text = revlog.packmeta(meta, text) return self.addrevision(text, transaction, linkrev, p1, p2) diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -19,6 +19,7 @@ import hashlib import heapq import os +import re import struct import zlib @@ -97,6 +98,25 @@ REVIDX_ISCENSORED: None, } +_mdre = re.compile('\1\n') +def parsemeta(text): +"""return (metadatadict, metadatasize)""" +# text can be buffer, so we can't use .startswith or .index +if text[:2] != '\1\n': +return None, None +s = _mdre.search(text, 2).start() +mtext = text[2:s] +meta = {} +for l in mtext.splitlines(): +k, v = l.split(": ", 1) +meta[k] = v +return meta, (s + 2) + +def packmeta(meta, text): +keys = sorted(meta) +metatext = "".join("%s: %s\n" % (k, meta[k]) for k in keys) +return "\1\n%s\1\n%s" % (metatext, text) + def addflagprocessor(flag, processor): """Register a flag processor on a revision data flag. diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -7,7 +7,6 @@ from __future__ import absolute_import -import re import struct from .thirdparty.zope import ( @@ -20,27 +19,8 @@ revlog, ) -_mdre = re.compile('\1\n') -def parsemeta(text): -"""return (metadatadict, metadatasize)""" -# text can be buffer, so we can't use .startswith or .index -if text[:2] != '\1\n': -return None, None -s = _mdre.search(text, 2).start() -mtext = text[2:s] -meta = {} -for l in mtext.splitlines(): -k, v = l.split(": ", 1) -meta[k] = v -return meta, (s + 2) - -def packmeta(meta, text): -keys = sorted(meta) -metatext = "".join("%s: %s\n" % (k, meta[k]) for k in keys) -return "\1\n%s\1\n%s" % (metatext, text) - def _censoredtext(text): -m, offs = parsemeta(text) +m, offs = revlog.parsemeta(text) return m and "censored" in m @zi.implementer(repository.ifilestorage) @@ -60,14 +40,14 @@ def add(self, text, meta, transaction, link, p1=None, p2=None): if meta or text.startswith('\1\n'): -text = packmeta(meta, text) +text = revlog.packmeta(meta, text) return self.addrevision(text, transaction, link, p1, p2) def renamed(self, node): if self.parents(node)[0] != revlog.nullid: return False t = self.revision(node) -m = parsemeta(t)[0] +m = revlog.parsemeta(t)[0] if m and "copy" in m: return (m["copy"], revlog.bin(m["copyrev"])) return False diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -14,7 +14,6 @@ from mercurial import ( error, -filelog, revlog, util, ) @@ -69,13 +68,13 @@ name = k[len('x-hg-'):] hgmeta[name] = p[k] if hgmeta or text.startswith('\1\n'): -text = filelog.packmeta(hgmeta, text) +text = revlog.packmeta(hgmeta, text) return (text, True) def writetostore(self, text): # hg filelog metadata (includes rename, etc) -hgmeta, offset = filelog.parsemeta(text) +hgmeta, offset = revlog.parsemeta(text) if offset and offset > 0: # lfs blob does not contain hg filelog metadata text = text[offset:] @@ -121,7 +120,7 @@ flags=revlog.REVIDX_DEFAULT_FLAGS, **kwds): textlen = len(text) # exclude hg rename meta from file size -meta, offset = filelog.parsemeta(text) +meta, offset = revlog.parsemeta(text) if offset: textlen -= offset diff --git a/hgext/censor.py b/hgext/censor.py --- a/hgext/censor.py
D3153: tests: call rawsize() directly
This revision was automatically updated to reflect the committed changes. Closed by commit rHGcc4b569975ed: tests: call rawsize() directly (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3153?vs=7767=7851 REVISION DETAIL https://phab.mercurial-scm.org/D3153 AFFECTED FILES 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 @@ -630,7 +630,7 @@ > fl = repo.file(name) > if len(fl) == 0: > continue - > sizes = [revlog.revlog.rawsize(fl, i) for i in fl] + > sizes = [fl.rawsize(i) for i in fl] > texts = [fl.revision(i, raw=True) for i in fl] > flags = [int(fl.flags(i)) for i in fl] > hashes = [hash(t) for t in texts] To: indygreg, #hg-reviewers, durin42 Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3148: repository: define existing interface for file storage
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4335a75f0bd0: repository: define existing interface for file storage (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3148?vs=7762=7846 REVISION DETAIL https://phab.mercurial-scm.org/D3148 AFFECTED FILES mercurial/repository.py CHANGE DETAILS diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -251,6 +251,334 @@ class legacypeer(peer): """peer but with support for legacy wire protocol commands.""" +class ifilerevisionssequence(zi.Interface): +"""Contains index data for all revisions of a file. + +Types implementing this behave like lists of tuples. The index +in the list corresponds to the revision number. The values contain +index metadata. + +The *null* revision (revision number -1) is always the last item +in the index. +""" + +def __len__(): +"""The total number of revisions.""" + +def __getitem__(rev): +"""Returns the object having a specific revision number. + +Returns an 8-tuple with the following fields: + +offset+flags + Contains the offset and flags for the revision. 64-bit unsigned + integer where first 6 bytes are the offset and the next 2 bytes + are flags. The offset can be 0 if it is not used by the store. +compressed size +Size of the revision data in the store. It can be 0 if it isn't +needed by the store. +uncompressed size +Fulltext size. It can be 0 if it isn't needed by the store. +base revision +Revision number of revision the delta for storage is encoded +against. -1 indicates not encoded against a base revision. +link revision +Revision number of changelog revision this entry is related to. +p1 revision +Revision number of 1st parent. -1 if no 1st parent. +p2 revision +Revision number of 2nd parent. -1 if no 1st parent. +node +Binary node value for this revision number. + +Negative values should index off the end of the sequence. ``-1`` +should return the null revision. ``-2`` should return the most +recent revision. +""" + +def __contains__(rev): +"""Whether a revision number exists.""" + +def insert(self, i, entry): +"""Add an item to the index at specific revision.""" + +class ifileindex(zi.Interface): +"""Storage interface for index data of a single file. + +File storage data is divided into index metadata and data storage. +This interface defines the index portion of the interface. + +The index logically consists of: + +* A mapping between revision numbers and nodes. +* DAG data (storing and querying the relationship between nodes). +* Metadata to facilitate storage. +""" +index = zi.Attribute( +"""An ``ifilerevisionssequence`` instance.""") + +def __len__(): +"""Obtain the number of revisions stored for this file.""" + +def __iter__(): +"""Iterate over revision numbers for this file.""" + +def revs(start=0, stop=None): +"""Iterate over revision numbers for this file, with control.""" + +def parents(node): +"""Returns a 2-tuple of parent nodes for a revision. + +Values will be ``nullid`` if the parent is empty. +""" + +def parentrevs(rev): +"""Like parents() but operates on revision numbers.""" + +def rev(node): +"""Obtain the revision number given a node. + +Raises ``error.LookupError`` if the node is not known. +""" + +def node(rev): +"""Obtain the node value given a revision number. + +Raises ``IndexError`` if the node is not known. +""" + +def lookup(node): +"""Attempt to resolve a value to a node. + +Value can be a binary node, hex node, revision number, or a string +that can be converted to an integer. + +Raises ``error.LookupError`` if a node could not be resolved. +""" + +def linkrev(rev): +"""Obtain the changeset revision number a revision is linked to.""" + +def flags(rev): +"""Obtain flags used to affect storage of a revision.""" + +def iscensored(rev): +"""Return whether a revision's content has been censored.""" + +def commonancestorsheads(node1, node2): +"""Obtain an iterable of nodes containing heads of common ancestors. + +See ``ancestor.commonancestorsheads()``. +""" + +def descendants(revs): +"""Obtain descendant revision numbers for a set of revision numbers. + +If ``nullrev`` is in the set, this is equivalent to ``revs()``. +""" + +def headrevs(): +"""Obtain a list of
D3114: tests: work around potential repo incompatibility
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3fbd8b862d66: tests: work around potential repo incompatibility (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3114?vs=7696=7840 REVISION DETAIL https://phab.mercurial-scm.org/D3114 AFFECTED FILES tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -558,7 +558,12 @@ Verify that we can try other ports === - $ hg init inuse + +Extensions aren't inherited by the invoked run-tests.py. An extension +introducing a repository requirement could cause this to fail. So we force +HGRCPATH to get a clean environment. + + $ HGRCPATH= hg init inuse $ hg serve -R inuse -p $HGPORT -d --pid-file=blocks.pid $ cat blocks.pid >> $DAEMON_PIDS $ cat > test-serve-inuse.t
D3112: tests: conditionalize test-treemanifest.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG28ee8b28b213: tests: conditionalize test-treemanifest.t (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3112?vs=7694=7839 REVISION DETAIL https://phab.mercurial-scm.org/D3112 AFFECTED FILES 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 @@ -474,7 +474,12 @@ Test files for a subdirectory. +#if reporevlogstore $ rm -r .hg/store/meta/~2e_a +#endif +#if reposimplestore + $ rm -r .hg/store/meta/._a +#endif $ hg files -r . b b/bar/fruits.txt b/bar/orange/fly/gnat.py @@ -490,7 +495,12 @@ Test files with just includes and excludes. +#if reporevlogstore $ rm -r .hg/store/meta/~2e_a +#endif +#if reposimplestore + $ rm -r .hg/store/meta/._a +#endif $ rm -r .hg/store/meta/b/bar/orange/fly $ rm -r .hg/store/meta/b/foo/apple/bees $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees @@ -502,7 +512,12 @@ Test files for a subdirectory, excluding a directory within it. +#if reporevlogstore $ rm -r .hg/store/meta/~2e_a +#endif +#if reposimplestore + $ rm -r .hg/store/meta/._a +#endif $ rm -r .hg/store/meta/b/foo $ hg files -r . -X path:b/foo b b/bar/fruits.txt @@ -518,7 +533,12 @@ Test files for a sub directory, including only a directory within it, and including an unrelated directory. +#if reporevlogstore $ rm -r .hg/store/meta/~2e_a +#endif +#if reposimplestore + $ rm -r .hg/store/meta/._a +#endif $ rm -r .hg/store/meta/b/foo $ hg files -r . -I path:b/bar/orange -I path:a b b/bar/orange/fly/gnat.py @@ -532,7 +552,12 @@ Test files for a pattern, including a directory, and excluding a directory within that. +#if reporevlogstore $ rm -r .hg/store/meta/~2e_a +#endif +#if reposimplestore + $ rm -r .hg/store/meta/._a +#endif $ rm -r .hg/store/meta/b/foo $ rm -r .hg/store/meta/b/bar/orange $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange @@ -601,20 +626,20 @@ b/@1: parent-directory manifest refers to unknown revision f065da70369e b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b b/@3: parent-directory manifest refers to unknown revision 367152e6af28 - warning: orphan data file 'meta/b/bar/00manifest.i' - warning: orphan data file 'meta/b/bar/orange/00manifest.i' - warning: orphan data file 'meta/b/bar/orange/fly/00manifest.i' - warning: orphan data file 'meta/b/foo/00manifest.i' - warning: orphan data file 'meta/b/foo/apple/00manifest.i' - warning: orphan data file 'meta/b/foo/apple/bees/00manifest.i' + warning: orphan data file 'meta/b/bar/00manifest.i' (reporevlogstore !) + warning: orphan data file 'meta/b/bar/orange/00manifest.i' (reporevlogstore !) + warning: orphan data file 'meta/b/bar/orange/fly/00manifest.i' (reporevlogstore !) + warning: orphan data file 'meta/b/foo/00manifest.i' (reporevlogstore !) + warning: orphan data file 'meta/b/foo/apple/00manifest.i' (reporevlogstore !) + warning: orphan data file 'meta/b/foo/apple/bees/00manifest.i' (reporevlogstore !) crosschecking files in changesets and manifests b/bar/fruits.txt@0: in changeset but not in manifest b/bar/orange/fly/gnat.py@0: in changeset but not in manifest b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest b/foo/apple/bees/flower.py@0: in changeset but not in manifest checking files 8 files, 4 changesets, 18 total revisions - 6 warnings encountered! + 6 warnings encountered! (reporevlogstore !) 9 integrity errors encountered! (first damaged changeset appears to be 0) [1] @@ -669,6 +694,8 @@ Tree manifest revlogs exist. $ find deepclone/.hg/store/meta | sort deepclone/.hg/store/meta + deepclone/.hg/store/meta/._a (reposimplestore !) + deepclone/.hg/store/meta/._a/00manifest.i (reposimplestore !) deepclone/.hg/store/meta/b deepclone/.hg/store/meta/b/00manifest.i deepclone/.hg/store/meta/b/bar @@ -683,8 +710,8 @@ deepclone/.hg/store/meta/b/foo/apple/00manifest.i deepclone/.hg/store/meta/b/foo/apple/bees deepclone/.hg/store/meta/b/foo/apple/bees/00manifest.i - deepclone/.hg/store/meta/~2e_a - deepclone/.hg/store/meta/~2e_a/00manifest.i + deepclone/.hg/store/meta/~2e_a (reporevlogstore !) + deepclone/.hg/store/meta/~2e_a/00manifest.i (reporevlogstore !) Verify passes. $ cd deepclone $ hg verify @@ -696,6 +723,7 @@ 8 files, 4 changesets, 18 total revisions $ cd .. +#if reporevlogstore Create clones using old repo formats to use in later tests $ hg clone --config format.usestore=False \ > --config experimental.changegroup3=True \ @@ -817,6 +845,8 @@ $ hg debugbundle --spec repo-packed.hg none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest
D3110: tests: disable `hg clone --stream` test with simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb4f5d8c68cfa: tests: disable `hg clone --stream` test with simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3110?vs=7692=7836 REVISION DETAIL https://phab.mercurial-scm.org/D3110 AFFECTED FILES tests/test-http-bundle1.t CHANGE DETAILS diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t --- a/tests/test-http-bundle1.t +++ b/tests/test-http-bundle1.t @@ -380,14 +380,16 @@ server has pull-based clones disabled [255] +#if no-reposimplestore ... but keep stream clones working $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone streaming all changes * files to transfer, * of data (glob) transferred * in * seconds (* KB/sec) (glob) searching for changes no changes found +#endif ... and also keep partial clones and pulls working $ hg clone http://localhost:$HGPORT1 --rev 0 test-partial-clone 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
D3149: filelog: declare that filelog implements a storage interface
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa3202fa83aff: filelog: declare that filelog implements a storage interface (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3149?vs=7763=7847 REVISION DETAIL https://phab.mercurial-scm.org/D3149 AFFECTED FILES mercurial/filelog.py tests/simplestorerepo.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 @@ -12,20 +12,22 @@ ) from mercurial import ( bundlerepo, +filelog, httppeer, localrepo, repository, sshpeer, statichttprepo, ui as uimod, unionrepo, +vfs as vfsmod, wireprotoserver, wireprototypes, ) rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) -def checkzobject(o): +def checkzobject(o, allowextra=False): """Verify an object with a zope interface.""" ifaces = zi.providedBy(o) if not ifaces: @@ -37,6 +39,9 @@ for iface in ifaces: ziverify.verifyObject(iface, o) +if allowextra: +return + # Now verify that the object provides no extra public attributes that # aren't declared as part of interfaces. allowed = set() @@ -132,4 +137,10 @@ httpv2 = wireprotoserver.httpv2protocolhandler(None, None) checkzobject(httpv2) +ziverify.verifyClass(repository.ifilestorage, filelog.filelog) + +vfs = vfsmod.vfs('.') +fl = filelog.filelog(vfs, 'dummy.i') +checkzobject(fl, allowextra=True) + main() diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -24,6 +24,9 @@ from mercurial.thirdparty import ( cbor, ) +from mercurial.thirdparty.zope import ( +interface as zi, +) from mercurial import ( ancestor, bundlerepo, @@ -33,6 +36,7 @@ localrepo, mdiff, pycompat, +repository, revlog, store, verify, @@ -57,6 +61,7 @@ if not isinstance(rev, int): raise ValueError('expected int') +@zi.implementer(repository.ifilestorage) class filestorage(object): """Implements storage for a tracked path. diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -10,9 +10,13 @@ import re import struct +from .thirdparty.zope import ( +interface as zi, +) from . import ( error, mdiff, +repository, revlog, ) @@ -39,6 +43,7 @@ m, offs = parsemeta(text) return m and "censored" in m +@zi.implementer(repository.ifilestorage) class filelog(revlog.revlog): def __init__(self, opener, path): super(filelog, self).__init__(opener, 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
D3111: tests: use unbundle in test-symlink-os-yes-fs-no.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5ac84b20f184: tests: use unbundle in test-symlink-os-yes-fs-no.py (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3111?vs=7693=7837 REVISION DETAIL https://phab.mercurial-scm.org/D3111 AFFECTED FILES tests/test-symlink-os-yes-fs-no.py tests/test-symlink-os-yes-fs-no.py.out CHANGE DETAILS diff --git a/tests/test-symlink-os-yes-fs-no.py.out b/tests/test-symlink-os-yes-fs-no.py.out --- a/tests/test-symlink-os-yes-fs-no.py.out +++ b/tests/test-symlink-os-yes-fs-no.py.out @@ -1,16 +1,12 @@ -requesting all changes adding changesets adding manifests adding file changes added 1 changesets with 4 changes to 4 files new changesets d326ae2d01ee -updating to branch default 4 files updated, 0 files merged, 0 files removed, 0 files unresolved -requesting all changes adding changesets adding manifests adding file changes added 1 changesets with 4 changes to 4 files new changesets d326ae2d01ee -updating to branch default 4 files updated, 0 files merged, 0 files removed, 0 files unresolved diff --git a/tests/test-symlink-os-yes-fs-no.py b/tests/test-symlink-os-yes-fs-no.py --- a/tests/test-symlink-os-yes-fs-no.py +++ b/tests/test-symlink-os-yes-fs-no.py @@ -21,10 +21,11 @@ # hide outer repo hg.peer(u, {}, '.', create=True) -# clone with symlink support -hg.clone(u, {}, BUNDLEPATH, 'test0') +# unbundle with symlink support +hg.peer(u, {}, 'test0', create=True) repo = hg.repository(u, 'test0') +commands.unbundle(u, repo, BUNDLEPATH, update=True) # wait a bit, or the status call wont update the dirstate time.sleep(1) @@ -52,6 +53,8 @@ repo = hg.repository(u, 'test0') commands.status(u, repo) -# try cloning a repo which contains symlinks +# try unbundling a repo which contains symlinks u = uimod.ui.load() -hg.clone(u, {}, BUNDLEPATH, 'test1') + +repo = hg.repository(u, 'test1', create=True) +commands.unbundle(u, repo, BUNDLEPATH, update=True) 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
D3115: tests: `hg init` after resetting HGRCPATH
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0c1b895511b9: tests: `hg init` after resetting HGRCPATH (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3115?vs=7697=7842 REVISION DETAIL https://phab.mercurial-scm.org/D3115 AFFECTED FILES tests/test-hgrc.t CHANGE DETAILS diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t --- a/tests/test-hgrc.t +++ b/tests/test-hgrc.t @@ -1,11 +1,11 @@ -hide outer repo - $ hg init - Use hgrc within $TESTTMP $ HGRCPATH=`pwd`/hgrc $ export HGRCPATH +hide outer repo + $ hg init + Use an alternate var for scribbling on hgrc to keep check-code from complaining about the important settings we may be overwriting: 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
D3096: tests: conditionalize tests for various repo features
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7542e97c7867: tests: conditionalize tests for various repo features (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3096?vs=7678=7822 REVISION DETAIL https://phab.mercurial-scm.org/D3096 AFFECTED FILES tests/test-contrib-perf.t tests/test-convert-hg-source.t tests/test-debugcommands.t tests/test-http.t tests/test-inherit-mode.t tests/test-narrow-exchange.t tests/test-narrow-patterns.t tests/test-narrow-strip.t tests/test-obsolete.t tests/test-permissions.t tests/test-phases-exchange.t tests/test-strip.t tests/test-subrepo-deep-nested-change.t CHANGE DETAILS 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 @@ -183,18 +183,18 @@ updating [===>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) - linking [ <=> ] 1\r (no-eol) (esc) (no-reposimplestore !) - linking [ <=> ] 2\r (no-eol) (esc) (no-reposimplestore !) - linking [ <=> ] 3\r (no-eol) (esc) (no-reposimplestore !) - linking [<=>] 4\r (no-eol) (esc) (no-reposimplestore !) - linking [ <=> ] 5\r (no-eol) (esc) (no-reposimplestore !) - linking [ <=> ] 6\r (no-eol) (esc) (no-reposimplestore !) - linking [<=>] 1\r (no-eol) (esc) (reposimplestore !) - linking [ <=> ] 2\r (no-eol) (esc) (reposimplestore !) - linking [ <=> ] 3\r (no-eol) (esc) (reposimplestore !) - linking [ <=> ] 4\r (no-eol) (esc) (reposimplestore !) - linking [<=>] 5\r (no-eol) (esc) (reposimplestore !) - linking [ <=> ] 6\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 1\r (no-eol) (esc) (reporevlogstore !) + linking [ <=> ] 2\r (no-eol) (esc) (reporevlogstore !) + linking [ <=> ] 3\r (no-eol) (esc) (reporevlogstore !) + linking [<=>] 4\r (no-eol) (esc) (reporevlogstore !) + linking [ <=> ] 5\r (no-eol) (esc) (reporevlogstore !) + linking [ <=> ] 6\r (no-eol) (esc) (reporevlogstore !) + linking [ <=> ] 1\r (no-eol) (esc) (reposimplestore !) + linking [<=>] 2\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 3\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 4\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 5\r (no-eol) (esc) (reposimplestore !) + linking [<=>] 6\r (no-eol) (esc) (reposimplestore !) updating [===>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) updating to branch default diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -742,12 +742,14 @@ saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg $ ls .hg/strip-backup 3903775176ed-e68910bd-backup.hg +#if repobundlerepo $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg $ hg strip -r 0 saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg $ ls .hg/strip-backup 3903775176ed-54390173-backup.hg 3903775176ed-e68910bd-backup.hg +#endif $ cd .. Test that we only bundle the stripped changesets (issue4736) @@ -813,6 +815,7 @@ $ hg bundle -r 'desc(mergeCD)' --base 'desc(commitC)' ../issue4736.hg 2 changesets found +#if repobundlerepo $ hg log -r 'bundle()' -R ../issue4736.hg changeset: 3:6625a5168474 parent: 1:eca11cf91c71 @@ -828,6 +831,7 @@ date:Thu Jan 01 00:00:00 1970 + summary: mergeCD +#endif check strip behavior @@ -872,6 +876,7 @@ strip backup content +#if repobundlerepo $ hg log -r 'bundle()' -R .hg/strip-backup/6625a5168474-*-backup.hg changeset:
D3095: simplestore: use a custom store for the simple store repo
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc2c8962a9465: simplestore: use a custom store for the simple store repo (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3095?vs=7677=7821 REVISION DETAIL https://phab.mercurial-scm.org/D3095 AFFECTED FILES tests/hghave.py tests/simplestorerepo.py tests/test-clone.t tests/test-convert.t tests/test-fncache.t tests/test-hardlinks.t tests/test-hook.t tests/test-inherit-mode.t tests/test-init.t tests/test-narrow-clone-no-ellipsis.t tests/test-narrow-clone.t tests/test-narrow.t tests/test-repo-compengines.t tests/test-sparse-requirement.t tests/test-strip.t tests/test-subrepo-deep-nested-change.t tests/test-subrepo-recursion.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 @@ -557,6 +557,7 @@ checking files 8 files, 4 changesets, 18 total revisions +#if repofncache Dirlogs are included in fncache $ grep meta/.A/00manifest.i .hg/store/fncache meta/.A/00manifest.i @@ -581,6 +582,7 @@ adding meta/b/foo/apple/00manifest.i adding meta/b/foo/apple/bees/00manifest.i 16 items added, 0 removed from fncache +#endif Finish first server $ killdaemons.py diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -466,7 +466,6 @@ linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !) linking [ <=>] 11\r (no-eol) (esc) (reposimplestore !) linking [<=> ] 12\r (no-eol) (esc) (reposimplestore !) - linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) #else $ hg clone -U . ../empty @@ -498,7 +497,6 @@ linking [<=> ] 12\r (no-eol) (esc) (reposimplestore !) linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !) linking [ <=> ] 14\r (no-eol) (esc) (reposimplestore !) - linking [ <=>] 15\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo) [ ] 0/3\r (no-eol) (esc) @@ -515,7 +513,6 @@ linking [ <=> ] 6\r (no-eol) (esc) linking [ <=> ] 7\r (no-eol) (esc) (reposimplestore !) linking [<=>] 8\r (no-eol) (esc) (reposimplestore !) - linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo/bar) [ ] 0/1\r (no-eol) (esc) 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,7 +34,6 @@ 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) @@ -63,7 +62,6 @@ 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) @@ -75,7 +73,6 @@ 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
D3109: tests: use `hg unbundle` in test-setdiscovery.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7d0a29f70bbe: tests: use `hg unbundle` in test-setdiscovery.t (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3109?vs=7691=7835 REVISION DETAIL https://phab.mercurial-scm.org/D3109 AFFECTED FILES tests/test-setdiscovery.t CHANGE DETAILS diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t --- a/tests/test-setdiscovery.t +++ b/tests/test-setdiscovery.t @@ -512,8 +512,12 @@ $ hg -R r2 bundle -qa $TESTDIR/bundles/issue4438-r2.hg #else use existing bundles: - $ hg clone -q $TESTDIR/bundles/issue4438-r1.hg r1 - $ hg clone -q $TESTDIR/bundles/issue4438-r2.hg r2 + $ hg init r1 + $ hg -R r1 -q unbundle $TESTDIR/bundles/issue4438-r1.hg + $ hg -R r1 -q up + $ hg init r2 + $ hg -R r2 -q unbundle $TESTDIR/bundles/issue4438-r2.hg + $ hg -R r2 -q up #endif Set iteration order could cause wrong and unstable results - fixed in 73cfaa348650: 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
D3116: simplestore: correctly implement flag processors
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9d4f09bfe3ec: simplestore: correctly implement flag processors (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3116?vs=7698=7841 REVISION DETAIL https://phab.mercurial-scm.org/D3116 AFFECTED FILES tests/flagprocessorext.py tests/simplestorerepo.py tests/test-flagprocessor.t CHANGE DETAILS diff --git a/tests/test-flagprocessor.t b/tests/test-flagprocessor.t --- a/tests/test-flagprocessor.t +++ b/tests/test-flagprocessor.t @@ -88,6 +88,44 @@ adding file changes added 7 changesets with 7 changes to 7 files +Ensure the data got to the server OK + + $ cd ../server + $ hg cat -r 6e48f4215d24 noop + [NOOP] + $ hg debugdata noop 0 + [NOOP] + + $ hg cat -r 6e48f4215d24 base64 + [BASE64] + $ hg debugdata base64 0 + W0JBU0U2NF0K (no-eol) + + $ hg cat -r 6e48f4215d24 gzip + [GZIP] + $ hg debugdata gzip 0 + x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc) + + $ hg cat -r 6e48f4215d24 noop-base64 + [NOOP][BASE64] + $ hg debugdata noop-base64 0 + W05PT1BdW0JBU0U2NF0K (no-eol) + + $ hg cat -r 6e48f4215d24 noop-gzip + [NOOP][GZIP] + $ hg debugdata noop-gzip 0 + x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc) + + $ hg cat -r 6e48f4215d24 base64-gzip + [BASE64][GZIP] + $ hg debugdata base64-gzip 0 + eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol) + + $ hg cat -r 6e48f4215d24 base64-gzip-noop + [BASE64][GZIP][NOOP] + $ hg debugdata base64-gzip-noop 0 + eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol) + # Initialize new client (not cloning) and setup extension $ cd .. $ hg init client2 @@ -197,6 +235,7 @@ $ echo '[BASE64]a-bit-longer-branching' > base64 $ hg commit -q -m branching +#if repobundlerepo $ hg bundle --base 1 bundle.hg 4 changesets found $ hg --config extensions.strip= strip -r 2 --no-backup --force -q @@ -253,6 +292,7 @@ 1 files changed, 1 insertions(+), 0 deletions(-) $ rm bundle.hg bundle-again.hg +#endif # TEST: hg status diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -243,6 +243,10 @@ if flags == 0: return text, True +if flags & ~revlog.REVIDX_KNOWN_FLAGS: +raise error.RevlogError(_("incompatible revision flag '%#x'") % +(flags & ~revlog.REVIDX_KNOWN_FLAGS)) + validatehash = True # Depending on the operation (read or write), the order might be # reversed due to non-commutative transforms. @@ -405,15 +409,13 @@ return 0, 0 def add(self, text, meta, transaction, linkrev, p1, p2): -transaction.addbackup(self._indexpath) - if meta or text.startswith(b'\1\n'): text = filelog.packmeta(meta, text) return self.addrevision(text, transaction, linkrev, p1, p2) def addrevision(self, text, transaction, linkrev, p1, p2, node=None, -flags=0): +flags=revlog.REVIDX_DEFAULT_FLAGS, cachedelta=None): validatenode(p1) validatenode(p2) @@ -430,15 +432,21 @@ if validatehash: self.checkhash(rawtext, node, p1=p1, p2=p2) +return self._addrawrevision(node, rawtext, transaction, linkrev, p1, p2, +flags) + +def _addrawrevision(self, node, rawtext, transaction, link, p1, p2, flags): +transaction.addbackup(self._indexpath) + path = b'/'.join([self._storepath, hex(node)]) -self._svfs.write(path, text) +self._svfs.write(path, rawtext) self._indexdata.append({ b'node': node, b'p1': p1, b'p2': p2, -b'linkrev': linkrev, +b'linkrev': link, b'flags': flags, }) @@ -457,6 +465,7 @@ for node, p1, p2, linknode, deltabase, delta, flags in deltas: linkrev = linkmapper(linknode) +flags = flags or revlog.REVIDX_DEFAULT_FLAGS nodes.append(node) @@ -469,7 +478,8 @@ else: text = mdiff.patch(self.revision(deltabase), delta) -self.addrevision(text, transaction, linkrev, p1, p2, flags) +self._addrawrevision(node, text, transaction, linkrev, p1, p2, + flags) if addrevisioncb: addrevisioncb(self, node) diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py --- a/tests/flagprocessorext.py +++ b/tests/flagprocessorext.py @@ -9,7 +9,6 @@ changegroup, exchange, extensions, -filelog, revlog, util, ) @@ -55,39 +54,41 @@ versions.add(b'03') return versions -def noopaddrevision(orig, self, text, transaction, link, p1,
D3113: tests: disable test-keyword.t with simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9168792422a0: tests: disable test-keyword.t with simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3113?vs=7695=7838 REVISION DETAIL https://phab.mercurial-scm.org/D3113 AFFECTED FILES tests/test-keyword.t CHANGE DETAILS diff --git a/tests/test-keyword.t b/tests/test-keyword.t --- a/tests/test-keyword.t +++ b/tests/test-keyword.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + Run kwdemo outside a repo $ hg -q --config extensions.keyword= --config keywordmaps.Foo="{author|user}" kwdemo [extensions] 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
D3100: tests: port test-convert-filemap.t to simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHG84e7d2d8c098: tests: port test-convert-filemap.t to simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3100?vs=7682=7826 REVISION DETAIL https://phab.mercurial-scm.org/D3100 AFFECTED FILES tests/test-convert-filemap.t CHANGE DETAILS diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t --- a/tests/test-convert-filemap.t +++ b/tests/test-convert-filemap.t @@ -283,14 +283,23 @@ > exclude dir/subdir > include dir/subdir/file3 > EOF +#if reporevlogstore $ rm source/.hg/store/data/dir/file3.i $ rm source/.hg/store/data/dir/file4.i +#endif +#if reposimplestore + $ rm -rf source/.hg/store/data/dir/file3 + $ rm -rf source/.hg/store/data/dir/file4 +#endif $ hg -q convert --filemap renames.fmap --datesort source dummydest - abort: data/dir/file3.i@e96dce0bc6a2: no match found! + abort: data/dir/file3.i@e96dce0bc6a2: no match found! (reporevlogstore !) + abort: data/dir/file3/index@e96dce0bc6a2: no node! (reposimplestore !) [255] $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo - ignoring: data/dir/file3.i@e96dce0bc6a2: no match found - ignoring: data/dir/file4.i@6edd55f559cd: no match found + ignoring: data/dir/file3.i@e96dce0bc6a2: no match found (reporevlogstore !) + ignoring: data/dir/file4.i@6edd55f559cd: no match found (reporevlogstore !) + ignoring: data/dir/file3/index@e96dce0bc6a2: no node (reposimplestore !) + ignoring: data/dir/file4/index@6edd55f559cd: no node (reposimplestore !) $ hg up -q -R renames.repo $ glog -R renames.repo @ 4 "8: change foo" files: foo2 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
D3102: tests: skip test-hgweb-bundle.t if we don't support bundlerepos
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9fa4a1fdba15: tests: skip test-hgweb-bundle.t if we dont support bundlerepos (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3102?vs=7684=7828 REVISION DETAIL https://phab.mercurial-scm.org/D3102 AFFECTED FILES tests/test-hgweb-bundle.t CHANGE DETAILS diff --git a/tests/test-hgweb-bundle.t b/tests/test-hgweb-bundle.t --- a/tests/test-hgweb-bundle.t +++ b/tests/test-hgweb-bundle.t @@ -1,4 +1,4 @@ -#require serve +#require serve repobundlerepo $ hg init server $ cd 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
D3103: tests: disable shallow narrow tests with simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8d033b348d85: tests: disable shallow narrow tests with simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3103?vs=7685=7829 REVISION DETAIL https://phab.mercurial-scm.org/D3103 AFFECTED FILES tests/test-narrow-shallow-merges.t tests/test-narrow-shallow.t CHANGE DETAILS diff --git a/tests/test-narrow-shallow.t b/tests/test-narrow-shallow.t --- a/tests/test-narrow-shallow.t +++ b/tests/test-narrow-shallow.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + $ . "$TESTDIR/narrow-library.sh" $ hg init master diff --git a/tests/test-narrow-shallow-merges.t b/tests/test-narrow-shallow-merges.t --- a/tests/test-narrow-shallow-merges.t +++ b/tests/test-narrow-shallow-merges.t @@ -1,3 +1,5 @@ +#require no-reposimplestore + $ . "$TESTDIR/narrow-library.sh" create full repo 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
D3101: tests: disable test-audit-path.t with simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9984488550ea: tests: disable test-audit-path.t with simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3101?vs=7683=7827 REVISION DETAIL https://phab.mercurial-scm.org/D3101 AFFECTED FILES tests/test-audit-path.t CHANGE DETAILS diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t --- a/tests/test-audit-path.t +++ b/tests/test-audit-path.t @@ -1,3 +1,7 @@ +The simple store doesn't escape paths robustly and can't store paths +with periods, etc. So much of this test fails with it. +#require no-reposimplestore + $ hg init audit of .hg 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
D3105: tests: require revlog store with test-repair-strip.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe1d4be95cd68: tests: require revlog store with test-repair-strip.t (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3105?vs=7687=7831 REVISION DETAIL https://phab.mercurial-scm.org/D3105 AFFECTED FILES tests/test-repair-strip.t CHANGE DETAILS diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t --- a/tests/test-repair-strip.t +++ b/tests/test-repair-strip.t @@ -1,4 +1,4 @@ -#require unix-permissions no-root +#require unix-permissions no-root reporevlogstore $ cat > $TESTTMP/dumpjournal.py < import sys 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
D3104: simplestore: back up index when adding a revision
This revision was automatically updated to reflect the committed changes. Closed by commit rHG06674aab2b4c: simplestore: back up index when adding a revision (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3104?vs=7686=7830 REVISION DETAIL https://phab.mercurial-scm.org/D3104 AFFECTED FILES tests/simplestorerepo.py tests/test-clone.t tests/test-subrepo-recursion.t CHANGE DETAILS diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -466,6 +466,7 @@ linking [ <=> ] 10\r (no-eol) (esc) (reposimplestore !) linking [ <=>] 11\r (no-eol) (esc) (reposimplestore !) linking [<=> ] 12\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) #else $ hg clone -U . ../empty @@ -497,6 +498,8 @@ linking [<=> ] 12\r (no-eol) (esc) (reposimplestore !) linking [ <=> ] 13\r (no-eol) (esc) (reposimplestore !) linking [ <=> ] 14\r (no-eol) (esc) (reposimplestore !) + linking [ <=>] 15\r (no-eol) (esc) (reposimplestore !) + linking [<=> ] 16\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo) [ ] 0/3\r (no-eol) (esc) @@ -513,6 +516,7 @@ linking [ <=> ] 6\r (no-eol) (esc) linking [ <=> ] 7\r (no-eol) (esc) (reposimplestore !) linking [<=>] 8\r (no-eol) (esc) (reposimplestore !) + linking [ <=> ] 9\r (no-eol) (esc) (reposimplestore !) \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo/bar) [ ] 0/1\r (no-eol) (esc) diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -104,7 +104,8 @@ linking: 15 (reposimplestore !) linking: 16 (reposimplestore !) linking: 17 (reposimplestore !) - linked 17 files (reposimplestore !) + linking: 18 (reposimplestore !) + linked 18 files (reposimplestore !) #else $ hg --debug clone -U . ../c --config progress.debug=true linking: 1 @@ -125,7 +126,8 @@ copying: 15 (reposimplestore !) copying: 16 (reposimplestore !) copying: 17 (reposimplestore !) - copied 17 files (reposimplestore !) + copying: 18 (reposimplestore !) + copied 18 files (reposimplestore !) #endif $ cd ../c diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -405,6 +405,8 @@ return 0, 0 def add(self, text, meta, transaction, linkrev, p1, p2): +transaction.addbackup(self._indexpath) + if meta or text.startswith(b'\1\n'): text = filelog.packmeta(meta, text) 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
D3099: tests: disable test-static-http.t with simple store
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa84b6eeb2c39: tests: disable test-static-http.t with simple store (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3099?vs=7681=7825 REVISION DETAIL https://phab.mercurial-scm.org/D3099 AFFECTED FILES tests/test-static-http.t CHANGE DETAILS diff --git a/tests/test-static-http.t b/tests/test-static-http.t --- a/tests/test-static-http.t +++ b/tests/test-static-http.t @@ -1,4 +1,4 @@ -#require killdaemons +#require killdaemons no-reposimplestore $ hg clone http://localhost:$HGPORT/ copy abort: * (glob) 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
D3098: tests: don't drop global hgrc
This revision was automatically updated to reflect the committed changes. Closed by commit rHGafd7b0afe4a6: tests: dont drop global hgrc (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3098?vs=7680=7824 REVISION DETAIL https://phab.mercurial-scm.org/D3098 AFFECTED FILES tests/test-command-template.t tests/test-wireproto.t CHANGE DETAILS diff --git a/tests/test-wireproto.t b/tests/test-wireproto.t --- a/tests/test-wireproto.t +++ b/tests/test-wireproto.t @@ -114,10 +114,7 @@ HTTP without the httpheader capability: - $ HGRCPATH="`pwd`/repo/.hgrc" - $ export HGRCPATH - $ CAP=httpheader - $ . "$TESTDIR/notcapable" + $ CAP=httpheader . "$TESTDIR/notcapable" $ hg serve -R repo -p $HGPORT2 -d --pid-file=hg2.pid -E error2.log -A access2.log $ cat hg2.pid >> $DAEMON_PIDS diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -284,7 +284,8 @@ so it can be included in hgrc - $ cat <<'EOF' > myhgrc + $ cat < myhgrc + > %include $HGRCPATH > %include map-simple > [templates] > foo = "{changeset}" 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
D3097: verify: allow suppressing warnings about extra files
This revision was automatically updated to reflect the committed changes. Closed by commit rHG76d2115cb817: verify: allow suppressing warnings about extra files (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3097?vs=7679=7823 REVISION DETAIL https://phab.mercurial-scm.org/D3097 AFFECTED FILES mercurial/verify.py tests/simplestorerepo.py CHANGE DETAILS diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -35,6 +35,7 @@ pycompat, revlog, store, +verify, ) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -656,9 +657,17 @@ return simplestore(path, vfstype) +def verifierinit(orig, self, *args, **kwargs): +orig(self, *args, **kwargs) + +# We don't care that files in the store don't align with what is +# advertised. So suppress these warnings. +self.warnorphanstorefiles = False + def extsetup(ui): localrepo.featuresetupfuncs.add(featuresetup) extensions.wrapfunction(localrepo, 'newreporequirements', newreporequirements) extensions.wrapfunction(store, 'store', makestore) +extensions.wrapfunction(verify.verifier, '__init__', verifierinit) diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -52,6 +52,7 @@ self.fncachewarned = False # developer config: verify.skipflags self.skipflags = repo.ui.configint('verify', 'skipflags') +self.warnorphanstorefiles = True def warn(self, msg): self.ui.warn(msg + "\n") @@ -294,8 +295,9 @@ if not dir and subdirnodes: ui.progress(_('checking'), None) -for f in sorted(storefiles): -self.warn(_("warning: orphan data file '%s'") % f) +if self.warnorphanstorefiles: +for f in sorted(storefiles): +self.warn(_("warning: orphan data file '%s'") % f) return filenodes @@ -369,8 +371,10 @@ try: storefiles.remove(ff) except KeyError: -self.warn(_(" warning: revlog '%s' not in fncache!") % ff) -self.fncachewarned = True +if self.warnorphanstorefiles: +self.warn(_(" warning: revlog '%s' not in fncache!") % + ff) +self.fncachewarned = True self.checklog(fl, f, lr) seen = {} @@ -481,7 +485,8 @@ short(node), f) ui.progress(_('checking'), None) -for f in sorted(storefiles): -self.warn(_("warning: orphan data file '%s'") % f) +if self.warnorphanstorefiles: +for f in sorted(storefiles): +self.warn(_("warning: orphan data file '%s'") % f) return len(files), revisions 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
D3165: infinitepush: look up bookmarks only among bookmarks
martinvonz updated this revision to Diff 7820. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3165?vs=7792=7820 REVISION DETAIL https://phab.mercurial-scm.org/D3165 AFFECTED FILES hgext/infinitepush/bundleparts.py CHANGE DETAILS diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py --- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -46,8 +46,9 @@ params['bookmark'] = bookmark # 'prevbooknode' is necessary for pushkey reply part params['bookprevnode'] = '' -if bookmark in repo: -params['bookprevnode'] = repo[bookmark].hex() +bookmarks = repo._bookmarks +if bookmark in bookmarks: +params['bookprevnode'] = bookmarks.changectx(bookmark).hex() # Do not send pushback bundle2 part with bookmarks if remotenames extension # is enabled. It will be handled manually in `_push()` 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
D3163: discovery: look up bookmarks only among bookmarks
martinvonz updated this revision to Diff 7819. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3163?vs=7790=7819 REVISION DETAIL https://phab.mercurial-scm.org/D3163 AFFECTED FILES mercurial/discovery.py CHANGE DETAILS diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -297,12 +297,12 @@ for bm in localbookmarks: rnode = remotebookmarks.get(bm) if rnode and rnode in repo: -lctx, rctx = repo[bm], repo[rnode] +lctx, rctx = localbookmarks.changectx(bm), repo[rnode] if bookmarks.validdest(repo, rctx, lctx): bookmarkedheads.add(lctx.node()) else: if bm in newbookmarks and bm not in remotebookmarks: -bookmarkedheads.add(repo[bm].node()) +bookmarkedheads.add(localbookmarks[bm]) return bookmarkedheads 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
D3162: bookmarks: introduce a repo._bookmarks.changectx(mark) method and use it
martinvonz updated this revision to Diff 7818. martinvonz retitled this revision from "bookmarks: introduce a repo._bookmarks.ctx(mark) method and use it" to "bookmarks: introduce a repo._bookmarks.changectx(mark) method and use it". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3162?vs=7795=7818 REVISION DETAIL https://phab.mercurial-scm.org/D3162 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 @@ -119,6 +119,9 @@ def update(self, *others): raise error.ProgrammingError("use 'bookmarks.applychanges' instead") +def changectx(self, mark): +return self._repo[self[mark]] + def applychanges(self, repo, tr, changes): """Apply a list of changes to bookmarks """ @@ -212,8 +215,8 @@ return [] rev = self._repo[target].rev() anc = self._repo.changelog.ancestors([rev]) -bmctx = self._repo[self[mark]] -divs = [self._repo[b].node() for b in self +bmctx = self.changectx(mark) +divs = [self[b] for b in self if b.split('@', 1)[0] == mark.split('@', 1)[0]] # allow resolving a single divergent bookmark even if moving @@ -370,11 +373,11 @@ bmchanges = [] if marks[active] in parents: new = repo[node] -divs = [repo[b] for b in marks +divs = [marks.changectx(b) for b in marks if b.split('@', 1)[0] == active.split('@', 1)[0]] anc = repo.changelog.ancestors([new.rev()]) deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] -if validdest(repo, repo[marks[active]], new): +if validdest(repo, marks.changectx(active), new): bmchanges.append((active, new.node())) for bm in divergent2delete(repo, deletefrom, active): 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
D3162: bookmarks: introduce a repo._bookmarks.ctx(mark) method and use it
martinvonz added a comment. In https://phab.mercurial-scm.org/D3162#50746, @indygreg wrote: > How do you feel about `changectx` instead of `ctx`? This would seemingly jive with other naming throughout the code base. I agree, that's better to make it clear that it's not some kind of bookmark context. Will change. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3162 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
D2470: wireproto: allow direct stream processing for unbundle
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2d965bfeb8f6: wireproto: allow direct stream processing for unbundle (authored by joerg.sonnenberger, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2470?vs=7816=7817 REVISION DETAIL https://phab.mercurial-scm.org/D2470 AFFECTED FILES hgext/largefiles/proto.py mercurial/configitems.py mercurial/help/config.txt mercurial/wireproto.py mercurial/wireprotoserver.py mercurial/wireprototypes.py tests/test-push-http.t CHANGE DETAILS diff --git a/tests/test-push-http.t b/tests/test-push-http.t --- a/tests/test-push-http.t +++ b/tests/test-push-http.t @@ -23,7 +23,7 @@ $ echo a >> a $ hg ci -mb $ req() { - > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log + > hg $1 serve -p $HGPORT -d --pid-file=hg.pid -E errors.log > cat hg.pid >> $DAEMON_PIDS > hg --cwd ../test2 push http://localhost:$HGPORT/ > exitstatus=$? @@ -70,6 +70,58 @@ > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE" > EOF +#if bundle1 + $ cat >> .hg/hgrc < allow_push = * + > [hooks] + > changegroup = sh -c "printenv.py changegroup 0" + > pushkey = sh -c "printenv.py pushkey 0" + > txnclose-phase.test = sh $TESTTMP/hook.sh + > EOF + $ req "--debug --config extensions.blackbox=" + listening at http://localhost:$HGPORT/ (bound to $LOCALIP:$HGPORT) + pushing to http://localhost:$HGPORT/ + searching for changes + remote: redirecting incoming bundle to */hg-unbundle-* (glob) + remote: adding changesets + remote: add changeset ba677d0156c1 + remote: adding manifests + remote: adding file changes + remote: adding a revisions + remote: added 1 changesets with 1 changes to 1 files + remote: updating the branch cache + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public + remote: running hook changegroup: sh -c "printenv.py changegroup 0" + remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + % serve errors + $ hg rollback + repository tip rolled back to revision 0 (undo serve) + $ req "--debug --config server.streamunbundle=True --config extensions.blackbox=" + listening at http://localhost:$HGPORT/ (bound to $LOCALIP:$HGPORT) + pushing to http://localhost:$HGPORT/ + searching for changes + remote: adding changesets + remote: add changeset ba677d0156c1 + remote: adding manifests + remote: adding file changes + remote: adding a revisions + remote: added 1 changesets with 1 changes to 1 files + remote: updating the branch cache + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public + remote: running hook changegroup: sh -c "printenv.py changegroup 0" + remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + % serve errors + $ hg rollback + repository tip rolled back to revision 0 (undo serve) +#endif + +#if bundle2 $ cat >> .hg/hgrc < allow_push = * > [hooks] @@ -86,11 +138,11 @@ remote: added 1 changesets with 1 changes to 1 files remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public - remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !) - remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !) + remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) % serve errors $ hg rollback repository tip rolled back to revision 0 (undo serve) +#endif expect success, server lacks the httpheader
D2470: wireproto: allow direct stream processing for unbundle
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. LGTM. Thanks for the feature! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2470 To: joerg.sonnenberger, #hg-reviewers, lothiraldan, indygreg Cc: indygreg, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2470: wireproto: allow direct stream processing for unbundle
joerg.sonnenberger updated this revision to Diff 7816. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2470?vs=6178=7816 REVISION DETAIL https://phab.mercurial-scm.org/D2470 AFFECTED FILES hgext/largefiles/proto.py mercurial/configitems.py mercurial/help/config.txt mercurial/wireproto.py mercurial/wireprotoserver.py mercurial/wireprototypes.py tests/test-push-http.t CHANGE DETAILS diff --git a/tests/test-push-http.t b/tests/test-push-http.t --- a/tests/test-push-http.t +++ b/tests/test-push-http.t @@ -23,7 +23,7 @@ $ echo a >> a $ hg ci -mb $ req() { - > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log + > hg $1 serve -p $HGPORT -d --pid-file=hg.pid -E errors.log > cat hg.pid >> $DAEMON_PIDS > hg --cwd ../test2 push http://localhost:$HGPORT/ > exitstatus=$? @@ -70,6 +70,58 @@ > echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE" > EOF +#if bundle1 + $ cat >> .hg/hgrc < allow_push = * + > [hooks] + > changegroup = sh -c "printenv.py changegroup 0" + > pushkey = sh -c "printenv.py pushkey 0" + > txnclose-phase.test = sh $TESTTMP/hook.sh + > EOF + $ req "--debug --config extensions.blackbox=" + listening at http://localhost:$HGPORT/ (bound to $LOCALIP:$HGPORT) + pushing to http://localhost:$HGPORT/ + searching for changes + remote: redirecting incoming bundle to */hg-unbundle-* (glob) + remote: adding changesets + remote: add changeset ba677d0156c1 + remote: adding manifests + remote: adding file changes + remote: adding a revisions + remote: added 1 changesets with 1 changes to 1 files + remote: updating the branch cache + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public + remote: running hook changegroup: sh -c "printenv.py changegroup 0" + remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + % serve errors + $ hg rollback + repository tip rolled back to revision 0 (undo serve) + $ req "--debug --config server.streamunbundle=True --config extensions.blackbox=" + listening at http://localhost:$HGPORT/ (bound to $LOCALIP:$HGPORT) + pushing to http://localhost:$HGPORT/ + searching for changes + remote: adding changesets + remote: add changeset ba677d0156c1 + remote: adding manifests + remote: adding file changes + remote: adding a revisions + remote: added 1 changesets with 1 changes to 1 files + remote: updating the branch cache + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public + remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh + remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public + remote: running hook changegroup: sh -c "printenv.py changegroup 0" + remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + % serve errors + $ hg rollback + repository tip rolled back to revision 0 (undo serve) +#endif + +#if bundle2 $ cat >> .hg/hgrc < allow_push = * > [hooks] @@ -86,11 +138,11 @@ remote: added 1 changesets with 1 changes to 1 files remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public - remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle1 !) - remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) (bundle2 !) + remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) % serve errors $ hg rollback repository tip rolled back to revision 0 (undo serve) +#endif expect success, server lacks the httpheader capability diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -123,10
D3175: commands: implement `export --format=X` with support for CBOR
indygreg added a comment. This is more of an RFC patch. My actual goal is support for ingesting CBOR patches via `hg import`. I figured it would be easier to test that if we had support for CBOR with `hg export`. And the reason I want CBOR support for patch ingestion is because it is safer: it reduces the surface area for injecting badness via patch parsing. See e.g. http://rachelbythebay.com/w/2018/04/05/bangpatch/. This implementation is still only partially there: I think a better approach would be to have structured data for the diffs so we don't need to parse those either. That would allow us to use binary data without escaping, not have to use inline text metadata for copy/renames, not have to worry about encoding of filenames, etc. All the problems with "parse a patch" go away and you are left with commit metadata and a series of splicing instructions, which should be pretty generic. The I/O in the export code is pretty wonky. I'm kinda sad that `cbor2` insists on binding an encoder/decoder to a file object. I *really* wish you could get straight bytes out of it without having to use `io.BytesIO()`. I suspect someone is going to tell me that `hg export` should use the templating layer. If someone does, I would appreciate help implementing that. Of course, for us to get CBOR with the templating layer, we'd have to teach the templating layer to emit CBOR. Since we can emit JSON, CBOR seems reasonable. I'm just not too familiar with that code though. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3175 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
[PATCH 1 of 2] hgweb: fallback to checking wsgireq.env for REPO_NAME for 3rd party hosting
# HG changeset patch # User Matt Harbison# Date 1522957360 14400 # Thu Apr 05 15:42:40 2018 -0400 # Node ID d2fd52e2e5e0ce6369c551e7e00c06d36c21658f # Parent d3286dd2ca2f9f9e2b332e00c4b25b21729c54f5 hgweb: fallback to checking wsgireq.env for REPO_NAME for 3rd party hosting Starting with d7fd203e36cc, SCM Manager began to 404 any repository access. What's happening is that it is generating a python script that creates an hgweb application (not hgwebdir), and launches hgweb via wsgicgi. It must be setting REPO_NAME in the process environment before launching this script, which gets picked up and put into wsgireq.env when wsgicgi launches the hgweb application. From there, other variables (notably 'apppath' and 'dispatchpath') are constructed differently. d7fd203e36cc^ (working): apppath: /hg/eng/devsetup dispatchpath: pathinfo: /eng/devsetup reponame: eng/devsetup d7fd203e36cc: apppath: /hg dispatchpath: eng/devsetup pathinfo: /eng/devsetup reponame: None REPO_NAME: eng/devsetup Rather than having an existing installation break when Mercurial is upgraded, just resume checking the environment. I have no idea how many other hosting solutions would break without restoring this. diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -162,6 +162,12 @@ def parserequestfromenv(env, reponame=No env = {k: v.encode('latin-1') if isinstance(v, str) else v for k, v in env.iteritems()} +# Some hosting solutions are emulating hgwebdir, and dispatching directly +# to an hgweb instance using this environment variable. This was always +# checked prior to d7fd203e36cc; keep doing so to avoid breaking them. +if not reponame: +reponame = env.get('REPO_NAME') + if altbaseurl: altbaseurl = util.url(altbaseurl) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] lfs: teach the blob server to handle --prefix
# HG changeset patch # User Matt Harbison# Date 1522961825 14400 # Thu Apr 05 16:57:05 2018 -0400 # Node ID 6f40284542f14c7c4e68e685268d75f8f5b5a09f # Parent d2fd52e2e5e0ce6369c551e7e00c06d36c21658f lfs: teach the blob server to handle --prefix diff --git a/hgext/lfs/wireprotolfsserver.py b/hgext/lfs/wireprotolfsserver.py --- a/hgext/lfs/wireprotolfsserver.py +++ b/hgext/lfs/wireprotolfsserver.py @@ -215,8 +215,8 @@ def _batchresponseobjects(req, objects, rsp['actions'] = { '%s' % action: { -# TODO: Account for the --prefix, if any. -'href': '%s/.hg/lfs/objects/%s' % (req.baseurl, oid), +'href': '%s%s/.hg/lfs/objects/%s' +% (req.baseurl, req.apppath, oid), # datetime.isoformat() doesn't include the 'Z' suffix "expires_at": expiresat.strftime('%Y-%m-%dT%H:%M:%SZ'), 'header': { 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 @@ -38,7 +38,7 @@ default cache, so it attempts to downloa $ hg --config "lfs.usercache=$TESTTMP/servercache" \ >--config "lfs.url=null://" \ >-R client push -q server - $ rm -rf `hg config lfs.usercache` + $ mv `hg config lfs.usercache` $TESTTMP/servercache Downloads fail... @@ -65,3 +65,87 @@ Downloads fail... $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2=1==525251863cad618e55d483555f3d00a2ca99597e=bookmarks=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob) + +Blob URIs are correct when --prefix is used + + $ rm -f $TESTTMP/access.log $TESTTMP/errors.log + $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \ + >-p $HGPORT --pid-file=hg.pid --prefix=subdir/mount/point \ + >-A $TESTTMP/access.log -E $TESTTMP/errors.log + $ cat hg.pid >> $DAEMON_PIDS + + $ hg --config lfs.url=http://localhost:$HGPORT/subdir/mount/point/.git/info/lfs \ + >clone --debug http://localhost:$HGPORT/subdir/mount/point cloned2 + using http://localhost:$HGPORT/subdir/mount/point + sending capabilities command + query 1; heads + sending batch command + requesting all changes + sending getbundle command + bundle2-input-bundle: with-transaction + bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported + adding changesets + add changeset 525251863cad + adding manifests + adding file changes + adding lfs.bin revisions + added 1 changesets with 1 changes to 1 files + calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs + bundle2-input-part: total payload size 648 + bundle2-input-part: "listkeys" (params: 1 mandatory) supported + bundle2-input-part: "phase-heads" supported + bundle2-input-part: total payload size 24 + bundle2-input-part: "cache:rev-branch-cache" supported + bundle2-input-part: total payload size 39 + bundle2-input-bundle: 3 parts total + checking for updated bookmarks + updating the branch cache + new changesets 525251863cad + updating to branch default + resolving manifests + branchmerge: False, force: False, partial: False + ancestor: , local: +, remote: 525251863cad + Status: 200 + Content-Length: 371 + Content-Type: application/vnd.git-lfs+json + Date: $HTTP_DATE$ + Server: testing stub value + { +"objects": [ + { +"actions": { + "download": { +"expires_at": "$ISO_8601_DATE_TIME$" +"header": { + "Accept": "application/vnd.git-lfs" +} +"href": "http://localhost:$HGPORT/subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e; + } +} +"oid": "f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e" +"size": 20 + } +] +"transfer": "basic" + } + lfs: downloading f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e (20 bytes) + Status: 200 + Content-Length: 20 + Content-Type: application/octet-stream + Date: $HTTP_DATE$ + Server: testing stub value + lfs: adding f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e to the usercache + lfs: processed: f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e +
D3174: cmdutil: refactor I/O for exporting
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Using generators for feeding chunks into I/O is more flexible than passing a file object or write function around. This commit refactors the patch exporting code to emit a series a data chunks instead of doing push-based I/O. As a side-effect, we could now obtain the patch representation of a changeset without having to use a file object. Yay! Code around the management of the file handles has also been cleaned up a bit. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3174 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 @@ -1526,7 +1526,7 @@ # it is given two arguments (sequencenumber, changectx) extraexportmap = {} -def _exportsingle(repo, ctx, match, switch_parent, seqno, write, diffopts): +def _exportsingle(repo, ctx, match, switch_parent, seqno, diffopts): node = scmutil.binnode(ctx) parents = [p.node() for p in ctx.parents() if p] branch = ctx.branch() @@ -1538,26 +1538,26 @@ else: prev = nullid -write("# HG changeset patch\n") -write("# User %s\n" % ctx.user()) -write("# Date %d %d\n" % ctx.date()) -write("# %s\n" % dateutil.datestr(ctx.date())) +yield "# HG changeset patch\n", None +yield "# User %s\n" % ctx.user(), None +yield "# Date %d %d\n" % ctx.date(), None +yield "# %s\n" % dateutil.datestr(ctx.date()), None if branch and branch != 'default': -write("# Branch %s\n" % branch) -write("# Node ID %s\n" % hex(node)) -write("# Parent %s\n" % hex(prev)) +yield "# Branch %s\n" % branch, None +yield "# Node ID %s\n" % hex(node), None +yield "# Parent %s\n" % hex(prev), None if len(parents) > 1: -write("# Parent %s\n" % hex(parents[1])) +yield "# Parent %s\n" % hex(parents[1]), None for headerid in extraexport: header = extraexportmap[headerid](seqno, ctx) if header is not None: -write('# %s\n' % header) -write(ctx.description().rstrip()) -write("\n\n") +yield '# %s\n' % header, None +yield ctx.description().rstrip(), None +yield "\n\n", None for chunk, label in patch.diffui(repo, prev, node, match, opts=diffopts): -write(chunk, label=label) +yield chunk, label def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False, opts=None, match=None): @@ -1590,30 +1590,40 @@ revwidth = max(len(str(rev)) for rev in revs) filemode = {} -write = None dest = '' if fp: +allfp = fp dest = getattr(fp, 'name', dest) -def write(s, **kw): -fp.write(s) +supportslabel = False elif not fntemplate: -write = repo.ui.write +allfp = repo.ui +supportslabel = True +else: +allfp = None +supportslabel = False + +def doexport(ctx, fp, dest): +if not dest.startswith('<'): +repo.ui.note('%s\n' % dest) + +for s, label in _exportsingle(repo, ctx, match, switch_parent, seqno, + opts): +if supportslabel and label: +fp.write(s, label=label) +else: +fp.write(s) for seqno, rev in enumerate(revs, 1): ctx = repo[rev] -fo = None -if not fp and fntemplate: -fo = makefileobj(ctx, fntemplate, mode='wb', modemap=filemode, - total=total, seqno=seqno, revwidth=revwidth) -dest = fo.name -def write(s, **kw): -fo.write(s) -if not dest.startswith('<'): -repo.ui.note("%s\n" % dest) -_exportsingle( -repo, ctx, match, switch_parent, seqno, write, opts) -if fo is not None: -fo.close() + +if not allfp: +assert fntemplate + +with makefileobj(ctx, fntemplate, mode='wb', modemap=filemode, + total=total, seqno=seqno, revwidth=revwidth) as fp: +doexport(ctx, fp, fp.name) +else: +doexport(ctx, allfp, dest) def showmarker(fm, marker, index=None): """utility function to display obsolescence marker in a readable way 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
D3175: commands: implement `export --format=X` with support for CBOR
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY What's better than having to parse patch files? Not having to parse them. The current text-based patch file format used by `hg export` is good for humans to exchange. But for machines, it is better to use a data format that is more structured. We recently introduced support for CBOR. CBOR is a great, binary preserving data format (unlike JSON), and I think we should use it heavily for data interchange. This commit teaches `hg export` to write data to CBOR. It adds a --format argument. Hopefully this is the most controversial part of this patch. I thought about using --template/-T. We already have -Tjson. -Tcbor seems like a reasonable feature addition. That might be the right way forward. I'm not sure. I didn't want to scope bloat the patch. At least not initially. (The code for exporting a patch is a bit wonky and I'm not very comfortable with the templating layer.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3175 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py mercurial/utils/stringutil.py tests/test-completion.t tests/test-export.t CHANGE DETAILS diff --git a/tests/test-export.t b/tests/test-export.t --- a/tests/test-export.t +++ b/tests/test-export.t @@ -258,6 +258,51 @@ abort: export requires at least one changeset [255] +--format=hg works and is the default + + $ hg export > expected + $ hg export --format hg > got + $ diff got expected + +--format=cbor emits a CBOR patch + + $ hg export --format cbor > cbor + $ f --sha256 --hexdump cbor + cbor: sha256=825d5c5a23bb64d1aad17e39f1e151c933d519293f3d05eb591a7479453ea21a + : 9f bf 47 76 65 72 73 69 6f 6e 01 44 75 73 65 72 |..Gversion.Duser| + 0010: 44 74 65 73 74 44 74 69 6d 65 fb 00 00 00 00 00 |DtestDtime..| + 0020: 00 00 00 48 74 69 6d 65 7a 6f 6e 65 00 46 62 72 |...Htimezone.Fbr| + 0030: 61 6e 63 68 47 64 65 66 61 75 6c 74 44 6e 6f 64 |anchGdefaultDnod| + 0040: 65 54 19 7e cd 81 a5 7f 76 0b 54 f3 4a 58 81 7a |eT.~v.T.JX.z| + 0050: d5 b0 49 91 fa 47 47 70 61 72 65 6e 74 73 81 54 |..I..GGparents.T| + 0060: f3 ac ba fa c1 61 ec 68 f1 59 8a f3 8f 79 4f 28 |.a.h.Y...yO(| + 0070: 84 7c a5 d3 4b 64 65 73 63 72 69 70 74 69 6f 6e |.|..Kdescription| + 0080: 58 5b 20 21 22 23 24 25 26 28 2c 2d 2e 2f 30 31 |X[ !"#$%&(,-./01| + 0090: 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 |23456789:;<=>?@A| + 00a0: 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 |BCDEFGHIJKLMNOPQ| + 00b0: 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 |RSTUVWXYZ[\]^_`a| + 00c0: 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 |bcdefghijklmnopq| + 00d0: 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 4b 70 61 |rstuvwxyz{|}~Kpa| + 00e0: 74 63 68 63 68 75 6e 6b 73 9f 58 7b 64 69 66 66 |tchchunks.X{diff| + 00f0: 20 2d 72 20 66 33 61 63 62 61 66 61 63 31 36 31 | -r f3acbafac161| + 0100: 20 2d 72 20 31 39 37 65 63 64 38 31 61 35 37 66 | -r 197ecd81a57f| + 0110: 20 66 6f 6f 0a 2d 2d 2d 20 61 2f 66 6f 6f 09 54 | foo.--- a/foo.T| + 0120: 68 75 20 4a 61 6e 20 30 31 20 30 30 3a 30 30 3a |hu Jan 01 00:00:| + 0130: 30 30 20 31 39 37 30 20 2b 30 30 30 30 0a 2b 2b |00 1970 +.++| + 0140: 2b 20 62 2f 66 6f 6f 09 54 68 75 20 4a 61 6e 20 |+ b/foo.Thu Jan | + 0150: 30 31 20 30 30 3a 30 30 3a 30 30 20 31 39 37 30 |01 00:00:00 1970| + 0160: 20 2b 30 30 30 30 0a 58 2f 40 40 20 2d 31 30 2c | +.X/@@ -10,| + 0170: 33 20 2b 31 30 2c 34 20 40 40 0a 20 66 6f 6f 2d |3 +10,4 @@. foo-| + 0180: 39 0a 20 66 6f 6f 2d 31 30 0a 20 66 6f 6f 2d 31 |9. foo-10. foo-1| + 0190: 31 0a 2b 6c 69 6e 65 0a ff ff ff|1.+line| + + >>> from __future__ import print_function + >>> from mercurial.thirdparty import cbor + >>> from mercurial.utils import stringutil + >>> with open('cbor', 'rb') as fh: + ... print(stringutil.pprint(cbor.load(fh))) + [{b'branch': b'default', b'description': b' !"#$%&(,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', b'node': b'\x19~\xcd\x81\xa5\x7fv\x0bT\xf3JX\x81z\xd5\xb0I\x91\xfaG', b'parents': [b'\xf3\xac\xba\xfa\xc1a\xech\xf1Y\x8a\xf3\x8fyO(\x84|\xa5\xd3'], b'patchchunks': [b'diff -r f3acbafac161 -r 197ecd81a57f foo\n--- a/foo\tThu Jan 01 00:00:00 1970 +\n+++ b/foo\tThu Jan 01 00:00:00 1970 +\n', b'@@ -10,3 +10,4 @@\n foo-9\n foo-10\n foo-11\n+line\n'], b'time': 0.00, b'timezone': 0, b'user': b'test', b'version': 1}] + Check for color output $ cat <> $HGRCPATH > [color] diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -231,7 +231,7 @@ clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos
D3172: cborutil: implement streaming arrays and maps
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The vendored cbor2 package doesn't have support for streaming / indefinite length items when encoding. This is kind of unfortunate. While it might be worth our while to upstream this feature to the package, for now it is more expedient to implement it ourselves. This commit implements support for encoding indefinite length arrays and maps. We use a context manager that receives a CBOREncoder and hands the caller a function that can be used to write individual items. When the context manager exits, the "break" byte is sent. As a refresher of RFC 7042, tThe initial byte of a CBOR item contains 3 bits for the major type and 5 bits for additional information. Information value 31 is used to denote indefinite-length items. Indefinite length arrays and maps simply emit their items inline. After the final item, a "break" byte (major type 7, additional information 31 - value 0xff) is written. There are no nesting restrictions. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3172 AFFECTED FILES mercurial/utils/cborutil.py tests/test-cbor.py CHANGE DETAILS diff --git a/tests/test-cbor.py b/tests/test-cbor.py new file mode 100644 --- /dev/null +++ b/tests/test-cbor.py @@ -0,0 +1,176 @@ +from __future__ import absolute_import + +import io +import unittest + +from mercurial.thirdparty import ( +cbor, +) +from mercurial.utils import ( +cborutil, +) + +class StreamArrayTests(unittest.TestCase): +def testempty(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streamarray(encoder): +pass + +self.assertEqual(b.getvalue(), '\x9f\xff') +self.assertEqual(cbor.loads(b.getvalue()), []) + +def testone(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streamarray(encoder) as fn: +fn(b'foo') + +self.assertEqual(cbor.loads(b.getvalue()), [b'foo']) + +def testmultiple(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streamarray(encoder) as fn: +fn(0) +fn(True) +fn(b'foo') +fn(None) + +self.assertEqual(cbor.loads(b.getvalue()), [0, True, b'foo', None]) + +def testnested(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streamarray(encoder): +with cborutil.streamarray(encoder) as fn: +fn(b'foo') +fn(b'bar') + +self.assertEqual(cbor.loads(b.getvalue()), [[b'foo', b'bar']]) + +def testitemslist(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +orig = [b'foo', b'bar', None, True, 42] + +cborutil.streamarrayitems(encoder, orig) +self.assertEqual(cbor.loads(b.getvalue()), orig) + +def testitemsgen(self): +def makeitems(): +yield b'foo' +yield b'bar' +yield None +yield 42 + +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +cborutil.streamarrayitems(encoder, makeitems()) +self.assertEqual(cbor.loads(b.getvalue()), [b'foo', b'bar', None, 42]) + +class StreamMapTests(unittest.TestCase): +def testempty(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streammap(encoder): +pass + +self.assertEqual(b.getvalue(), '\xbf\xff') +self.assertEqual(cbor.loads(b.getvalue()), {}) + +def testone(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streammap(encoder) as fn: +fn(b'key1', b'value1') + +self.assertEqual(cbor.loads(b.getvalue()), {b'key1': b'value1'}) + +def testmultiple(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streammap(encoder) as fn: +fn(0, 1) +fn(b'key1', b'value1') +fn(True, None) + +self.assertEqual(cbor.loads(b.getvalue()), { +0: 1, +b'key1': b'value1', +True: None, +}) + +def testcomplex(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streammap(encoder) as fn: +fn(b'key1', b'value1') +fn(b'map', {b'inner1key': b'inner1value'}) +fn(b'array', [0, 1, 2]) + +self.assertEqual(cbor.loads(b.getvalue()), { +b'key1': b'value1', +b'map': {b'inner1key': b'inner1value'}, +b'array': [0, 1, 2], +}) + +def testnested(self): +b = io.BytesIO() +encoder = cbor.CBOREncoder(b) + +with cborutil.streammap(encoder): +encoder.encode(b'streamkey') +with
D3173: cmdutil: drop unused rev arguments from _exportsingle()
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY No clue when we stopped using it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3173 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 @@ -1526,7 +1526,7 @@ # it is given two arguments (sequencenumber, changectx) extraexportmap = {} -def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts): +def _exportsingle(repo, ctx, match, switch_parent, seqno, write, diffopts): node = scmutil.binnode(ctx) parents = [p.node() for p in ctx.parents() if p] branch = ctx.branch() @@ -1611,7 +1611,7 @@ if not dest.startswith('<'): repo.ui.note("%s\n" % dest) _exportsingle( -repo, ctx, match, switch_parent, rev, seqno, write, opts) +repo, ctx, match, switch_parent, seqno, write, opts) if fo is not None: fo.close() 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
D3171: wireproto: send server capabilities in canonical order
This revision was automatically updated to reflect the committed changes. Closed by commit rHG33af46d639b4: wireproto: send server capabilities in canonical order (authored by joerg.sonnenberger, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3171?vs=7808=7811 REVISION DETAIL https://phab.mercurial-scm.org/D3171 AFFECTED FILES mercurial/wireproto.py tests/test-debugcommands.t tests/test-hgweb-commands.t tests/test-http-bad-server.t tests/test-http-protocol.t tests/test-ssh-bundle1.t tests/test-ssh-proto-unbundle.t tests/test-ssh-proto.t tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -497,7 +497,7 @@ sending between command remote: 413 (sshv1 !) protocol upgraded to exp-ssh-v2-0001 (sshv2 !) - remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 (sshv1 !) devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) 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 @@ -64,7 +64,7 @@ devel-peer-request: pairs: 81 bytes sending between command remote: 413 - remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) @@ -87,16 +87,16 @@ o> readline() -> 4: o> 413\n o> readline() -> 413: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n `hg debugserve --sshstdio` works $ cd server $ hg debugserve --sshstdio << EOF > hello > EOF 413 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash I/O logging works @@ -106,22 +106,22 @@ o> write(4) -> 4: o> 413\n o> write(413) -> 413: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n 413 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash o> flush() -> None $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF > hello > EOF 413 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash $ cat $TESTTMP/io o> write(4) -> 4: o> 413\n o> write(413) -> 413: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey
D3169: wireproto: turn client capabilities into sets, sorted on the wire
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3e1688711efd: wireproto: turn client capabilities into sets, sorted on the wire (authored by joerg.sonnenberger, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3169?vs=7806=7809 REVISION DETAIL https://phab.mercurial-scm.org/D3169 AFFECTED FILES mercurial/httppeer.py mercurial/sshpeer.py CHANGE DETAILS diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -168,10 +168,10 @@ Returns a list of capabilities that are supported by this client. """ -protoparams = [] +protoparams = set() comps = [e.wireprotosupport().name for e in util.compengines.supportedwireengines(util.CLIENTROLE)] -protoparams.append('comp=%s' % ','.join(comps)) +protoparams.add('comp=%s' % ','.join(comps)) return protoparams def _performhandshake(ui, stdin, stdout, stderr): @@ -626,7 +626,8 @@ # capabilities. if 'protocaps' in peer.capabilities(): try: -peer._call("protocaps", caps=' '.join(_clientcapabilities())) +peer._call("protocaps", + caps=' '.join(sorted(_clientcapabilities( except IOError: peer._cleanup() raise error.RepoError(_('capability exchange failed')) diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -282,28 +282,28 @@ # Tell the server we accept application/mercurial-0.2 and multiple # compression formats if the server is capable of emitting those # payloads. -protoparams = [] +protoparams = set() mediatypes = set() if self._caps is not None: mt = self.capable('httpmediatype') if mt: -protoparams.append('0.1') +protoparams.add('0.1') mediatypes = set(mt.split(',')) if '0.2tx' in mediatypes: -protoparams.append('0.2') +protoparams.add('0.2') if '0.2tx' in mediatypes and self.capable('compression'): # We /could/ compare supported compression formats and prune # non-mutually supported or error if nothing is mutually supported. # For now, send the full list to the server and have it error. comps = [e.wireprotosupport().name for e in util.compengines.supportedwireengines(util.CLIENTROLE)] -protoparams.append('comp=%s' % ','.join(comps)) +protoparams.add('comp=%s' % ','.join(comps)) if protoparams: -protoheaders = encodevalueinheaders(' '.join(protoparams), +protoheaders = encodevalueinheaders(' '.join(sorted(protoparams)), 'X-HgProto', headersize or 1024) for header, value in protoheaders: To: joerg.sonnenberger, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3170: wireproto: don't special case bundlecaps, but sort all scsv arguments
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1d459f61b42a: wireproto: dont special case bundlecaps, but sort all scsv arguments (authored by joerg.sonnenberger, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3170?vs=7807=7810 REVISION DETAIL https://phab.mercurial-scm.org/D3170 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -297,11 +297,7 @@ kwargs = pycompat.byteskwargs(kwargs) self.requirecap('getbundle', _('look up remote changes')) opts = {} -bundlecaps = kwargs.get('bundlecaps') -if bundlecaps is not None: -kwargs['bundlecaps'] = sorted(bundlecaps) -else: -bundlecaps = () # kwargs could have it to None +bundlecaps = kwargs.get('bundlecaps') or set() for key, value in kwargs.iteritems(): if value is None: continue @@ -311,8 +307,10 @@ 'Unexpectedly None keytype for key %s' % key) elif keytype == 'nodes': value = encodelist(value) -elif keytype in ('csv', 'scsv'): +elif keytype == 'csv': value = ','.join(value) +elif keytype == 'scsv': +value = ','.join(sorted(value)) elif keytype == 'boolean': value = '%i' % bool(value) elif keytype != 'plain': To: joerg.sonnenberger, #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
D3171: wireproto: send server capabilities in canonical order
joerg.sonnenberger 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/D3171 AFFECTED FILES mercurial/wireproto.py tests/test-debugcommands.t tests/test-hgweb-commands.t tests/test-http-bad-server.t tests/test-http-protocol.t tests/test-ssh-bundle1.t tests/test-ssh-proto-unbundle.t tests/test-ssh-proto.t tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -497,7 +497,7 @@ sending between command remote: 413 (sshv1 !) protocol upgraded to exp-ssh-v2-0001 (sshv2 !) - remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 (sshv1 !) devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) 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 @@ -64,7 +64,7 @@ devel-peer-request: pairs: 81 bytes sending between command remote: 413 - remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash remote: 1 devel-peer-request: protocaps devel-peer-request: caps: * bytes (glob) @@ -87,16 +87,16 @@ o> readline() -> 4: o> 413\n o> readline() -> 413: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n `hg debugserve --sshstdio` works $ cd server $ hg debugserve --sshstdio << EOF > hello > EOF 413 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash I/O logging works @@ -106,22 +106,22 @@ o> write(4) -> 4: o> 413\n o> write(413) -> 413: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n 413 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash o> flush() -> None $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF > hello > EOF 413 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch + capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash $ cat $TESTTMP/io o> write(4) -> 4: o> 413\n o> write(413) -> 413: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n o> flush() -> None $ cd .. @@ -148,7 +148,7 @@ o> readline() -> 4: o> 413\n o> readline()
D3170: wireproto: don't special case bundlecaps, but sort all scsv arguments
joerg.sonnenberger 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/D3170 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -297,11 +297,7 @@ kwargs = pycompat.byteskwargs(kwargs) self.requirecap('getbundle', _('look up remote changes')) opts = {} -bundlecaps = kwargs.get('bundlecaps') -if bundlecaps is not None: -kwargs['bundlecaps'] = sorted(bundlecaps) -else: -bundlecaps = () # kwargs could have it to None +bundlecaps = kwargs.get('bundlecaps') or set() for key, value in kwargs.iteritems(): if value is None: continue @@ -311,8 +307,10 @@ 'Unexpectedly None keytype for key %s' % key) elif keytype == 'nodes': value = encodelist(value) -elif keytype in ('csv', 'scsv'): +elif keytype == 'csv': value = ','.join(value) +elif keytype == 'scsv': +value = ','.join(sorted(value)) elif keytype == 'boolean': value = '%i' % bool(value) elif keytype != 'plain': To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3169: wireproto: turn client capabilities into sets, sorted on the wire
joerg.sonnenberger 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/D3169 AFFECTED FILES mercurial/httppeer.py mercurial/sshpeer.py CHANGE DETAILS diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -168,10 +168,10 @@ Returns a list of capabilities that are supported by this client. """ -protoparams = [] +protoparams = set() comps = [e.wireprotosupport().name for e in util.compengines.supportedwireengines(util.CLIENTROLE)] -protoparams.append('comp=%s' % ','.join(comps)) +protoparams.add('comp=%s' % ','.join(comps)) return protoparams def _performhandshake(ui, stdin, stdout, stderr): @@ -626,7 +626,8 @@ # capabilities. if 'protocaps' in peer.capabilities(): try: -peer._call("protocaps", caps=' '.join(_clientcapabilities())) +peer._call("protocaps", + caps=' '.join(sorted(_clientcapabilities( except IOError: peer._cleanup() raise error.RepoError(_('capability exchange failed')) diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -282,28 +282,28 @@ # Tell the server we accept application/mercurial-0.2 and multiple # compression formats if the server is capable of emitting those # payloads. -protoparams = [] +protoparams = set() mediatypes = set() if self._caps is not None: mt = self.capable('httpmediatype') if mt: -protoparams.append('0.1') +protoparams.add('0.1') mediatypes = set(mt.split(',')) if '0.2tx' in mediatypes: -protoparams.append('0.2') +protoparams.add('0.2') if '0.2tx' in mediatypes and self.capable('compression'): # We /could/ compare supported compression formats and prune # non-mutually supported or error if nothing is mutually supported. # For now, send the full list to the server and have it error. comps = [e.wireprotosupport().name for e in util.compengines.supportedwireengines(util.CLIENTROLE)] -protoparams.append('comp=%s' % ','.join(comps)) +protoparams.add('comp=%s' % ','.join(comps)) if protoparams: -protoheaders = encodevalueinheaders(' '.join(protoparams), +protoheaders = encodevalueinheaders(' '.join(sorted(protoparams)), 'X-HgProto', headersize or 1024) for header, value in protoheaders: To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3168: tests: enter full hex hash in plain text in bundle part
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We were looking it up be prefix by repo.__getitem__, which I'm about to drop support for. It's easiest to just include the full hash in plain text. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3168 AFFECTED FILES tests/test-bundle2-exchange.t CHANGE DETAILS diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -787,7 +787,7 @@ > enc = pushkey.encode > part = bundler.newpart('pushkey') > part.addparam('namespace', enc('phases')) - > part.addparam('key', enc(pushop.repo['cd010b8cd998'].hex())) + > part.addparam('key', enc('cd010b8cd998f3981a5a8115f94f8da4ab506089')) > part.addparam('old', enc(str(0))) # successful update > part.addparam('new', enc(str(0))) > def fail(pushop, exc): 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
D3153: tests: call rawsize() directly
quark added a comment. It was `revlog.revlog.size`, and got changed to `rawsize` before committed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3153 To: indygreg, #hg-reviewers Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3093: store: make file filtering during walk configurable
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4c15bee42e9c: store: make file filtering during walk configurable (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3093?vs=7675=7803 REVISION DETAIL https://phab.mercurial-scm.org/D3093 AFFECTED FILES mercurial/store.py CHANGE DETAILS diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -319,6 +319,9 @@ _data = ('data meta 00manifest.d 00manifest.i 00changelog.d 00changelog.i' ' phaseroots obsstore') +def isrevlog(f, kind, st): +return kind == stat.S_IFREG and f[-2:] in ('.i', '.d') + class basicstore(object): '''base class for local repository stores''' def __init__(self, path, vfstype): @@ -333,7 +336,7 @@ def join(self, f): return self.path + '/' + encodedir(f) -def _walk(self, relpath, recurse): +def _walk(self, relpath, recurse, filefilter=isrevlog): '''yields (unencoded, encoded, size)''' path = self.path if relpath: @@ -347,7 +350,7 @@ p = visit.pop() for f, kind, st in readdir(p, stat=True): fp = p + '/' + f -if kind == stat.S_IFREG and f[-2:] in ('.d', '.i'): +if filefilter(f, kind, st): n = util.pconvert(fp[striplen:]) l.append((decodedir(n), n, st.st_size)) elif kind == stat.S_IFDIR and recurse: 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
D3091: tests: extract dumprevlog tests to own file
This revision was automatically updated to reflect the committed changes. Closed by commit rHG567bddcb4271: tests: extract dumprevlog tests to own file (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3091?vs=7673=7801 REVISION DETAIL https://phab.mercurial-scm.org/D3091 AFFECTED FILES tests/test-contrib-dumprevlog.t tests/test-contrib.t CHANGE DETAILS diff --git a/tests/test-contrib.t b/tests/test-contrib.t --- a/tests/test-contrib.t +++ b/tests/test-contrib.t @@ -2,108 +2,6 @@ $ CONTRIBDIR="$TESTDIR/../contrib" -Prepare repo-a: - - $ hg init repo-a - $ cd repo-a - - $ echo this is file a > a - $ hg add a - $ hg commit -m first - - $ echo adding to file a >> a - $ hg commit -m second - - $ echo adding more to file a >> a - $ hg commit -m third - - $ hg verify - checking changesets - checking manifests - crosschecking files in changesets and manifests - checking files - 1 files, 3 changesets, 3 total revisions - -Dumping revlog of file a to stdout: - - $ $PYTHON "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i - file: .hg/store/data/a.i - node: 183d2312b35066fb6b3b449b84efc370d50993d0 - linkrev: 0 - parents: - length: 15 - -start- - this is file a - - -end- - node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b - linkrev: 1 - parents: 183d2312b35066fb6b3b449b84efc370d50993d0 - length: 32 - -start- - this is file a - adding to file a - - -end- - node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1 - linkrev: 2 - parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b - length: 54 - -start- - this is file a - adding to file a - adding more to file a - - -end- - -Dump all revlogs to file repo.dump: - - $ find .hg/store -name "*.i" | sort | xargs $PYTHON "$CONTRIBDIR/dumprevlog" > ../repo.dump - $ cd .. - -Undumping into repo-b: - - $ hg init repo-b - $ cd repo-b - $ $PYTHON "$CONTRIBDIR/undumprevlog" < ../repo.dump - .hg/store/00changelog.i - .hg/store/00manifest.i - .hg/store/data/a.i - $ cd .. - -Rebuild fncache with clone --pull: - - $ hg clone --pull -U repo-b repo-c - requesting all changes - adding changesets - adding manifests - adding file changes - added 3 changesets with 3 changes to 1 files - new changesets de1da620e7d8:46946d278c50 - -Verify: - - $ hg -R repo-c verify - checking changesets - checking manifests - crosschecking files in changesets and manifests - checking files - 1 files, 3 changesets, 3 total revisions - -Compare repos: - - $ hg -R repo-c incoming repo-a - comparing with repo-a - searching for changes - no changes found - [1] - - $ hg -R repo-a incoming repo-c - comparing with repo-c - searching for changes - no changes found - [1] - Test simplemerge command: $ cp "$CONTRIBDIR/simplemerge" . diff --git a/tests/test-contrib-dumprevlog.t b/tests/test-contrib-dumprevlog.t new file mode 100644 --- /dev/null +++ b/tests/test-contrib-dumprevlog.t @@ -0,0 +1,101 @@ +#require reporevlogstore + + $ CONTRIBDIR="$TESTDIR/../contrib" + + $ hg init repo-a + $ cd repo-a + + $ echo this is file a > a + $ hg add a + $ hg commit -m first + + $ echo adding to file a >> a + $ hg commit -m second + + $ echo adding more to file a >> a + $ hg commit -m third + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 3 changesets, 3 total revisions + +Dumping revlog of file a to stdout: + $ $PYTHON "$CONTRIBDIR/dumprevlog" .hg/store/data/a.i + file: .hg/store/data/a.i + node: 183d2312b35066fb6b3b449b84efc370d50993d0 + linkrev: 0 + parents: + length: 15 + -start- + this is file a + + -end- + node: b1047953b6e6b633c0d8197eaa5116fbdfd3095b + linkrev: 1 + parents: 183d2312b35066fb6b3b449b84efc370d50993d0 + length: 32 + -start- + this is file a + adding to file a + + -end- + node: 8c4fd1f7129b8cdec6c7f58bf48fb5237a4030c1 + linkrev: 2 + parents: b1047953b6e6b633c0d8197eaa5116fbdfd3095b + length: 54 + -start- + this is file a + adding to file a + adding more to file a + + -end- + +Dump all revlogs to file repo.dump: + + $ find .hg/store -name "*.i" | sort | xargs $PYTHON "$CONTRIBDIR/dumprevlog" > ../repo.dump + $ cd .. + +Undumping into repo-b: + + $ hg init repo-b + $ cd repo-b + $ $PYTHON "$CONTRIBDIR/undumprevlog" < ../repo.dump + .hg/store/00changelog.i + .hg/store/00manifest.i + .hg/store/data/a.i + $ cd .. + +Rebuild fncache with clone --pull: + + $ hg clone --pull -U repo-b repo-c + requesting all changes + adding changesets + adding manifests + adding file changes + added 3
D3094: verify: drop "revlog" from warning message
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa6651f5e2c78: verify: drop revlog from warning message (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3094?vs=7676=7804 REVISION DETAIL https://phab.mercurial-scm.org/D3094 AFFECTED FILES mercurial/verify.py tests/test-repair-strip.t tests/test-treemanifest.t tests/test-verify.t CHANGE DETAILS diff --git a/tests/test-verify.t b/tests/test-verify.t --- a/tests/test-verify.t +++ b/tests/test-verify.t @@ -116,7 +116,7 @@ $ rm .hg/store/00changelog.* $ rm .hg/store/00manifest.* $ hg verify -q - warning: orphan revlog 'data/file.i' + warning: orphan data file 'data/file.i' 1 warnings encountered! $ cp -R .hg/store-full/. .hg/store @@ -296,7 +296,7 @@ crosschecking files in changesets and manifests checking files a@1: broken revlog! (index data/a.i is corrupted) - warning: orphan revlog 'data/a.i' + warning: orphan data file 'data/a.i' 1 files, 2 changesets, 0 total revisions 1 warnings encountered! 1 integrity errors encountered! diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -599,12 +599,12 @@ b/@1: parent-directory manifest refers to unknown revision f065da70369e b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b b/@3: parent-directory manifest refers to unknown revision 367152e6af28 - warning: orphan revlog 'meta/b/bar/00manifest.i' - warning: orphan revlog 'meta/b/bar/orange/00manifest.i' - warning: orphan revlog 'meta/b/bar/orange/fly/00manifest.i' - warning: orphan revlog 'meta/b/foo/00manifest.i' - warning: orphan revlog 'meta/b/foo/apple/00manifest.i' - warning: orphan revlog 'meta/b/foo/apple/bees/00manifest.i' + warning: orphan data file 'meta/b/bar/00manifest.i' + warning: orphan data file 'meta/b/bar/orange/00manifest.i' + warning: orphan data file 'meta/b/bar/orange/fly/00manifest.i' + warning: orphan data file 'meta/b/foo/00manifest.i' + warning: orphan data file 'meta/b/foo/apple/00manifest.i' + warning: orphan data file 'meta/b/foo/apple/bees/00manifest.i' crosschecking files in changesets and manifests b/bar/fruits.txt@0: in changeset but not in manifest b/bar/orange/fly/gnat.py@0: in changeset but not in manifest diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t --- a/tests/test-repair-strip.t +++ b/tests/test-repair-strip.t @@ -62,7 +62,7 @@ b@?: rev 1 points to nonexistent changeset 2 (expected 1) b@?: 736c29771fba not in manifests - warning: orphan revlog 'data/c.i' + warning: orphan data file 'data/c.i' 2 files, 2 changesets, 3 total revisions 2 warnings encountered! 2 integrity errors encountered! diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -295,7 +295,7 @@ if not dir and subdirnodes: ui.progress(_('checking'), None) for f in sorted(storefiles): -self.warn(_("warning: orphan revlog '%s'") % f) +self.warn(_("warning: orphan data file '%s'") % f) return filenodes @@ -482,6 +482,6 @@ ui.progress(_('checking'), None) for f in sorted(storefiles): -self.warn(_("warning: orphan revlog '%s'") % f) +self.warn(_("warning: orphan data file '%s'") % f) return len(files), revisions 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
D3092: simplestore: shore up lookup errors
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdd2753729853: simplestore: shore up lookup errors (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3092?vs=7674=7802 REVISION DETAIL https://phab.mercurial-scm.org/D3092 AFFECTED FILES tests/simplestorerepo.py CHANGE DETAILS diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -152,8 +152,10 @@ def rev(self, node): validatenode(node) -# Will raise KeyError. -self._indexbynode[node] +try: +self._indexbynode[node] +except KeyError: +raise error.LookupError(node, self._indexpath, _('no node')) for rev, entry in self._indexbyrev.items(): if entry[b'node'] == node: @@ -171,11 +173,8 @@ return self.node(node) if len(node) == 20: -try: -self.rev(node) -return node -except LookupError: -pass +self.rev(node) +return node try: rev = int(node) @@ -196,10 +195,10 @@ rawnode = bin(node) self.rev(rawnode) return rawnode -except (TypeError, LookupError): +except TypeError: pass -raise LookupError(node, self._path, _('invalid lookup input')) +raise error.LookupError(node, self._path, _('invalid lookup input')) def linkrev(self, rev): validaterev(rev) @@ -280,8 +279,6 @@ if node == nullid: return b'' -self._indexbynode[node] - rev = self.rev(node) flags = self.flags(rev) To: indygreg, #hg-reviewers Cc: durin42, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3158: histedit: look up partial nodeid as partial nodeid
martinvonz added inline comments. INLINE COMMENTS > indygreg wrote in histedit.py:446 > Err wait. Why is `repo.unfiltered()` being used here? If the previous code > worked on on the filtered repo, shouldn't this code? > > The side effect of this change is that a histedit rule could reference a > hidden changeset. That feels wrong. > If the previous code worked on on the filtered repo, shouldn't this code? The previous code just *looked like* it worked on the filtered repo :) This is copied from changectx.__init__(), which is where this would end up getting resolved before. I don't remember what the reason is for *that* code to use the unfiltered repo (I think it had something to do with making {shortest(node)} length match what's actually unambiguous. Either way, this patch should not be changing any behavior, I think. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3158 To: martinvonz, durin42, #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
D3158: histedit: look up partial nodeid as partial nodeid
indygreg requested changes to this revision. indygreg added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > histedit.py:446 > ha = node.hex(self.node) > -try: > -self.node = repo[ha].node() > -except error.RepoError: > -raise error.ParseError(_('unknown changeset %s listed') > - % ha[:12]) > +self.node = repo.unfiltered().changelog._partialmatch(ha) > +if self.node is None: Err wait. Why is `repo.unfiltered()` being used here? If the previous code worked on on the filtered repo, shouldn't this code? The side effect of this change is that a histedit rule could reference a hidden changeset. That feels wrong. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3158 To: martinvonz, durin42, #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
D3162: bookmarks: introduce a repo._bookmarks.ctx(mark) method and use it
indygreg added a comment. How do you feel about `changectx` instead of `ctx`? This would seemingly jive with other naming throughout the code base. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3162 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
D3167: bookmarks: use isrevsymbol() for detecting collision with existing symbol
This revision was automatically updated to reflect the committed changes. Closed by commit rHG46d9f998c3ed: bookmarks: use isrevsymbol() for detecting collision with existing symbol (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3167?vs=7794=7799 REVISION DETAIL https://phab.mercurial-scm.org/D3167 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 @@ -238,7 +238,7 @@ _("a bookmark cannot have the name of an existing branch")) if len(mark) > 3 and not force: try: -shadowhash = (mark in self._repo) +shadowhash = scmutil.isrevsymbol(self._repo, mark) except error.LookupError: # ambiguous identifier shadowhash = False if shadowhash: 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
D3166: debugwhyunstable: add support for revsets
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9966f44ecab4: debugwhyunstable: add support for revsets (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3166?vs=7793=7798 REVISION DETAIL https://phab.mercurial-scm.org/D3166 AFFECTED FILES mercurial/debugcommands.py CHANGE DETAILS diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2547,7 +2547,7 @@ @command('debugwhyunstable', [], _('REV')) def debugwhyunstable(ui, repo, rev): """explain instabilities of a changeset""" -for entry in obsutil.whyunstable(repo, repo[rev]): +for entry in obsutil.whyunstable(repo, scmutil.revsingle(repo, rev)): dnodes = '' if entry.get('divergentnodes'): dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr()) 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
D3162: bookmarks: introduce a repo._bookmarks.ctx(mark) method and use it
martinvonz updated this revision to Diff 7795. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3162?vs=7789=7795 REVISION DETAIL https://phab.mercurial-scm.org/D3162 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 @@ -119,6 +119,9 @@ def update(self, *others): raise error.ProgrammingError("use 'bookmarks.applychanges' instead") +def ctx(self, mark): +return self._repo[self[mark]] + def applychanges(self, repo, tr, changes): """Apply a list of changes to bookmarks """ @@ -212,8 +215,8 @@ return [] rev = self._repo[target].rev() anc = self._repo.changelog.ancestors([rev]) -bmctx = self._repo[self[mark]] -divs = [self._repo[b].node() for b in self +bmctx = self.ctx(mark) +divs = [self[b] for b in self if b.split('@', 1)[0] == mark.split('@', 1)[0]] # allow resolving a single divergent bookmark even if moving @@ -370,11 +373,11 @@ bmchanges = [] if marks[active] in parents: new = repo[node] -divs = [repo[b] for b in marks +divs = [marks.ctx(b) for b in marks if b.split('@', 1)[0] == active.split('@', 1)[0]] anc = repo.changelog.ancestors([new.rev()]) deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] -if validdest(repo, repo[marks[active]], new): +if validdest(repo, marks.ctx(active), new): bmchanges.append((active, new.node())) for bm in divergent2delete(repo, deletefrom, active): 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
D3166: debugwhyunstable: add support for revsets
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/D3166 AFFECTED FILES mercurial/debugcommands.py CHANGE DETAILS diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2547,7 +2547,7 @@ @command('debugwhyunstable', [], _('REV')) def debugwhyunstable(ui, repo, rev): """explain instabilities of a changeset""" -for entry in obsutil.whyunstable(repo, repo[rev]): +for entry in obsutil.whyunstable(repo, scmutil.revsingle(repo, rev)): dnodes = '' if entry.get('divergentnodes'): dnodes = ' '.join('%s (%s)' % (ctx.hex(), ctx.phasestr()) 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
D3162: bookmarks: introduce a repo._bookmarks.ctx(mark) method and use it
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Many places were doing repo[mark], which usually works, but it's slightly incorrect: if the bookmark has a name that matches a full hex nodeid of another node, then the context for the other node will be returned instead. Also, I'm about to remove support for repo[] :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3162 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 @@ -119,6 +119,9 @@ def update(self, *others): raise error.ProgrammingError("use 'bookmarks.applychanges' instead") +def ctx(self, mark): +return self._repo[self[mark]] + def applychanges(self, repo, tr, changes): """Apply a list of changes to bookmarks """ @@ -212,8 +215,8 @@ return [] rev = self._repo[target].rev() anc = self._repo.changelog.ancestors([rev]) -bmctx = self._repo[self[mark]] -divs = [self._repo[b].node() for b in self +bmctx = self.ctx(mark) +divs = [self.ctx(b).node() for b in self if b.split('@', 1)[0] == mark.split('@', 1)[0]] # allow resolving a single divergent bookmark even if moving @@ -370,11 +373,11 @@ bmchanges = [] if marks[active] in parents: new = repo[node] -divs = [repo[b] for b in marks +divs = [marks.ctx(b) for b in marks if b.split('@', 1)[0] == active.split('@', 1)[0]] anc = repo.changelog.ancestors([new.rev()]) deletefrom = [b.node() for b in divs if b.rev() in anc or b == new] -if validdest(repo, repo[marks[active]], new): +if validdest(repo, marks.ctx(active), new): bmchanges.append((active, new.node())) for bm in divergent2delete(repo, deletefrom, active): 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
D3163: discovery: look up bookmarks only among bookmarks
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/D3163 AFFECTED FILES mercurial/discovery.py CHANGE DETAILS diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -297,12 +297,12 @@ for bm in localbookmarks: rnode = remotebookmarks.get(bm) if rnode and rnode in repo: -lctx, rctx = repo[bm], repo[rnode] +lctx, rctx = localbookmarks.ctx(bm), repo[rnode] if bookmarks.validdest(repo, rctx, lctx): bookmarkedheads.add(lctx.node()) else: if bm in newbookmarks and bm not in remotebookmarks: -bookmarkedheads.add(repo[bm].node()) +bookmarkedheads.add(localbookmarks[bm]) return bookmarkedheads 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
D3165: infinitepush: look up bookmarks only among bookmarks
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/D3165 AFFECTED FILES hgext/infinitepush/bundleparts.py CHANGE DETAILS diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py --- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -46,8 +46,9 @@ params['bookmark'] = bookmark # 'prevbooknode' is necessary for pushkey reply part params['bookprevnode'] = '' -if bookmark in repo: -params['bookprevnode'] = repo[bookmark].hex() +bookmarks = repo._bookmarks +if bookmark in bookmarks: +params['bookprevnode'] = bookmarks.ctx(bookmark).hex() # Do not send pushback bundle2 part with bookmarks if remotenames extension # is enabled. It will be handled manually in `_push()` 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
D3164: destutil: look up bookmarks only among bookmarks
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/D3164 AFFECTED FILES mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -58,7 +58,7 @@ node = None activemark, movemark = bookmarks.calculateupdate(repo.ui, repo) if activemark is not None: -node = repo.lookup(activemark) +node = repo._bookmarks[activemark] return node, movemark, activemark def _destupdatebranch(repo, clean): @@ -236,7 +236,7 @@ """find merge destination in the active bookmark case""" node = None bmheads = bookmarks.headsforactive(repo) -curhead = repo[repo._activebookmark].node() +curhead = repo._bookmarks[repo._activebookmark] if len(bmheads) == 2: if curhead == bmheads[0]: node = bmheads[1] @@ -361,7 +361,7 @@ def _statusotherbook(ui, repo): bmheads = bookmarks.headsforactive(repo) -curhead = repo[repo._activebookmark].node() +curhead = repo._bookmarks[repo._activebookmark] if repo.revs('%n and parents()', curhead): # we are on the active bookmark bmheads = [b for b in bmheads if curhead != b] 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
D3161: convert: look up branch only among branches
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY repo[] can find something that's not a branch, which is not good. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3161 AFFECTED FILES hgext/convert/hg.py CHANGE DETAILS diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -363,10 +363,8 @@ return p2 def puttags(self, tags): -try: -tagparent = self.repo[self.tagsbranch].node() -except error.RepoError: -tagparent = nodemod.nullid +tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True) +tagparent = tagparent or nodemod.nullid oldlines = set() for branch, heads in self.repo.branchmap().iteritems(): 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
D3160: convert: remove unused/unnecessary variable "parentctx"
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/D3160 AFFECTED FILES hgext/convert/hg.py CHANGE DETAILS diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -364,10 +364,8 @@ def puttags(self, tags): try: -parentctx = self.repo[self.tagsbranch] -tagparent = parentctx.node() +tagparent = self.repo[self.tagsbranch].node() except error.RepoError: -parentctx = None tagparent = nodemod.nullid oldlines = set() 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
D1944: wireproto: provide accessors for client capabilities
This revision was automatically updated to reflect the committed changes. Closed by commit rHGafcfdf53e4b5: wireproto: provide accessors for client capabilities (authored by joerg.sonnenberger, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1944?vs=7705=7786 REVISION DETAIL https://phab.mercurial-scm.org/D1944 AFFECTED FILES mercurial/help/internals/wireprotocol.txt mercurial/sshpeer.py mercurial/wireproto.py mercurial/wireprotoserver.py mercurial/wireprototypes.py tests/test-debugcommands.t tests/test-ssh-bundle1.t tests/test-ssh-proto-unbundle.t tests/test-ssh-proto.t tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -495,10 +495,13 @@ devel-peer-request: between devel-peer-request: pairs: 81 bytes sending between command - remote: 403 (sshv1 !) + remote: 413 (sshv1 !) protocol upgraded to exp-ssh-v2-0001 (sshv2 !) - remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch + remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch remote: 1 (sshv1 !) + devel-peer-request: protocaps + devel-peer-request: caps: * bytes (glob) + sending protocaps command query 1; heads devel-peer-request: batched-content devel-peer-request:- heads (0 arguments) 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 @@ -63,9 +63,12 @@ devel-peer-request: between devel-peer-request: pairs: 81 bytes sending between command - remote: 403 - remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch + remote: 413 + remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch remote: 1 + devel-peer-request: protocaps + devel-peer-request: caps: * bytes (glob) + sending protocaps command url: ssh://user@dummy/server local: no pushable: yes @@ -82,43 +85,43 @@ i> write(6) -> 6: i> hello\n o> readline() -> 4: - 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 + o> 413\n + o> readline() -> 413: + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n `hg debugserve --sshstdio` works $ cd server $ hg debugserve --sshstdio << EOF > hello > EOF - 403 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch + 413 + capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch I/O logging works $ hg debugserve --sshstdio --logiofd 1 << EOF > hello > EOF o> write(4) -> 4: - o> 403\n - o> write(403) -> 403: - o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch\n - 403 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch + o> 413\n + o> write(413) -> 413: + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch\n + 413 + capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN protocaps batch o> flush() -> None $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF > hello > EOF - 403 - capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN batch + 413 + capabilities: lookup branchmap pushkey known getbundle unbundlehash changegroupsubset
D1944: wireproto: provide accessors for client capabilities
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. This looks great! It adds some much needed parity between the existing SSH and HTTP transports. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1944 To: joerg.sonnenberger, #hg-reviewers, indygreg Cc: indygreg, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3145: context: stop catching RepoLookupError from namespace.singlenode()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3198d5a2514e: context: stop catching RepoLookupError from namespace.singlenode() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3145?vs=7781=7785 REVISION DETAIL https://phab.mercurial-scm.org/D3145 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -449,10 +449,6 @@ return except KeyError: pass -except error.FilteredRepoLookupError: -raise -except error.RepoLookupError: -pass self._node = repo.unfiltered().changelog._partialmatch(changeid) if self._node is not None: To: martinvonz, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2 v2] copies: create and use _loosenext function for _related
On Thu, 05 Apr 2018 17:57:41 +0200, Gábor Stefanik wrote: > # HG changeset patch > # User Gábor Stefanik> # Date 1522943551 -7200 > # Thu Apr 05 17:52:31 2018 +0200 > # Node ID 7d13af1b5cd6e5c95dceefc7d905429889583c8c > # Parent 656ac240f39284eec4435d25c01d71056aa4e8a5 > copies: create and use _loosenext function for _related > > _loosenext is going to be a variant of the next function that tries to follow > grafts and similar relationship when the regular next raises StopIteration. > This is needed for bug 5834. > > diff -r 656ac240f392 -r 7d13af1b5cd6 mercurial/copies.py > --- a/mercurial/copies.py Sat Mar 24 01:30:50 2018 -0400 > +++ b/mercurial/copies.py Thu Apr 05 17:52:31 2018 +0200 > @@ -731,6 +731,12 @@ > > return copies, {}, {}, {}, {} > > +def _loosenext(g): > +try: > +return next(g), g > +except StopIteration: > +raise Seems fine, but please resend with the subsequent patches that will probably extend _loosenext(g). ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3158: histedit: look up partial nodeid as partial nodeid
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I'm about to remove support for repo[]. In the verify() method, we know that self.node is always a partial or full binary nodeid, so the most correct way to look up the revision is by using changelog._partialmatch(), so let's do that. (It's closer to the current code to do scmutil.revsymbol(), but that's less correct because it will match a bookmark or tag that happens to have the same prefix as the node.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3158 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 @@ -443,11 +443,9 @@ """ Verifies semantic correctness of the rule""" repo = self.repo ha = node.hex(self.node) -try: -self.node = repo[ha].node() -except error.RepoError: -raise error.ParseError(_('unknown changeset %s listed') - % ha[:12]) +self.node = repo.unfiltered().changelog._partialmatch(ha) +if self.node is None: +raise error.ParseError(_('unknown changeset %s listed') % ha[:12]) self._verifynodeconstraints(prev, expected, seen) def _verifynodeconstraints(self, prev, expected, seen): 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
D3159: eol: look up partial nodeid as partial nodeid
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Similar reasoning as the previous patch. For some reason the hook gives us a partial nodeid, so we need to resolve that to a full nodeid. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3159 AFFECTED FILES hgext/eol.py tests/test-blackbox.t CHANGE DETAILS diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t --- a/tests/test-blackbox.t +++ b/tests/test-blackbox.t @@ -157,14 +157,13 @@ > # (in addition, keeping it requires extra care for fsmonitor) > eol=! > EOF - $ hg blackbox -l 6 + $ hg blackbox -l 5 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> update (no-chg !) - 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> writing .hg/cache/tags2-visible with 0 tags 1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pythonhook-preupdate: hgext.eol.preupdate finished in * seconds (glob) 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> exthook-update: echo hooked finished in * seconds (glob) 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> update exited 0 after * seconds (glob) 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> serve --cmdserver chgunix --address $TESTTMP.chgsock/server.* --daemon-postexec 'chdir:/' (glob) (chg !) - 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 6 + 1970/01/01 00:00:00 bob @d02f48003e62c24e2659d97d30f2a83abe5d5d51 (5000)> blackbox -l 5 log rotation diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -299,7 +299,8 @@ hook = checkheadshook def preupdate(ui, repo, hooktype, parent1, parent2): -repo.loadeol([parent1]) +p1node = repo.unfiltered().changelog._partialmatch(parent1) +repo.loadeol([p1node]) return False def uisetup(ui): 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
D3157: histedit: drop unnecessary check for "self.node is not None"
martinvonz created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We are doing hex(self.node) just a few lines up, so it shouldn't be None. The only way it could be none is if it was reassigned in between. The only way that can happen is if the user had put a "..." wdirhex revision in the histedit script. This code is much older than the "..." identifier, so I'm confident it's not there to handle that case. I'll let someone else add proper checks for "..." if they care enough. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3157 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 @@ -448,8 +448,7 @@ except error.RepoError: raise error.ParseError(_('unknown changeset %s listed') % ha[:12]) -if self.node is not None: -self._verifynodeconstraints(prev, expected, seen) +self._verifynodeconstraints(prev, expected, seen) def _verifynodeconstraints(self, prev, expected, seen): # by default command need a node in the edited list 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