Re: hg archive (files) performance regression.
On 3/03/2018 1:32 PM, Matt Harbison wrote: AFAICT, the code prior to this vfs call didn't do atomic files, and didn't mention why the atomic aspect changed. I guess it's just something that was overlooked during refactoring to use the vfs? It looks like archive doesn't check for an empty directory, but it still seems OK, so go for it. https://www.mercurial-scm.org/wiki/ContributingChanges I'll look into it, but not being a python developer (c#, delphi usually) I'm not sure I'm setup to compile hg itself. If all it needs is a 1 word change then I was kind hoping one of the core contributors might look at it ;) I did some quick profiling archiving the hg repo, and it looks like a lot of time is spent calculating tag info.ᅵ Do you see a significant improvement when archiving a tagged revision, and/or using '--config ui.archivemeta=False'?ᅵ (Ironically, 4.2.2 gave me the worst performance, but it seems like it had something to do with evolve not being able to load?) I haven't tested it with tags, but what we do is export a specific revision or tip. We also do specify --config ui.archivemeta=False (although I didn't in my testing before), I just tried it and that doesn't seem to make any real difference. -- Regards Vincent Parrett CEO - VSoft Technologies Pty Ltd https://www.finalbuilder.com Blog: https://www.finalbuilder.com/resources/blogs Automate your Software builds with FinalBuilder. Open Source : https://github.com/VSoftTechnologies ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] profile: colorize output on Windows
# HG changeset patch # User Matt Harbison# Date 1520055359 18000 # Sat Mar 03 00:35:59 2018 -0500 # Node ID 57af2e6a832eabb2e584977a11cc34c97092cfcd # Parent ed77050177498aff4ff4db94f30d5bdeefd8f76e profile: colorize output on Windows Previously, the ANSI codes were printed to the screen, throwing off the alignment. We could probably do this unconditionally, but it's kind of a hack, so I figured I'd limit the scope. diff --git a/mercurial/profiling.py b/mercurial/profiling.py --- a/mercurial/profiling.py +++ b/mercurial/profiling.py @@ -14,6 +14,7 @@ encoding, error, extensions, +pycompat, util, ) @@ -200,6 +201,16 @@ elif self._output: path = self._ui.expandpath(self._output) self._fp = open(path, 'wb') +elif pycompat.iswindows: +class uifp(object): +def __init__(self, ui): +self._ui = ui +def write(self, data): +self._ui.write_err(data) +def flush(self): +self._ui.flush() +self._fpdoclose = False +self._fp = uifp(self._ui) else: self._fpdoclose = False self._fp = self._ui.ferr ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] py3: make test-basic.t pass on Python 3
# HG changeset patch # User Yuya Nishihara# Date 1520048289 18000 # Fri Mar 02 22:38:09 2018 -0500 # Node ID 19279a4054f6d095ae6877f01ec0c117f1054b68 # Parent 93fda19cf79e6f5d40b27720a0d65cd862f3a9f9 py3: make test-basic.t pass on Python 3 diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -8,6 +8,7 @@ test-annotate.py test-automv.t test-backout.t test-backwards-remove.t +test-basic.t test-bheads.t test-bisect2.t test-bookmarks-current.t diff --git a/tests/test-basic.t b/tests/test-basic.t --- a/tests/test-basic.t +++ b/tests/test-basic.t @@ -59,7 +59,7 @@ Verify that updating to revision 0 via c $ cat < update_to_rev0.py > from mercurial import ui, hg, commands > myui = ui.ui.load() - > repo = hg.repository(myui, path='.') + > repo = hg.repository(myui, path=b'.') > commands.update(myui, repo, rev=0) > EOF $ hg up null ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] py3: silence the final IOError by closing stdout/err slightly early
# HG changeset patch # User Yuya Nishihara# Date 1520048120 18000 # Fri Mar 02 22:35:20 2018 -0500 # Node ID 93fda19cf79e6f5d40b27720a0d65cd862f3a9f9 # Parent c0193f6ec467af81491d0e7c8c46fe0f676f3018 py3: silence the final IOError by closing stdout/err slightly early Fixes the following test failure: $ hg status >/dev/full abort: No space left on device Exception ignored in: <_io.TextIOWrapper name='' mode='w' ... OSError: [Errno 28] No space left on device [120] diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -105,16 +105,38 @@ def run(): # change the status code and move on. except IOError: status = -1 + +_silencestdio() sys.exit(status & 255) if pycompat.ispy3: def _initstdio(): pass + +def _silencestdio(): +for fp in (sys.stdout, sys.stderr): +# Check if the file is okay +try: +fp.flush() +continue +except IOError: +pass +# Otherwise mark it as closed to silence "Exception ignored in" +# message emitted by the interpreter finalizer. Be careful to +# not close util.stdout, which may be a fdopen-ed file object and +# its close() actually closes the underlying file descriptor. +try: +fp.close() +except IOError: +pass else: def _initstdio(): for fp in (sys.stdin, sys.stdout, sys.stderr): util.setbinary(fp) +def _silencestdio(): +pass + def _getsimilar(symbols, value): sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() # The cutoff for similarity here is pretty arbitrary. It should ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] py3: conditionalize initialization of stdio flags
# HG changeset patch # User Yuya Nishihara# Date 1520046636 18000 # Fri Mar 02 22:10:36 2018 -0500 # Node ID c0193f6ec467af81491d0e7c8c46fe0f676f3018 # Parent a007db19dc4d889dda54014f8dd3eb8a1c1ef08b py3: conditionalize initialization of stdio flags Since Python 3 doesn't depend on the stdio of libc, there should be no need to set O_BINARY flag on Windows. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -105,12 +105,15 @@ def run(): # change the status code and move on. except IOError: status = -1 - sys.exit(status & 255) -def _initstdio(): -for fp in (sys.stdin, sys.stdout, sys.stderr): -util.setbinary(fp) +if pycompat.ispy3: +def _initstdio(): +pass +else: +def _initstdio(): +for fp in (sys.stdin, sys.stdout, sys.stderr): +util.setbinary(fp) def _getsimilar(symbols, value): sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36562: 7 new changesets
7 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/63fe5ca93b13 changeset: 36556:63fe5ca93b13 user:Augie Facklerdate:Thu Mar 01 17:46:34 2018 -0500 summary: pycompat: add support for encoding argument to our wrapper https://www.mercurial-scm.org/repo/hg/rev/d60430dc7853 changeset: 36557:d60430dc7853 user:Augie Fackler date:Thu Mar 01 17:47:35 2018 -0500 summary: convert: add some utility code for working with shlex on Python 3 https://www.mercurial-scm.org/repo/hg/rev/d4c98b6724e1 changeset: 36558:d4c98b6724e1 user:Augie Fackler date:Thu Mar 01 17:47:49 2018 -0500 summary: convcmd: use our shlex wrapper to avoid Python 3 tracebacks https://www.mercurial-scm.org/repo/hg/rev/5374a22d014a changeset: 36559:5374a22d014a user:Augie Fackler date:Thu Mar 01 17:48:06 2018 -0500 summary: convert: use our shlex wrapper in filemap to avoid Python 3 tracebacks https://www.mercurial-scm.org/repo/hg/rev/41c0e7b7869c changeset: 36560:41c0e7b7869c user:Augie Fackler date:Thu Mar 01 18:13:50 2018 -0500 summary: convert: fix two %r output formats with pycompat.bytestr() wrapping https://www.mercurial-scm.org/repo/hg/rev/23d1096b4b37 changeset: 36561:23d1096b4b37 user:Augie Fackler date:Thu Mar 01 18:20:49 2018 -0500 summary: py3: whitelist three more passing tests https://www.mercurial-scm.org/repo/hg/rev/247e9bf4ecdc changeset: 36562:247e9bf4ecdc bookmark:@ tag: tip user:Pulkit Goyal <7895pul...@gmail.com> date:Fri Mar 02 07:14:59 2018 +0530 summary: py3: use util.forcebytestr() to convert IOErrors to bytes -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: hg archive (files) performance regression.
On Fri, 02 Mar 2018 02:13:18 -0500, Vincent Parrettwrote: On 2/03/2018 4:31 PM, Vincent Parrett wrote: I'm not a python dev (mostly c# and delphi), so still getting my head around the hg code base, but I'm curious why the atomictemp=true is used in fileit.addfile? I get that it's in the vfs to work around file locking issues, but with the archive command with type files, it's likely that the archive is going to an empty target directory and this seems wasteful. So I just knocked up an extension (ciarchive) using the code from archival.py (hg-stable repo) - and in class fileit.addfile : changed f = self.opener(name, "w", atomictemp=True) to f = self.opener(name, "w", atomictemp=False) hg.exe archive --time --subrepos --no-decode --quiet c:\temp\archive27 time: real 22.224 secs (user 6.203+0.000 sys 12.078+0.000) hg.exe ciarchive --time --subrepos --no-decode --quiet c:\temp\archive28 time: real 17.316 secs (user 6.609+0.000 sys 7.453+0.000) The repo has the following files : 9438 File(s)531,462,248 bytes 2039 Dir(s) That's a substantial performance increase (our customers have very large repos where this will make a large difference in build times). Of course I'd much rather not be maintaining an extension that uses the internal api of hg, any chance this change can be made in the archive command, or at least be made configurable (assuming this change is safe!)? AFAICT, the code prior to this vfs call didn't do atomic files, and didn't mention why the atomic aspect changed. It looks like archive doesn't check for an empty directory, but it still seems OK, so go for it. https://www.mercurial-scm.org/wiki/ContributingChanges I did some quick profiling archiving the hg repo, and it looks like a lot of time is spent calculating tag info. Do you see a significant improvement when archiving a tagged revision, and/or using '--config ui.archivemeta=False'? (Ironically, 4.2.2 gave me the worst performance, but it seems like it had something to do with evolve not being able to load?) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2570: tests: add missing b prefixes in test-atomictempfile.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa007db19dc4d: tests: add missing b prefixes in test-atomictempfile.py (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2570?vs=6403=6422 REVISION DETAIL https://phab.mercurial-scm.org/D2570 AFFECTED FILES tests/test-atomictempfile.py CHANGE DETAILS diff --git a/tests/test-atomictempfile.py b/tests/test-atomictempfile.py --- a/tests/test-atomictempfile.py +++ b/tests/test-atomictempfile.py @@ -17,8 +17,8 @@ class testatomictempfile(unittest.TestCase): def setUp(self): -self._testdir = tempfile.mkdtemp('atomictempfiletest') -self._filename = os.path.join(self._testdir, 'testfilename') +self._testdir = tempfile.mkdtemp(b'atomictempfiletest') +self._filename = os.path.join(self._testdir, b'testfilename') def tearDown(self): shutil.rmtree(self._testdir, True) @@ -28,14 +28,14 @@ self.assertFalse(os.path.isfile(self._filename)) tempfilename = file._tempname self.assertTrue(tempfilename in glob.glob( -os.path.join(self._testdir, '.testfilename-*'))) +os.path.join(self._testdir, b'.testfilename-*'))) file.write(b'argh\n') file.close() self.assertTrue(os.path.isfile(self._filename)) self.assertTrue(tempfilename not in glob.glob( -os.path.join(self._testdir, '.testfilename-*'))) +os.path.join(self._testdir, b'.testfilename-*'))) # discard() removes the temp file without making the write permanent def testdiscard(self): @@ -46,7 +46,7 @@ file.discard() self.assertFalse(os.path.isfile(self._filename)) -self.assertTrue(basename not in os.listdir('.')) +self.assertTrue(basename not in os.listdir(b'.')) # if a programmer screws up and passes bad args to atomictempfile, they # get a plain ordinary TypeError, not infinite recursion @@ -58,7 +58,7 @@ def testcheckambig(self): def atomicwrite(checkambig): f = atomictempfile(self._filename, checkambig=checkambig) -f.write('FOO') +f.write(b'FOO') f.close() # try some times, because reproduction of ambiguity depends on @@ -97,27 +97,27 @@ def testread(self): with open(self._filename, 'wb') as f: f.write(b'foobar\n') -file = atomictempfile(self._filename, mode='rb') +file = atomictempfile(self._filename, mode=b'rb') self.assertTrue(file.read(), b'foobar\n') file.discard() def testcontextmanagersuccess(self): """When the context closes, the file is closed""" -with atomictempfile('foo') as f: -self.assertFalse(os.path.isfile('foo')) +with atomictempfile(b'foo') as f: +self.assertFalse(os.path.isfile(b'foo')) f.write(b'argh\n') -self.assertTrue(os.path.isfile('foo')) +self.assertTrue(os.path.isfile(b'foo')) def testcontextmanagerfailure(self): """On exception, the file is discarded""" try: -with atomictempfile('foo') as f: -self.assertFalse(os.path.isfile('foo')) +with atomictempfile(b'foo') as f: +self.assertFalse(os.path.isfile(b'foo')) f.write(b'argh\n') raise ValueError except ValueError: pass -self.assertFalse(os.path.isfile('foo')) +self.assertFalse(os.path.isfile(b'foo')) if __name__ == '__main__': import silenttestrunner To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2576: xdiff: add a python wrapper
quark added a comment. Traditionally things under `mercurial.cext` has a pure equivalent. So it's cleaner to either make the changes directly in `mercurial.cext.bdiff`, or `mercurial/bdiff.c`. Or add a xdiff pure shim. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2576 To: ryanmce, #hg-reviewers Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36555: 41 new changesets
41 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/e71a3c0a90b0 changeset: 36515:e71a3c0a90b0 user:Yuya Nishiharadate:Sun Feb 25 16:35:34 2018 +0900 summary: templatekw: factor out function to build a list of files per status https://www.mercurial-scm.org/repo/hg/rev/9e3c37c367af changeset: 36516:9e3c37c367af user:Yuya Nishihara date:Sun Feb 25 16:36:38 2018 +0900 summary: templatekw: inline getfiles() https://www.mercurial-scm.org/repo/hg/rev/69477bac8926 changeset: 36517:69477bac8926 user:Yuya Nishihara date:Sun Feb 25 14:42:18 2018 +0900 summary: log: do not invoke templatekw.showobsfate() as a function https://www.mercurial-scm.org/repo/hg/rev/7937850a523d changeset: 36518:7937850a523d user:Yuya Nishihara date:Fri Dec 22 21:59:38 2017 +0900 summary: hgweb: make templater mostly compatible with log templates https://www.mercurial-scm.org/repo/hg/rev/94c4ae452293 changeset: 36519:94c4ae452293 user:Yuya Nishihara date:Sun Feb 25 15:43:35 2018 +0900 summary: templatekw: pass templater to _showlist() by an explicit argument https://www.mercurial-scm.org/repo/hg/rev/a7fbe11a5d59 changeset: 36520:a7fbe11a5d59 user:Yuya Nishihara date:Sun Feb 25 16:03:19 2018 +0900 summary: templatekw: add compatdict() as a replacement for showdict() https://www.mercurial-scm.org/repo/hg/rev/c3692364b344 changeset: 36521:c3692364b344 user:Yuya Nishihara date:Sun Feb 25 16:14:37 2018 +0900 summary: templatekw: add compatlist() as a replacement for showlist() https://www.mercurial-scm.org/repo/hg/rev/c3df20906689 changeset: 36522:c3df20906689 user:Augie Fackler date:Thu Mar 01 15:46:21 2018 -0500 summary: tests: fix run-tests environment cleanup on Python 3 https://www.mercurial-scm.org/repo/hg/rev/e7411fb7ba7f changeset: 36523:e7411fb7ba7f user:Gregory Szorc date:Sat Feb 24 12:07:21 2018 -0800 summary: wireprotoserver: ability to run an SSH server until an event is set https://www.mercurial-scm.org/repo/hg/rev/bfe38f787d5b changeset: 36524:bfe38f787d5b user:Gregory Szorc date:Sat Feb 24 12:22:20 2018 -0800 summary: util: add a file object proxy that can notify observers https://www.mercurial-scm.org/repo/hg/rev/3158052720ae changeset: 36525:3158052720ae user:Gregory Szorc date:Sat Feb 24 12:24:03 2018 -0800 summary: util: enable observing of util.bufferedinputpipe https://www.mercurial-scm.org/repo/hg/rev/7cc4a9b9732a changeset: 36526:7cc4a9b9732a user:Gregory Szorc date:Sun Feb 25 11:16:09 2018 -0800 summary: wireprotoserver: support logging SSH server I/O to a file descriptor https://www.mercurial-scm.org/repo/hg/rev/44dc34b8d17b changeset: 36527:44dc34b8d17b user:Gregory Szorc date:Tue Feb 27 15:47:44 2018 -0800 summary: debugcommands: add debugserve command https://www.mercurial-scm.org/repo/hg/rev/72e487851a53 changeset: 36528:72e487851a53 user:Gregory Szorc date:Thu Mar 01 08:24:54 2018 -0800 summary: debugcommands: add debugwireproto command https://www.mercurial-scm.org/repo/hg/rev/33c6f8f0388d changeset: 36529:33c6f8f0388d user:Gregory Szorc date:Fri Feb 23 09:40:12 2018 -0800 summary: wireproto: sort response to listkeys https://www.mercurial-scm.org/repo/hg/rev/bde0bd50f368 changeset: 36530:bde0bd50f368 user:Gregory Szorc date:Thu Mar 01 08:27:30 2018 -0800 summary: debugcommands: allow sending of simple commands with debugwireproto https://www.mercurial-scm.org/repo/hg/rev/097ad1079192 changeset: 36531:097ad1079192 user:Gregory Szorc date:Fri Feb 23 12:50:59 2018 -0800 summary: debugcommands: support for sending "batch" requests https://www.mercurial-scm.org/repo/hg/rev/1138e5c0fbc9 changeset: 36532:1138e5c0fbc9 user:Gregory Szorc date:Fri Feb 23 16:03:27 2018 -0800 summary: tests: add wire protocol tests for pushkey https://www.mercurial-scm.org/repo/hg/rev/1a36ef7df70a changeset: 36533:1a36ef7df70a user:Gregory Szorc date:Mon Feb 26 13:12:03 2018 -0800 summary: sshpeer: support not reading and forwarding stderr https://www.mercurial-scm.org/repo/hg/rev/5faeabb07cf5 changeset: 36534:5faeabb07cf5 user:Gregory Szorc date:Mon Feb 26 18:01:13 2018 -0800 summary: debugcommands: support for triggering push
D2573: xdiff: remove patience and histogram diffs
ryanmce created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY They are greedy algorithms that yields suboptimal results. Patience diff has been advertised as "slower, but generating better results sometimes" for a long time. But it's in theory "faster if there are common prefix/suffix and/or unique lines, could generate suboptimal results". As demonstrated by this test case: open('a', 'w').write('\n'.join(list('a' + 'x' * 300 + 'u' + 'x' * 700 + 'a\n'))) open('b', 'w').write('\n'.join(list('b' + 'x' * 700 + 'u' + 'x' * 300 + 'b\n'))) For generating "better" results, the diff sliding heuristic [1] is a better solution in general. So let's just remove patience diff and its variant histogram diff to simplify the code. [1]: https://github.com/git/git/commit/433860f3d0beb0c6f205290bd16cda413148f098 TEST PLAN `gcc -fPIC *.c --shared -o xdiff.so` still builds. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2573 AFFECTED FILES mercurial/thirdparty/xdiff/xdiff.h mercurial/thirdparty/xdiff/xdiffi.c mercurial/thirdparty/xdiff/xprepare.c CHANGE DETAILS diff --git a/mercurial/thirdparty/xdiff/xprepare.c b/mercurial/thirdparty/xdiff/xprepare.c --- a/mercurial/thirdparty/xdiff/xprepare.c +++ b/mercurial/thirdparty/xdiff/xprepare.c @@ -27,7 +27,6 @@ #define XDL_MAX_EQLIMIT 1024 #define XDL_SIMSCAN_WINDOW 100 #define XDL_GUESS_NLINES1 256 -#define XDL_GUESS_NLINES2 20 typedef struct s_xdlclass { @@ -181,9 +180,7 @@ if (!(recs = (xrecord_t **) xdl_malloc(narec * sizeof(xrecord_t * goto abort; - if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF) - hbits = hsize = 0; - else { + { hbits = xdl_hashbits((unsigned int) narec); hsize = 1 << hbits; if (!(rhash = (xrecord_t **) xdl_malloc(hsize * sizeof(xrecord_t * @@ -209,8 +206,7 @@ crec->ha = hav; recs[nrec++] = crec; - if ((XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF) && - xdl_classify_record(pass, cf, rhash, hbits, crec) < 0) + if (xdl_classify_record(pass, cf, rhash, hbits, crec) < 0) goto abort; } } @@ -266,21 +262,12 @@ memset(, 0, sizeof(cf)); - /* -* For histogram diff, we can afford a smaller sample size and -* thus a poorer estimate of the number of lines, as the hash -* table (rhash) won't be filled up/grown. The number of lines -* (nrecs) will be updated correctly anyway by -* xdl_prepare_ctx(). -*/ - sample = (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF - ? XDL_GUESS_NLINES2 : XDL_GUESS_NLINES1); + sample = XDL_GUESS_NLINES1; enl1 = xdl_guess_lines(mf1, sample) + 1; enl2 = xdl_guess_lines(mf2, sample) + 1; - if (XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF && - xdl_init_classifier(, enl1 + enl2 + 1, xpp->flags) < 0) + if (xdl_init_classifier(, enl1 + enl2 + 1, xpp->flags) < 0) return -1; if (xdl_prepare_ctx(1, mf1, enl1, xpp, , >xdf1) < 0) { @@ -295,18 +282,14 @@ return -1; } - if ((XDF_DIFF_ALG(xpp->flags) != XDF_PATIENCE_DIFF) && - (XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF) && - xdl_optimize_ctxs(, >xdf1, >xdf2) < 0) { - + if (xdl_optimize_ctxs(, >xdf1, >xdf2) < 0) { xdl_free_ctx(>xdf2); xdl_free_ctx(>xdf1); xdl_free_classifier(); return -1; } - if (XDF_DIFF_ALG(xpp->flags) != XDF_HISTOGRAM_DIFF) - xdl_free_classifier(); + xdl_free_classifier(); return 0; } diff --git a/mercurial/thirdparty/xdiff/xdiffi.c b/mercurial/thirdparty/xdiff/xdiffi.c --- a/mercurial/thirdparty/xdiff/xdiffi.c +++ b/mercurial/thirdparty/xdiff/xdiffi.c @@ -328,12 +328,6 @@ xdalgoenv_t xenv; diffdata_t dd1, dd2; - if (XDF_DIFF_ALG(xpp->flags) == XDF_PATIENCE_DIFF) - return xdl_do_patience_diff(mf1, mf2, xpp, xe); - - if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF) - return xdl_do_histogram_diff(mf1, mf2, xpp, xe); - if (xdl_prepare_env(mf1, mf2, xpp, xe) < 0) { return -1; diff --git a/mercurial/thirdparty/xdiff/xdiff.h b/mercurial/thirdparty/xdiff/xdiff.h --- a/mercurial/thirdparty/xdiff/xdiff.h +++ b/mercurial/thirdparty/xdiff/xdiff.h @@ -27,6 +27,8 @@ extern "C" { #endif /* #ifdef __cplusplus */ +#include /* size_t */ + /* xpparm_t.flags */ #define XDF_NEED_MINIMAL (1 << 0) @@ -41,11 +43,6 @@ #define XDF_IGNORE_BLANK_LINES (1 << 7) -#define XDF_PATIENCE_DIFF (1 << 14) -#define XDF_HISTOGRAM_DIFF (1
D2575: xdiff: add a bdiff hunk mode
ryanmce created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY xdiff generated hunks for the differences (ex. questionmarks in the `@@ -?,? +?,? @@` part from `diff --git` output). However, bdiff generates matched hunks instead. This patch adds a `XDL_EMIT_BDIFFHUNK` flag used by the output function `xdl_call_hunk_func`. Once set, xdiff will generate bdiff-like hunks instead. Note that since `bdiff('', '')` returns `[(0, 0, 0, 0)]`, the shortcut path `if (xscr)` is removed. I have checked functions called with `xscr` argument (`xdl_mark_ignorable`, `xdl_call_hunk_func`, `xdl_emit_diff`, `xdl_free_script`) work just fine with `xscr = NULL`. TEST PLAN `cd contrib/xdiff; make` - still builds. Actual logic tested in the next patch. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2575 AFFECTED FILES mercurial/thirdparty/xdiff/xdiff.h mercurial/thirdparty/xdiff/xdiffi.c CHANGE DETAILS diff --git a/mercurial/thirdparty/xdiff/xdiffi.c b/mercurial/thirdparty/xdiff/xdiffi.c --- a/mercurial/thirdparty/xdiff/xdiffi.c +++ b/mercurial/thirdparty/xdiff/xdiffi.c @@ -975,15 +975,32 @@ xdemitconf_t const *xecfg) { xdchange_t *xch, *xche; - - for (xch = xscr; xch; xch = xche->next) { - xche = xdl_get_hunk(, xecfg); - if (!xch) - break; - if (xecfg->hunk_func(xch->i1, xche->i1 + xche->chg1 - xch->i1, -xch->i2, xche->i2 + xche->chg2 - xch->i2, -ecb->priv) < 0) + if ((xecfg->flags & XDL_EMIT_BDIFFHUNK) != 0) { + long i1 = 0, i2 = 0, n1 = xe->xdf1.nrec, n2 = xe->xdf2.nrec; + for (xch = xscr; xch; xch = xche->next) { + xche = xdl_get_hunk(, xecfg); + if (!xch) + break; + if (xch->i1 > i1 || xch->i2 > i2) { + if (xecfg->hunk_func(i1, xch->i1, i2, xch->i2, ecb->priv) < 0) + return -1; + } + i1 = xche->i1 + xche->chg1; + i2 = xche->i2 + xche->chg2; + } + if (xecfg->hunk_func(i1, n1, i2, n2, ecb->priv) < 0) return -1; + } else { + for (xch = xscr; xch; xch = xche->next) { + xche = xdl_get_hunk(, xecfg); + if (!xch) + break; + if (xecfg->hunk_func( + xch->i1, xche->i1 + xche->chg1 - xch->i1, + xch->i2, xche->i2 + xche->chg2 - xch->i2, + ecb->priv) < 0) + return -1; + } } return 0; } @@ -1026,18 +1043,15 @@ xdl_free_env(); return -1; } - if (xscr) { - if (xpp->flags & XDF_IGNORE_BLANK_LINES) - xdl_mark_ignorable(xscr, , xpp->flags); - if (ef(, xscr, ecb, xecfg) < 0) { - - xdl_free_script(xscr); - xdl_free_env(); - return -1; - } + if (xpp->flags & XDF_IGNORE_BLANK_LINES) + xdl_mark_ignorable(xscr, , xpp->flags); + if (ef(, xscr, ecb, xecfg) < 0) { xdl_free_script(xscr); + xdl_free_env(); + return -1; } + xdl_free_script(xscr); xdl_free_env(); return 0; diff --git a/mercurial/thirdparty/xdiff/xdiff.h b/mercurial/thirdparty/xdiff/xdiff.h --- a/mercurial/thirdparty/xdiff/xdiff.h +++ b/mercurial/thirdparty/xdiff/xdiff.h @@ -48,6 +48,9 @@ /* xdemitconf_t.flags */ #define XDL_EMIT_FUNCNAMES (1 << 0) #define XDL_EMIT_FUNCCONTEXT (1 << 2) +/* emit bdiff-style "matched" (a1, a2, b1, b2) hunks instead of "different" + * (a1, a2 - a1, b1, b2 - b1) hunks */ +#define XDL_EMIT_BDIFFHUNK (1 << 4) #define XDL_MMB_READONLY (1 << 0) To: ryanmce, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2578: xdiff: enable indent heuristic unconditionally
ryanmce created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Enable the indent heuristic feature unconditionally, since it provides nice visual improvements. See the added test, and [1]. [1]: https://github.com/git/git/commit/433860f3d0beb0c6f205290bd16cda413148f098 TEST PLAN Added a test case. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2578 AFFECTED FILES mercurial/thirdparty/xdiff.c tests/test-diff-indent-heuristic.t CHANGE DETAILS diff --git a/tests/test-diff-indent-heuristic.t b/tests/test-diff-indent-heuristic.t new file mode 100644 --- /dev/null +++ b/tests/test-diff-indent-heuristic.t @@ -0,0 +1,227 @@ +#require xdiff + +Test cases are most from git t/t4061-diff-indent.sh, and commit messages. + + $ hg init + + $ cat > a.c <<'EOF' + > int a() + > { + > return 1; + > } + > + > int c() + > { + > return 3; + > } + > EOF + + $ cat > partial.pl <<'EOF' + > } + > + > if (!$smtp_server) { + >foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) { + >if (-x $_) { + >$smtp_server = $_; + > EOF + + $ cat > c.rb <<'EOF' + > ["foo", "bar", "baz"].map do |i| + > i.upcase + > end + > EOF + + $ cat > d.rb <<'EOF' + > def foo + > do_foo_stuff() + > + > common_ending() + > end + > EOF + + $ cat > spaces.txt <<'EOF' + > 1 + > 2 + > a + > + > b + > 3 + > 4 + > EOF + + $ cat > functions.c <<'EOF' + > 1 + > 2 + > /* function */ + > foo() { + > foo + > } + > + > 3 + > 4 + > EOF + + $ hg commit -m 1 -A . -q + + $ cat > a.c <<'EOF' + > int a() + > { + > return 1; + > } + > + > int b() + > { + > return 2; + > } + > + > int c() + > { + > return 3; + > } + > EOF + + $ cat > partial.pl <<'EOF' + > } + > + > if (!$smtp_server) { + >$smtp_server = $repo->config('sendemail.smtpserver'); + > } + > if (!$smtp_server) { + >foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) { + >if (-x $_) { + >$smtp_server = $_; + > EOF + + $ cat > c.rb <<'EOF' + > ["foo", "bar", "baz"].map do |i| + > i + > end + > + > ["foo", "bar", "baz"].map do |i| + > i.upcase + > end + > EOF + + $ cat > d.rb <<'EOF' + > def foo + > do_foo_stuff() + > + > common_ending() + > end + > + > def bar + > do_bar_stuff() + > + > common_ending() + > end + > EOF + + $ cat > spaces.txt <<'EOF' + > 1 + > 2 + > a + > + > b + > a + > + > b + > 3 + > 4 + > EOF + + $ cat > functions.c <<'EOF' + > 1 + > 2 + > /* function */ + > bar() { + > foo + > } + > + > /* function */ + > foo() { + > foo + > } + > + > 3 + > 4 + > EOF + + $ hg diff --git + diff --git a/a.c b/a.c + --- a/a.c + +++ b/a.c + @@ -3,6 +3,11 @@ + return 1; + } + + +int b() + +{ + + return 2; + +} + + + int c() + { + return 3; + diff --git a/c.rb b/c.rb + --- a/c.rb + +++ b/c.rb + @@ -1,3 +1,7 @@ + +["foo", "bar", "baz"].map do |i| + + i + +end + + + ["foo", "bar", "baz"].map do |i| + i.upcase + end + diff --git a/d.rb b/d.rb + --- a/d.rb + +++ b/d.rb + @@ -3,3 +3,9 @@ + + common_ending() + end + + + +def bar + + do_bar_stuff() + + + + common_ending() + +end + diff --git a/functions.c b/functions.c + --- a/functions.c + +++ b/functions.c + @@ -1,5 +1,10 @@ + 1 + 2 + +/* function */ + +bar() { + +foo + +} + + + /* function */ + foo() { + foo + diff --git a/partial.pl b/partial.pl + --- a/partial.pl + +++ b/partial.pl + @@ -1,5 +1,8 @@ + } + + +if (!$smtp_server) { + + $smtp_server = $repo->config('sendemail.smtpserver'); + +} + if (!$smtp_server) { + foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) { + if (-x $_) { + diff --git a/spaces.txt b/spaces.txt + --- a/spaces.txt + +++ b/spaces.txt + @@ -2,6 +2,9 @@ + 2 + a + + +b + +a + + + b + 3 + 4 diff --git a/mercurial/thirdparty/xdiff.c b/mercurial/thirdparty/xdiff.c --- a/mercurial/thirdparty/xdiff.c +++ b/mercurial/thirdparty/xdiff.c @@ -38,9 +38,9 @@ return PyErr_NoMemory(); xpparam_t xpp = { - 0,/* flags */ - NULL, /* anchors */ - 0,/* anchors_nr */ + XDF_INDENT_HEURISTIC, /* flags */ + NULL, /* anchors */ + 0,/* anchors_nr */ }; xdemitconf_t xecfg = { 0, /* ctxlen */ To: ryanmce, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2577: mdiff: prefer xdiff for diff calculation
ryanmce created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Let's switch to xdiff for its better diff quality and faster performance! bdiff is still used as a fallback for cases xdiff isn't built, or the pure Python version. TEST PLAN Added the "patience" test case mentioned in previous commit. It fails with a huge diff output before this change. I expected some annotate/diff output changes due to diff blocks being shifted around. Let's see what sandcastle says. I'll make adjustments accordingly. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2577 AFFECTED FILES mercurial/mdiff.py tests/hghave.py tests/test-diff-antipatience.t CHANGE DETAILS diff --git a/tests/test-diff-antipatience.t b/tests/test-diff-antipatience.t new file mode 100644 --- /dev/null +++ b/tests/test-diff-antipatience.t @@ -0,0 +1,41 @@ +#require xdiff + +Test case that makes use of the weakness of patience diff algorithm + + $ hg init + >>> open('a', 'w').write('\n'.join(list('a' + 'x' * 300 + 'u' + 'x' * 700 + 'a\n'))) + $ hg commit -m 1 -A a + >>> open('a', 'w').write('\n'.join(list('b' + 'x' * 700 + 'u' + 'x' * 300 + 'b\n'))) + $ hg diff + diff -r 6c45a8fe8cb6 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,4 +1,4 @@ + -a + +b + x + x + x + @@ -299,7 +299,6 @@ + x + x + x + -u + x + x + x + @@ -700,6 +699,7 @@ + x + x + x + +u + x + x + x + @@ -1000,5 +1000,5 @@ + x + x + x + -a + +b + diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -708,3 +708,11 @@ # libfuzzer is new in clang 6 return int(mat.group(1)) > 5 return False + +@check("xdiff", "xdiff algorithm") +def has_xdiff(): +try: +from mercurial.cext import xdiff +return xdiff.blocks('', '') == [(0, 0, 0, 0)] +except ImportError: +return False diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -25,13 +25,18 @@ bdiff = policy.importmod(r'bdiff') mpatch = policy.importmod(r'mpatch') -blocks = bdiff.blocks fixws = bdiff.fixws patches = mpatch.patches patchedsize = mpatch.patchedsize textdiff = bdiff.bdiff splitnewlines = bdiff.splitnewlines +try: +from .cext import xdiff +blocks = xdiff.blocks +except ImportError: +blocks = bdiff.blocks + class diffopts(object): '''context is the number of context lines text treats all files as text @@ -200,7 +205,7 @@ if opts.ignorews or opts.ignorewsamount or opts.ignorewseol: text1 = wsclean(opts, text1, False) text2 = wsclean(opts, text2, False) -diff = bdiff.blocks(text1, text2) +diff = blocks(text1, text2) for i, s1 in enumerate(diff): # The first match is special. # we've either found a match starting at line 0 or a match later @@ -508,7 +513,7 @@ # similar to difflib.SequenceMatcher.get_matching_blocks def get_matching_blocks(a, b): -return [(d[0], d[2], d[1] - d[0]) for d in bdiff.blocks(a, b)] +return [(d[0], d[2], d[1] - d[0]) for d in blocks(a, b)] def trivialdiffheader(length): return struct.pack(">lll", 0, 0, length) if length else '' To: ryanmce, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2576: xdiff: add a python wrapper
ryanmce created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Implement a `mercurial.cext.xdiff` module that exposes the xdiff algorithm. `xdiff.blocks` should be a drop-in replacement for `bdiff.blocks`. In theory we can change the pure C version of `bdiff.c` directly. However that means we lose bdiff entirely. It seems more flexible to have both at the same time so they can be easily switched via Python code. Hence the Python module approach. TEST PLAN `make local`. And test from `hg debugshell`: In [1]: from mercurial.cext import bdiff, xdiff In [2]: bdiff.blocks('b\nc\nd\n', 'a\nb\nc\ne\nf\n') Out[2]: [(0, 2, 1, 3), (3, 3, 5, 5)] In [3]: xdiff.blocks('b\nc\nd\n', 'a\nb\nc\ne\nf\n') Out[3]: [(0, 2, 1, 3), (3, 3, 5, 5)] In [4]: bdiff.blocks('a\nb', '') Out[4]: [(2, 2, 0, 0)] In [5]: xdiff.blocks('a\nb', '') Out[5]: [(2, 2, 0, 0)] In [6]: bdiff.blocks('a\nb', 'a\nb\n') Out[6]: [(0, 1, 0, 1), (2, 2, 2, 2)] In [7]: xdiff.blocks('a\nb', 'a\nb\n') Out[7]: [(0, 1, 0, 1), (2, 2, 2, 2)] In [8]: xdiff.blocks('', '') Out[8]: [(0, 0, 0, 0)] In [9]: bdiff.blocks('', '') Out[9]: [(0, 0, 0, 0)] In [10]: xdiff.blocks('', '\n') Out[10]: [(0, 0, 1, 1)] REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2576 AFFECTED FILES contrib/check-code.py mercurial/thirdparty/xdiff.c setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -220,7 +220,7 @@ py2exe.Distribution # silence unused import warning py2exeloaded = True # import py2exe's patched Distribution class -from distutils.core import Distribution +from distutils.core import Distribution # noqa: F811 except ImportError: py2exeloaded = False @@ -874,6 +874,28 @@ extra_compile_args=osutil_cflags, extra_link_args=osutil_ldflags, depends=common_depends), +Extension('mercurial.cext.xdiff', + sources=[ + 'mercurial/thirdparty/xdiff/xdiffi.c', + 'mercurial/thirdparty/xdiff/xemit.c', + 'mercurial/thirdparty/xdiff/xmerge.c', + 'mercurial/thirdparty/xdiff/xprepare.c', + 'mercurial/thirdparty/xdiff/xutils.c', + 'mercurial/thirdparty/xdiff.c', + ], + include_dirs=common_include_dirs + [ + 'mercurial/thirdparty/xdiff', + ], + depends=common_depends + [ + 'mercurial/thirdparty/xdiff/xdiff.h', + 'mercurial/thirdparty/xdiff/xdiffi.h', + 'mercurial/thirdparty/xdiff/xemit.h', + 'mercurial/thirdparty/xdiff/xinclude.h', + 'mercurial/thirdparty/xdiff/xmacros.h', + 'mercurial/thirdparty/xdiff/xprepare.h', + 'mercurial/thirdparty/xdiff/xtypes.h', + 'mercurial/thirdparty/xdiff/xutils.h', + ]), Extension('hgext.fsmonitor.pywatchman.bser', ['hgext/fsmonitor/pywatchman/bser.c']), ] diff --git a/mercurial/thirdparty/xdiff.c b/mercurial/thirdparty/xdiff.c new file mode 100644 --- /dev/null +++ b/mercurial/thirdparty/xdiff.c @@ -0,0 +1,96 @@ +/* + xdiff.c: simple Python wrapper for xdiff library + + Copyright (c) 2018 Facebook, Inc. + + This software may be used and distributed according to the terms of the + GNU General Public License version 2 or any later version. +*/ + +#include "xdiff.h" +#include "Python.h" + +static int hunk_consumer(long a1, long a2, long b1, long b2, void *priv) +{ + PyObject *rl = (PyObject *)priv; + PyObject *m = Py_BuildValue("", a1, a2, b1, b2); + if (!m) + return -1; + if (PyList_Append(rl, m) != 0) { + Py_DECREF(m); + return -1; + } + return 0; +} + +static PyObject *blocks(PyObject *self, PyObject *args) +{ + char *sa, *sb; + int na, nb; + + if (!PyArg_ParseTuple(args, "s#s#", , , , )) + return NULL; + + mmfile_t a = {sa, na}, b = {sb, nb}; + + PyObject *rl = PyList_New(0); + if (!rl) + return PyErr_NoMemory(); + + xpparam_t xpp = { + 0,/* flags */ + NULL, /* anchors */ + 0,/* anchors_nr */ + }; + xdemitconf_t xecfg = { + 0, /* ctxlen */ + 0, /* interhunkctxlen */ + XDL_EMIT_BDIFFHUNK, /* flags */ + NULL, /* find_func */ + NULL, /* find_func_priv */ + hunk_consumer, /* hunk_consume_func */ + }; + xdemitcb_t ecb = { + rl, /* priv */ + NULL, /* outf */ + }; + + if (xdl_diff(, , , , ) != 0)
Re: [PATCH 1 of 7 V2] revbranchcache: add a public function to update the data
On Thu, 01 Mar 2018 15:44:16 -0500, Boris Feld wrote: > # HG changeset patch > # User Boris Feld> # Date 1516281665 -3600 > # Thu Jan 18 14:21:05 2018 +0100 > # Node ID 9072a7903a7890cc61a6b7d0c7fa95e6d6db5b27 > # Parent 4b9e9e3f450c7c8a8717e0a2ed9573a067903ce6 > # EXP-Topic wire-rbc > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 9072a7903a78 > revbranchcache: add a public function to update the data The series looks good to me. Can you rebase onto the current tip? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 7 V2] revbranchcache: disable the new part for narrow hg bundle
On Thu, 01 Mar 2018 15:44:21 -0500, Boris Feld wrote: > # HG changeset patch > # User Boris Feld> # Date 1519237601 -3600 > # Wed Feb 21 19:26:41 2018 +0100 > # Node ID 2811d9ca31137ca7a9cc7c8a37862cdbff87bbec > # Parent 56f869a852230bdbcff6ae3c366cb0d83f6cf757 > # EXP-Topic wire-rbc > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 2811d9ca3113 > revbranchcache: disable the new part for narrow hg bundle > > The lack of some revisions confuses the new cache part. To simplify things, we > disable it for now. > > diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py > --- a/hgext/narrow/narrowbundle2.py > +++ b/hgext/narrow/narrowbundle2.py > @@ -479,6 +479,19 @@ def setup(): > origcgfn(*args, **kwargs) > exchange.getbundle2partsmapping['changegroup'] = wrappedcgfn > > +# disable rev branch cache exchange when serving a narrow bundle > +# (currently incompatible with that part) > +origrbcfn = exchange.getbundle2partsmapping['cache:rev-branch-cache'] > +def wrappedcgfn(*args, **kwargs): > +repo = args[1] > +if repo.ui.has_section(_NARROWACL_SECTION): > +return > +elif kwargs.get('narrow', False): r'' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36514: 5 new changesets (1 on stable)
5 new changesets (1 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/0a7c59a4c835 changeset: 36510:0a7c59a4c835 branch: stable parent: 36386:fb39f6a8a864 user:Yuya Nishiharadate:Wed Feb 21 21:14:05 2018 +0900 summary: annotate: do not poorly split lines at CR (issue5798) https://www.mercurial-scm.org/repo/hg/rev/aa3294027936 changeset: 36511:aa3294027936 parent: 36509:638c012a87ef user:Yuya Nishihara date:Sun Jan 07 11:53:07 2018 +0900 summary: cmdutil: expand filename format string by templater (BC) https://www.mercurial-scm.org/repo/hg/rev/d697e39f61a6 changeset: 36512:d697e39f61a6 user:Sascha Nemecek date:Wed Feb 28 16:24:39 2018 +0100 summary: convert: avoid closing ui.fout in subversion code (issue5807) https://www.mercurial-scm.org/repo/hg/rev/6ad140dc4269 changeset: 36513:6ad140dc4269 user:Yuya Nishihara date:Sun Feb 25 14:28:32 2018 +0900 summary: templatekw: extract non-templatekw function as getgraphnode() https://www.mercurial-scm.org/repo/hg/rev/7b74afec6772 changeset: 36514:7b74afec6772 bookmark:@ tag: tip user:Yuya Nishihara date:Sun Feb 25 13:40:46 2018 +0900 summary: templatekw: switch non-showlist template keywords to new API -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2513: wireproto: only expose "between" to version 1 of wire protocols
This revision was automatically updated to reflect the committed changes. Closed by commit rHGed7705017749: wireproto: only expose between to version 1 of wire protocols (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2513?vs=6343=6414 REVISION DETAIL https://phab.mercurial-scm.org/D2513 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 @@ -740,9 +740,7 @@ return bytesresponse(';'.join(res)) -# TODO mark as version 1 transport only once interaction with -# SSH handshake mechanism is figured out. -@wireprotocommand('between', 'pairs') +@wireprotocommand('between', 'pairs', transportpolicy=POLICY_V1_ONLY) def between(repo, proto, pairs): pairs = [decodelist(p, '-') for p in pairs.split(" ")] r = [] 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
D2486: wireproto: don't expose changegroupsubset capability if not available
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe89959970a08: wireproto: dont expose changegroupsubset capability if not available (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2486?vs=6405=6411 REVISION DETAIL https://phab.mercurial-scm.org/D2486 AFFECTED FILES mercurial/wireproto.py tests/test-debugcommands.t tests/test-hgweb-commands.t tests/test-http-bad-server.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 @@ -498,7 +498,7 @@ sending between command remote: 384 (sshv1 !) protocol upgraded to exp-ssh-v2-0001 (sshv2 !) - remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN remote: 1 (sshv1 !) query 1; heads devel-peer-request: batch 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: 384 - remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN remote: 1 url: ssh://user@dummy/server local: no @@ -84,16 +84,16 @@ o> readline() -> 4: o> 384\n o> readline() -> 384: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n `hg debugserve --sshstdio` works $ cd server $ hg debugserve --sshstdio << EOF > hello > EOF 384 - capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN I/O logging works @@ -103,22 +103,22 @@ o> write(4) -> None: o> 384\n o> write(384) -> None: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n 384 - capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN o> flush() -> None $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF > hello > EOF 384 - capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN $ cat $TESTTMP/io o> write(4) -> None: o> 384\n o> write(384) -> None: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n o> flush() -> None $ cd .. @@ -145,7 +145,7 @@ o> readline() -> 4: o> 384\n o> readline() -> 384: - o> capabilities: lookup changegroupsubset branchmap pushkey
D2550: tests: add more tests around hook output and getbundle
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1fa02265fae2: tests: add more tests around hook output and getbundle (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2550?vs=6406=6413 REVISION DETAIL https://phab.mercurial-scm.org/D2550 AFFECTED FILES tests/test-ssh-proto-unbundle.t CHANGE DETAILS diff --git a/tests/test-ssh-proto-unbundle.t b/tests/test-ssh-proto-unbundle.t --- a/tests/test-ssh-proto-unbundle.t +++ b/tests/test-ssh-proto-unbundle.t @@ -1248,6 +1248,561 @@ e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n +Shell hook writing to stdout has output captured + + $ cat > $TESTTMP/hook.sh << EOF + > echo 'stdout 1' + > echo 'stdout 2' + > exit 1 + > EOF + + $ cat > .hg/hgrc << EOF + > [hooks] + > pretxnchangegroup.fail = sh $TESTTMP/hook.sh + > EOF + + $ debugwireproto << EOF + > command unbundle + > # This is "force" in hex. + > heads 666f726365 + > PUSHFILE ../initial.v1.hg + > readavailable + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + sending unbundle command + i> write(9) -> None: + i> unbundle\n + i> write(9) -> None: + i> heads 10\n + i> write(10) -> None: 666f726365 + i> flush() -> None + o> readline() -> 2: + o> 0\n + i> write(4) -> None: + i> 426\n + i> write(426) -> None: + i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n + i> test\n + i> 0 0\n + i> foo\n + i> \n + i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n + i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n + i> \x00\x00\x00\x00\x00\x00\x00\x00 + i> write(2) -> None: + i> 0\n + i> flush() -> None + o> readline() -> 2: + o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: + e> read(-1) -> 212: + e> adding changesets\n + e> adding manifests\n + e> adding file changes\n + e> added 1 changesets with 1 changes to 1 files\n + e> stdout 1\n + e> stdout 2\n + e> transaction abort!\n + e> rollback completed\n + e> abort: pretxnchangegroup.fail hook exited with status 1\n + + testing ssh2 + creating ssh peer from handshake results + i> write(171) -> None: + i> upgrade * proto=exp-ssh-v2-0001\n (glob) + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 62: + o> upgraded * exp-ssh-v2-0001\n (glob) + o> readline() -> 4: + o> 383\n + o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + o> read(1) -> 1: + o> \n + sending unbundle command + i> write(9) -> None: + i> unbundle\n + i> write(9) -> None: + i> heads 10\n + i> write(10) -> None: 666f726365 + i> flush() -> None + o> readline() -> 2: + o> 0\n + i> write(4) -> None: + i> 426\n + i> write(426) -> None: + i>
D2571: sshpeer: don't read from stderr when that behavior is disabled
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1151c731686e: sshpeer: dont read from stderr when that behavior is disabled (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2571?vs=6404=6407 REVISION DETAIL https://phab.mercurial-scm.org/D2571 AFFECTED FILES mercurial/sshpeer.py tests/test-ssh-proto-unbundle.t CHANGE DETAILS diff --git a/tests/test-ssh-proto-unbundle.t b/tests/test-ssh-proto-unbundle.t --- a/tests/test-ssh-proto-unbundle.t +++ b/tests/test-ssh-proto-unbundle.t @@ -45,6 +45,7 @@ > # This is "force" in hex. > heads 666f726365 > PUSHFILE ../initial.v1.hg + > readavailable > EOF testing ssh1 creating ssh peer from handshake results @@ -87,17 +88,15 @@ i> flush() -> None o> readline() -> 2: o> 0\n - e> read(-1) -> 115: - e> abort: incompatible Mercurial client; bundle2 required\n - e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n - remote: abort: incompatible Mercurial client; bundle2 required - remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient) o> read(0) -> 0: o> readline() -> 2: o> 1\n o> read(1) -> 1: 0 result: 0 remote output: + e> read(-1) -> 115: + e> abort: incompatible Mercurial client; bundle2 required\n + e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n testing ssh2 creating ssh peer from handshake results @@ -140,17 +139,15 @@ i> flush() -> None o> readline() -> 2: o> 0\n - e> read(-1) -> 115: - e> abort: incompatible Mercurial client; bundle2 required\n - e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n - remote: abort: incompatible Mercurial client; bundle2 required - remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient) o> read(0) -> 0: o> readline() -> 2: o> 1\n o> read(1) -> 1: 0 result: 0 remote output: + e> read(-1) -> 115: + e> abort: incompatible Mercurial client; bundle2 required\n + e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n $ cd .. @@ -217,6 +214,7 @@ > # This is "force" in hex. > heads 666f726365 > PUSHFILE ../initial.v1.hg + > readavailable > EOF testing ssh1 creating ssh peer from handshake results @@ -259,6 +257,12 @@ i> flush() -> None o> readline() -> 2: o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: e> read(-1) -> 196: e> adding changesets\n e> adding manifests\n @@ -268,20 +272,6 @@ e> transaction abort!\n e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n - remote: adding changesets - remote: adding manifests - remote: adding file changes - remote: added 1 changesets with 1 changes to 1 files - remote: ui.write 1 line - remote: transaction abort! - remote: rollback completed - remote: abort: pretxnchangegroup.fail hook failed - o> read(0) -> 0: - o> readline() -> 2: - o> 1\n - o> read(1) -> 1: 0 - result: 0 - remote output: testing ssh2 creating ssh peer from handshake results @@ -324,6 +314,12 @@ i> flush() -> None o> readline() -> 2: o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: e> read(-1) -> 196: e> adding changesets\n e> adding manifests\n @@ -333,20 +329,6 @@ e> transaction abort!\n e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n - remote: adding changesets - remote: adding manifests - remote: adding file changes - remote: added 1 changesets with 1 changes to 1 files - remote: ui.write 1 line - remote: transaction abort! - remote: rollback completed - remote: abort: pretxnchangegroup.fail hook failed - o> read(0) -> 0: - o> readline() -> 2: - o> 1\n - o> read(1) -> 1: 0 - result: 0 - remote output: And a variation that writes multiple lines using ui.write @@ -360,6 +342,7 @@ > # This is "force" in hex. > heads 666f726365 > PUSHFILE ../initial.v1.hg + > readavailable > EOF testing ssh1 creating ssh peer from handshake results @@ -402,6 +385,12 @@ i> flush() -> None o> readline() -> 2: o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: e> read(-1) -> 218: e> adding changesets\n e> adding manifests\n @@ -412,21 +401,6 @@ e> transaction abort!\n e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n - remote: adding changesets - remote: adding manifests - remote: adding file changes - remote: added 1 changesets with 1 changes to 1 files - remote: ui.write 2 lines 1 - remote: ui.write 2 lines 2 - remote: transaction abort! - remote:
D2484: wireprotoserver: identify requests via version 2 of SSH protocol as such
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaf0d38f015bb: wireprotoserver: identify requests via version 2 of SSH protocol as such (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2484?vs=6334=6409 REVISION DETAIL https://phab.mercurial-scm.org/D2484 AFFECTED FILES mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -371,6 +371,10 @@ class sshv2protocolhandler(sshv1protocolhandler): """Protocol handler for version 2 of the SSH protocol.""" +@property +def name(self): +return wireprototypes.SSHV2 + def _runsshserver(ui, repo, fin, fout, ev): # This function operates like a state machine of sorts. The following # states are defined: 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
D2483: wireproto: allow wire protocol commands to declare transport support
This revision was automatically updated to reflect the committed changes. Closed by commit rHGabc3b9801563: wireproto: allow wire protocol commands to declare transport support (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2483?vs=6332=6408 REVISION DETAIL https://phab.mercurial-scm.org/D2483 AFFECTED FILES mercurial/wireproto.py mercurial/wireprototypes.py CHANGE DETAILS diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -13,6 +13,22 @@ # to reflect BC breakages. SSHV2 = 'exp-ssh-v2-0001' +# All available wire protocol transports. +TRANSPORTS = { +SSHV1: { +'transport': 'ssh', +'version': 1, +}, +SSHV2: { +'transport': 'ssh', +'version': 2, +}, +'http-v1': { +'transport': 'http', +'version': 1, +} +} + class bytesresponse(object): """A wire protocol response consisting of raw bytes.""" def __init__(self, data): diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -592,9 +592,10 @@ class commandentry(object): """Represents a declared wire protocol command.""" -def __init__(self, func, args=''): +def __init__(self, func, args='', transports=None): self.func = func self.args = args +self.transports = transports or set() def _merge(self, func, args): """Merge this instance with an incoming 2-tuple. @@ -604,7 +605,7 @@ data not captured by the 2-tuple and a new instance containing the union of the two objects is returned. """ -return commandentry(func, args=args) +return commandentry(func, args=args, transports=set(self.transports)) # Old code treats instances as 2-tuples. So expose that interface. def __iter__(self): @@ -640,31 +641,63 @@ if k in self: v = self[k]._merge(v[0], v[1]) else: -v = commandentry(v[0], args=v[1]) +# Use default values from @wireprotocommand. +v = commandentry(v[0], args=v[1], + transports=set(wireprototypes.TRANSPORTS)) else: raise ValueError('command entries must be commandentry instances ' 'or 2-tuples') return super(commanddict, self).__setitem__(k, v) def commandavailable(self, command, proto): """Determine if a command is available for the requested protocol.""" -# For now, commands are available for all protocols. So do a simple -# membership test. -return command in self +assert proto.name in wireprototypes.TRANSPORTS + +entry = self.get(command) + +if not entry: +return False + +if proto.name not in entry.transports: +return False + +return True + +# Constants specifying which transports a wire protocol command should be +# available on. For use with @wireprotocommand. +POLICY_ALL = 'all' +POLICY_V1_ONLY = 'v1-only' +POLICY_V2_ONLY = 'v2-only' commands = commanddict() -def wireprotocommand(name, args=''): +def wireprotocommand(name, args='', transportpolicy=POLICY_ALL): """Decorator to declare a wire protocol command. ``name`` is the name of the wire protocol command being provided. ``args`` is a space-delimited list of named arguments that the command accepts. ``*`` is a special value that says to accept all arguments. + +``transportpolicy`` is a POLICY_* constant denoting which transports +this wire protocol command should be exposed to. By default, commands +are exposed to all wire protocol transports. """ +if transportpolicy == POLICY_ALL: +transports = set(wireprototypes.TRANSPORTS) +elif transportpolicy == POLICY_V1_ONLY: +transports = {k for k, v in wireprototypes.TRANSPORTS.items() + if v['version'] == 1} +elif transportpolicy == POLICY_V2_ONLY: +transports = {k for k, v in wireprototypes.TRANSPORTS.items() + if v['version'] == 2} +else: +raise error.Abort(_('invalid transport policy value: %s') % + transportpolicy) + def register(func): -commands[name] = commandentry(func, args=args) +commands[name] = commandentry(func, args=args, transports=transports) return func return register To: indygreg, #hg-reviewers, durin42 Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2485: wireproto: don't expose legacy commands to version 2 of wire protocol
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6906547c8476: wireproto: dont expose legacy commands to version 2 of wire protocol (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2485?vs=6336=6410 REVISION DETAIL https://phab.mercurial-scm.org/D2485 AFFECTED FILES mercurial/wireproto.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -1273,6 +1273,33 @@ e> malformed handshake protocol: missing pairs 81\n e> -\n +Legacy commands are not exposed to version 2 of protocol + + $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF + > command branches + > nodes + > EOF + creating ssh peer from handshake results + sending branches command + response: + + $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF + > command changegroup + > roots + > EOF + creating ssh peer from handshake results + sending changegroup command + response: + + $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF + > command changegroupsubset + > bases + > heads + > EOF + creating ssh peer from handshake results + sending changegroupsubset command + response: + $ cd .. Test listkeys for listing namespaces diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -740,6 +740,8 @@ return bytesresponse(';'.join(res)) +# TODO mark as version 1 transport only once interaction with +# SSH handshake mechanism is figured out. @wireprotocommand('between', 'pairs') def between(repo, proto, pairs): pairs = [decodelist(p, '-') for p in pairs.split(" ")] @@ -760,7 +762,7 @@ return bytesresponse('\n'.join(heads)) -@wireprotocommand('branches', 'nodes') +@wireprotocommand('branches', 'nodes', transportpolicy=POLICY_V1_ONLY) def branches(repo, proto, nodes): nodes = decodelist(nodes) r = [] @@ -835,16 +837,17 @@ def capabilities(repo, proto): return bytesresponse(' '.join(_capabilities(repo, proto))) -@wireprotocommand('changegroup', 'roots') +@wireprotocommand('changegroup', 'roots', transportpolicy=POLICY_V1_ONLY) def changegroup(repo, proto, roots): nodes = decodelist(roots) outgoing = discovery.outgoing(repo, missingroots=nodes, missingheads=repo.heads()) cg = changegroupmod.makechangegroup(repo, outgoing, '01', 'serve') gen = iter(lambda: cg.read(32768), '') return streamres(gen=gen) -@wireprotocommand('changegroupsubset', 'bases heads') +@wireprotocommand('changegroupsubset', 'bases heads', + transportpolicy=POLICY_V1_ONLY) def changegroupsubset(repo, proto, bases, heads): bases = decodelist(bases) heads = decodelist(heads) 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
D2512: wireproto: add transport specific capabilities in the transport
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6e585bca962e: wireproto: add transport specific capabilities in the transport (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2512?vs=6341=6412 REVISION DETAIL https://phab.mercurial-scm.org/D2512 AFFECTED FILES mercurial/wireproto.py mercurial/wireprotoserver.py mercurial/wireprototypes.py CHANGE DETAILS diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -137,3 +137,12 @@ @abc.abstractmethod def client(self): """Returns a string representation of this client (as bytes).""" + +@abc.abstractmethod +def addcapabilities(self, repo, caps): +"""Adds advertised capabilities specific to this protocol. + +Receives the list of capabilities collected so far. + +Returns a list of capabilities. The passed in argument can be returned. +""" diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -121,6 +121,24 @@ urlreq.quote(self._req.env.get('REMOTE_HOST', '')), urlreq.quote(self._req.env.get('REMOTE_USER', ''))) +def addcapabilities(self, repo, caps): +caps.append('httpheader=%d' % +repo.ui.configint('server', 'maxhttpheaderlen')) +if repo.ui.configbool('experimental', 'httppostargs'): +caps.append('httppostargs') + +# FUTURE advertise 0.2rx once support is implemented +# FUTURE advertise minrx and mintx after consulting config option +caps.append('httpmediatype=0.1rx,0.1tx,0.2tx') + +compengines = wireproto.supportedcompengines(repo.ui, util.SERVERROLE) +if compengines: +comptypes = ','.join(urlreq.quote(e.wireprotosupport().name) + for e in compengines) +caps.append('compression=%s' % comptypes) + +return caps + # This method exists mostly so that extensions like remotefilelog can # disable a kludgey legacy method only over http. As of early 2018, # there are no other known users, so with any luck we can discard this @@ -368,6 +386,9 @@ client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0] return 'remote:ssh:' + client +def addcapabilities(self, repo, caps): +return caps + class sshv2protocolhandler(sshv1protocolhandler): """Protocol handler for version 2 of the SSH protocol.""" diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -819,23 +819,7 @@ caps.append('bundle2=' + urlreq.quote(capsblob)) caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) -if proto.name == 'http-v1': -caps.append('httpheader=%d' % -repo.ui.configint('server', 'maxhttpheaderlen')) -if repo.ui.configbool('experimental', 'httppostargs'): -caps.append('httppostargs') - -# FUTURE advertise 0.2rx once support is implemented -# FUTURE advertise minrx and mintx after consulting config option -caps.append('httpmediatype=0.1rx,0.1tx,0.2tx') - -compengines = supportedcompengines(repo.ui, util.SERVERROLE) -if compengines: -comptypes = ','.join(urlreq.quote(e.wireprotosupport().name) - for e in compengines) -caps.append('compression=%s' % comptypes) - -return caps +return proto.addcapabilities(repo, caps) # If you are writing an extension and consider wrapping this function. Wrap # `_capabilities` instead. 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
D2486: wireproto: don't expose changegroupsubset capability if not available
indygreg updated this revision to Diff 6405. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2486?vs=6339=6405 REVISION DETAIL https://phab.mercurial-scm.org/D2486 AFFECTED FILES mercurial/wireproto.py tests/test-debugcommands.t tests/test-hgweb-commands.t tests/test-http-bad-server.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 @@ -498,7 +498,7 @@ sending between command remote: 384 (sshv1 !) protocol upgraded to exp-ssh-v2-0001 (sshv2 !) - remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN remote: 1 (sshv1 !) query 1; heads devel-peer-request: batch 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: 384 - remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + remote: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN remote: 1 url: ssh://user@dummy/server local: no @@ -84,16 +84,16 @@ o> readline() -> 4: o> 384\n o> readline() -> 384: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n `hg debugserve --sshstdio` works $ cd server $ hg debugserve --sshstdio << EOF > hello > EOF 384 - capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN I/O logging works @@ -103,22 +103,22 @@ o> write(4) -> None: o> 384\n o> write(384) -> None: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n 384 - capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN o> flush() -> None $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF > hello > EOF 384 - capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN $ cat $TESTTMP/io o> write(4) -> None: o> 384\n o> write(384) -> None: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n o> flush() -> None $ cd .. @@ -145,7 +145,7 @@ o> readline() -> 4: o> 384\n o> readline() -> 384: - o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> capabilities: lookup branchmap
D2571: sshpeer: don't read from stderr when that behavior is disabled
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We previously prevented the creation of doublepipe instances when we're not supposed to automatically read from stderr. However, there were other automatic calls to read from stderr that were undermining this effort. This commit prevents all automatic reads from stderr from occurring when they are supposed to be disabled. Because stderr is no longer being read, we need to call "readavailable" from tests so stderr is read from. Test output changes because stderr is now always (manually) read after stdout. And, since sshpeer no longer automatically tends to stderr, no "remote: " messages are printed. This should fix non-deterministic test output. FWIW, doublepipe automatically reads from stderr when reading from stdout, so I'm not sure some of these calls to self._readerr() are even needed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2571 AFFECTED FILES mercurial/sshpeer.py tests/test-ssh-proto-unbundle.t CHANGE DETAILS diff --git a/tests/test-ssh-proto-unbundle.t b/tests/test-ssh-proto-unbundle.t --- a/tests/test-ssh-proto-unbundle.t +++ b/tests/test-ssh-proto-unbundle.t @@ -45,6 +45,7 @@ > # This is "force" in hex. > heads 666f726365 > PUSHFILE ../initial.v1.hg + > readavailable > EOF testing ssh1 creating ssh peer from handshake results @@ -87,17 +88,15 @@ i> flush() -> None o> readline() -> 2: o> 0\n - e> read(-1) -> 115: - e> abort: incompatible Mercurial client; bundle2 required\n - e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n - remote: abort: incompatible Mercurial client; bundle2 required - remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient) o> read(0) -> 0: o> readline() -> 2: o> 1\n o> read(1) -> 1: 0 result: 0 remote output: + e> read(-1) -> 115: + e> abort: incompatible Mercurial client; bundle2 required\n + e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n testing ssh2 creating ssh peer from handshake results @@ -140,17 +139,15 @@ i> flush() -> None o> readline() -> 2: o> 0\n - e> read(-1) -> 115: - e> abort: incompatible Mercurial client; bundle2 required\n - e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n - remote: abort: incompatible Mercurial client; bundle2 required - remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient) o> read(0) -> 0: o> readline() -> 2: o> 1\n o> read(1) -> 1: 0 result: 0 remote output: + e> read(-1) -> 115: + e> abort: incompatible Mercurial client; bundle2 required\n + e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n $ cd .. @@ -217,6 +214,7 @@ > # This is "force" in hex. > heads 666f726365 > PUSHFILE ../initial.v1.hg + > readavailable > EOF testing ssh1 creating ssh peer from handshake results @@ -259,6 +257,12 @@ i> flush() -> None o> readline() -> 2: o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: e> read(-1) -> 196: e> adding changesets\n e> adding manifests\n @@ -268,20 +272,6 @@ e> transaction abort!\n e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n - remote: adding changesets - remote: adding manifests - remote: adding file changes - remote: added 1 changesets with 1 changes to 1 files - remote: ui.write 1 line - remote: transaction abort! - remote: rollback completed - remote: abort: pretxnchangegroup.fail hook failed - o> read(0) -> 0: - o> readline() -> 2: - o> 1\n - o> read(1) -> 1: 0 - result: 0 - remote output: testing ssh2 creating ssh peer from handshake results @@ -324,6 +314,12 @@ i> flush() -> None o> readline() -> 2: o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: e> read(-1) -> 196: e> adding changesets\n e> adding manifests\n @@ -333,20 +329,6 @@ e> transaction abort!\n e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n - remote: adding changesets - remote: adding manifests - remote: adding file changes - remote: added 1 changesets with 1 changes to 1 files - remote: ui.write 1 line - remote: transaction abort! - remote: rollback completed - remote: abort: pretxnchangegroup.fail hook failed - o> read(0) -> 0: - o> readline() -> 2: - o> 1\n - o> read(1) -> 1: 0 - result: 0 - remote output: And a variation that writes multiple lines using ui.write @@ -360,6 +342,7 @@ > # This is "force" in hex. > heads 666f726365 > PUSHFILE ../initial.v1.hg + > readavailable > EOF testing ssh1 creating
D2550: tests: add more tests around hook output and getbundle
indygreg updated this revision to Diff 6406. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2550?vs=6346=6406 REVISION DETAIL https://phab.mercurial-scm.org/D2550 AFFECTED FILES tests/test-ssh-proto-unbundle.t CHANGE DETAILS diff --git a/tests/test-ssh-proto-unbundle.t b/tests/test-ssh-proto-unbundle.t --- a/tests/test-ssh-proto-unbundle.t +++ b/tests/test-ssh-proto-unbundle.t @@ -1248,6 +1248,561 @@ e> rollback completed\n e> abort: pretxnchangegroup.fail hook failed\n +Shell hook writing to stdout has output captured + + $ cat > $TESTTMP/hook.sh << EOF + > echo 'stdout 1' + > echo 'stdout 2' + > exit 1 + > EOF + + $ cat > .hg/hgrc << EOF + > [hooks] + > pretxnchangegroup.fail = sh $TESTTMP/hook.sh + > EOF + + $ debugwireproto << EOF + > command unbundle + > # This is "force" in hex. + > heads 666f726365 + > PUSHFILE ../initial.v1.hg + > readavailable + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + sending unbundle command + i> write(9) -> None: + i> unbundle\n + i> write(9) -> None: + i> heads 10\n + i> write(10) -> None: 666f726365 + i> flush() -> None + o> readline() -> 2: + o> 0\n + i> write(4) -> None: + i> 426\n + i> write(426) -> None: + i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n + i> test\n + i> 0 0\n + i> foo\n + i> \n + i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n + i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n + i> \x00\x00\x00\x00\x00\x00\x00\x00 + i> write(2) -> None: + i> 0\n + i> flush() -> None + o> readline() -> 2: + o> 0\n + o> read(0) -> 0: + o> readline() -> 2: + o> 1\n + o> read(1) -> 1: 0 + result: 0 + remote output: + e> read(-1) -> 212: + e> adding changesets\n + e> adding manifests\n + e> adding file changes\n + e> added 1 changesets with 1 changes to 1 files\n + e> stdout 1\n + e> stdout 2\n + e> transaction abort!\n + e> rollback completed\n + e> abort: pretxnchangegroup.fail hook exited with status 1\n + + testing ssh2 + creating ssh peer from handshake results + i> write(171) -> None: + i> upgrade * proto=exp-ssh-v2-0001\n (glob) + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 62: + o> upgraded * exp-ssh-v2-0001\n (glob) + o> readline() -> 4: + o> 383\n + o> read(383) -> 383: capabilities: lookup branchmap pushkey known getbundle unbundlehash batch changegroupsubset streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + o> read(1) -> 1: + o> \n + sending unbundle command + i> write(9) -> None: + i> unbundle\n + i> write(9) -> None: + i> heads 10\n + i> write(10) -> None: 666f726365 + i> flush() -> None + o> readline() -> 2: + o> 0\n + i> write(4) -> None: + i> 426\n + i> write(426) -> None: + i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n +
D2570: tests: add missing b prefixes in test-atomictempfile.py
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame just some b prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2570 AFFECTED FILES tests/test-atomictempfile.py CHANGE DETAILS diff --git a/tests/test-atomictempfile.py b/tests/test-atomictempfile.py --- a/tests/test-atomictempfile.py +++ b/tests/test-atomictempfile.py @@ -17,8 +17,8 @@ class testatomictempfile(unittest.TestCase): def setUp(self): -self._testdir = tempfile.mkdtemp('atomictempfiletest') -self._filename = os.path.join(self._testdir, 'testfilename') +self._testdir = tempfile.mkdtemp(b'atomictempfiletest') +self._filename = os.path.join(self._testdir, b'testfilename') def tearDown(self): shutil.rmtree(self._testdir, True) @@ -28,14 +28,14 @@ self.assertFalse(os.path.isfile(self._filename)) tempfilename = file._tempname self.assertTrue(tempfilename in glob.glob( -os.path.join(self._testdir, '.testfilename-*'))) +os.path.join(self._testdir, b'.testfilename-*'))) file.write(b'argh\n') file.close() self.assertTrue(os.path.isfile(self._filename)) self.assertTrue(tempfilename not in glob.glob( -os.path.join(self._testdir, '.testfilename-*'))) +os.path.join(self._testdir, b'.testfilename-*'))) # discard() removes the temp file without making the write permanent def testdiscard(self): @@ -46,7 +46,7 @@ file.discard() self.assertFalse(os.path.isfile(self._filename)) -self.assertTrue(basename not in os.listdir('.')) +self.assertTrue(basename not in os.listdir(b'.')) # if a programmer screws up and passes bad args to atomictempfile, they # get a plain ordinary TypeError, not infinite recursion @@ -58,7 +58,7 @@ def testcheckambig(self): def atomicwrite(checkambig): f = atomictempfile(self._filename, checkambig=checkambig) -f.write('FOO') +f.write(b'FOO') f.close() # try some times, because reproduction of ambiguity depends on @@ -97,27 +97,27 @@ def testread(self): with open(self._filename, 'wb') as f: f.write(b'foobar\n') -file = atomictempfile(self._filename, mode='rb') +file = atomictempfile(self._filename, mode=b'rb') self.assertTrue(file.read(), b'foobar\n') file.discard() def testcontextmanagersuccess(self): """When the context closes, the file is closed""" -with atomictempfile('foo') as f: -self.assertFalse(os.path.isfile('foo')) +with atomictempfile(b'foo') as f: +self.assertFalse(os.path.isfile(b'foo')) f.write(b'argh\n') -self.assertTrue(os.path.isfile('foo')) +self.assertTrue(os.path.isfile(b'foo')) def testcontextmanagerfailure(self): """On exception, the file is discarded""" try: -with atomictempfile('foo') as f: -self.assertFalse(os.path.isfile('foo')) +with atomictempfile(b'foo') as f: +self.assertFalse(os.path.isfile(b'foo')) f.write(b'argh\n') raise ValueError except ValueError: pass -self.assertFalse(os.path.isfile('foo')) +self.assertFalse(os.path.isfile(b'foo')) if __name__ == '__main__': import silenttestrunner To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2095: clone: updates the help text for hg clone -r (issue5654) [bugzilla] and hg clone -b
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4de15c54e59f: clone: updates the help text for hg clone -{r,b} (issue5654) (authored by sangeet259, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2095?vs=5371=6401#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2095?vs=5371=6401 REVISION DETAIL https://phab.mercurial-scm.org/D2095 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1326,8 +1326,10 @@ 'directory (only a repository)')), ('u', 'updaterev', '', _('revision, tag, or branch to check out'), _('REV')), -('r', 'rev', [], _('include the specified changeset'), _('REV')), -('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), +('r', 'rev', [], _('do not clone everything, but include this changeset' + ' and its ancestors'), _('REV')), +('b', 'branch', [], _('do not clone everything, but include this branch\'s' + ' changesets and their ancestors'), _('BRANCH')), ('', 'pull', None, _('use pull protocol to copy metadata')), ('', 'uncompressed', None, _('an alias to --stream (DEPRECATED)')), To: sangeet259, #hg-reviewers, durin42 Cc: pulkit, durin42, joerg.sonnenberger, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2282: util: extract all date-related utils in utils/dateutil module
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc6061cadb400: util: extract all date-related utils in utils/dateutil module (authored by lothiraldan, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2282?vs=6400=6402#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2282?vs=6400=6402 REVISION DETAIL https://phab.mercurial-scm.org/D2282 AFFECTED FILES contrib/synthrepo.py hgext/blackbox.py hgext/churn.py hgext/convert/common.py hgext/convert/convcmd.py hgext/convert/cvs.py hgext/convert/cvsps.py hgext/convert/darcs.py hgext/convert/gnuarch.py hgext/convert/hg.py hgext/convert/monotone.py hgext/convert/p4.py hgext/convert/subversion.py hgext/fetch.py hgext/gpg.py hgext/journal.py hgext/keyword.py hgext/mq.py hgext/notify.py hgext/patchbomb.py hgext/shelve.py mercurial/changelog.py mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/debugcommands.py mercurial/formatter.py mercurial/hgweb/hgwebdir_mod.py mercurial/logcmdutil.py mercurial/mdiff.py mercurial/obsolete.py mercurial/obsutil.py mercurial/patch.py mercurial/revset.py mercurial/subrepo.py mercurial/templatefilters.py mercurial/templater.py mercurial/ui.py mercurial/util.py mercurial/utils/__init__.py mercurial/utils/dateutil.py setup.py tests/fakedirstatewritetime.py tests/fakepatchtime.py tests/test-journal.t To: lothiraldan, #hg-reviewers, durin42 Cc: durin42, dlax, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2282: util: extract all date-related utils in utils/dateutil module
lothiraldan updated this revision to Diff 6400. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2282?vs=5767=6400 REVISION DETAIL https://phab.mercurial-scm.org/D2282 AFFECTED FILES contrib/synthrepo.py hgext/blackbox.py hgext/churn.py hgext/convert/common.py hgext/convert/convcmd.py hgext/convert/cvs.py hgext/convert/cvsps.py hgext/convert/darcs.py hgext/convert/gnuarch.py hgext/convert/hg.py hgext/convert/monotone.py hgext/convert/p4.py hgext/convert/subversion.py hgext/fetch.py hgext/gpg.py hgext/journal.py hgext/keyword.py hgext/lfs/wrapper.py hgext/mq.py hgext/notify.py hgext/patchbomb.py hgext/shelve.py mercurial/changelog.py mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/debugcommands.py mercurial/formatter.py mercurial/hgweb/hgwebdir_mod.py mercurial/logcmdutil.py mercurial/mdiff.py mercurial/obsolete.py mercurial/obsutil.py mercurial/patch.py mercurial/revset.py mercurial/subrepo.py mercurial/templatefilters.py mercurial/templater.py mercurial/ui.py mercurial/util.py mercurial/utils/__init__.py mercurial/utils/dateutil.py setup.py tests/fakedirstatewritetime.py tests/fakepatchtime.py tests/test-journal.t To: lothiraldan, #hg-reviewers, durin42 Cc: durin42, dlax, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2569: py3: whitelist more passing tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHGebaf11969ab7: py3: whitelist more passing tests (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2569?vs=6392=6399 REVISION DETAIL https://phab.mercurial-scm.org/D2569 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -122,6 +122,7 @@ test-hghave.t test-hgignore.t test-hgk.t +test-hgweb-removed.t test-histedit-arguments.t test-histedit-base.t test-histedit-bookmark-motion.t @@ -216,6 +217,7 @@ test-narrow-update.t test-newbranch.t test-obshistory.t +test-obsmarker-template.t test-obsmarkers-effectflag.t test-obsolete-bundle-strip.t test-obsolete-changeset-exchange.t @@ -309,6 +311,7 @@ test-revset-outgoing.t test-run-tests.py test-serve.t +test-share.t test-show-stack.t test-show-work.t test-show.t @@ -338,5 +341,6 @@ test-url-rev.t test-username-newline.t test-verify.t +test-websub.t test-win32text.t test-xdg.t To: durin42, pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2568: lfs: convert hexdigest to bytes using sysbytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGcda13ec1a228: lfs: convert hexdigest to bytes using sysbytes (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2568?vs=6397=6398 REVISION DETAIL https://phab.mercurial-scm.org/D2568 AFFECTED FILES hgext/lfs/wrapper.py CHANGE DETAILS diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -10,11 +10,12 @@ import hashlib from mercurial.i18n import _ -from mercurial.node import bin, nullid, short +from mercurial.node import bin, hex, nullid, short from mercurial import ( error, filelog, +pycompat, revlog, util, ) @@ -85,7 +86,7 @@ text = text[offset:] # git-lfs only supports sha256 -oid = hashlib.sha256(text).hexdigest() +oid = hex(hashlib.sha256(text).digest()) self.opener.lfslocalblobstore.write(oid, text) # replace contents with metadata To: 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
[PATCH 1 of 3] templater: allow dynamically switching the default dict/list formatting
# HG changeset patch # User Yuya Nishihara# Date 1519909642 18000 # Thu Mar 01 08:07:22 2018 -0500 # Node ID 09b7cc4c0d6e56e77553789225a2039f3de427fd # Parent c9dcc379e2dcc8d7718bdae3aa9df23ed54ff358 templater: allow dynamically switching the default dict/list formatting '%s' doesn't work nicely on Python 3 because many Python types don't implement __bytes__(). diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -175,10 +175,10 @@ class baseformatter(object): def formatdate(self, date, fmt='%a %b %d %H:%M:%S %Y %1%2'): '''convert date tuple to appropriate format''' return self._converter.formatdate(date, fmt) -def formatdict(self, data, key='key', value='value', fmt='%s=%s', sep=' '): +def formatdict(self, data, key='key', value='value', fmt=None, sep=' '): '''convert dict or key-value pairs to appropriate dict format''' return self._converter.formatdict(data, key, value, fmt, sep) -def formatlist(self, data, name, fmt='%s', sep=' '): +def formatlist(self, data, name, fmt=None, sep=' '): '''convert iterable to appropriate list format''' # name is mandatory argument for now, but it could be optional if # we have default template keyword, e.g. {item} @@ -247,10 +247,14 @@ class _plainconverter(object): @staticmethod def formatdict(data, key, value, fmt, sep): '''stringify key-value pairs separated by sep''' +if fmt is None: +fmt = '%s=%s' return sep.join(fmt % (k, v) for k, v in _iteritems(data)) @staticmethod def formatlist(data, name, fmt, sep): '''stringify iterable separated by sep''' +if fmt is None: +fmt = '%s' return sep.join(fmt % e for e in data) class plainformatter(baseformatter): diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -97,13 +97,17 @@ class _mappable(object): def itermaps(self): yield self.tomap() -def hybriddict(data, key='key', value='value', fmt='%s=%s', gen=None): +def hybriddict(data, key='key', value='value', fmt=None, gen=None): """Wrap data to support both dict-like and string-like operations""" +if fmt is None: +fmt = '%s=%s' return _hybrid(gen, data, lambda k: {key: k, value: data[k]}, lambda k: fmt % (k, data[k])) -def hybridlist(data, name, fmt='%s', gen=None): +def hybridlist(data, name, fmt=None, gen=None): """Wrap data to support both list-like and string-like operations""" +if fmt is None: +fmt = '%s' return _hybrid(gen, data, lambda x: {name: x}, lambda x: fmt % x) def unwraphybrid(thing): @@ -137,7 +141,7 @@ def wraphybridvalue(container, key, valu return _mappable(None, key, value, makemap) def compatdict(context, mapping, name, data, key='key', value='value', - fmt='%s=%s', plural=None, separator=' '): + fmt=None, plural=None, separator=' '): """Wrap data like hybriddict(), but also supports old-style list template This exists for backward compatibility with the old-style template. Use @@ -148,7 +152,7 @@ def compatdict(context, mapping, name, d f = _showlist(name, c, t, mapping, plural, separator) return hybriddict(data, key=key, value=value, fmt=fmt, gen=f) -def compatlist(context, mapping, name, data, element=None, fmt='%s', +def compatlist(context, mapping, name, data, element=None, fmt=None, plural=None, separator=' '): """Wrap data like hybridlist(), but also supports old-style list template @@ -160,7 +164,7 @@ def compatlist(context, mapping, name, d return hybridlist(data, name=element or name, fmt=fmt, gen=f) def showdict(name, data, mapping, plural=None, key='key', value='value', - fmt='%s=%s', separator=' '): + fmt=None, separator=' '): ui = mapping.get('ui') if ui: ui.deprecwarn("templatekw.showdict() is deprecated, use compatdict()", ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] test-command-template: glob out detailed "invalid escape" message
# HG changeset patch # User Yuya Nishihara# Date 1519946719 18000 # Thu Mar 01 18:25:19 2018 -0500 # Node ID 5c58b3c471dac34967aeaf32c6a165efbb15bf63 # Parent 2c41855dbd2c20dedb97ac68a1909a9ffa9c0774 test-command-template: glob out detailed "invalid escape" message Python 3 also reports the position where an invalid escape found. diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -36,6 +36,7 @@ test-children.t test-clone-pull-corruption.t test-clone-r.t test-clone-update-order.t +test-command-template.t test-commit-amend.t test-commit-unresolved.t test-commit.t 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 @@ -4438,7 +4438,7 @@ Test broken string escapes: hg: parse error: trailing \ in string [255] $ hg log -T "\\xy" -R a - hg: parse error: invalid \x escape + hg: parse error: invalid \x escape* (glob) [255] json filter should escape HTML tags so that the output can be embedded in hgweb: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] templater: byte-stringify dict/list values before passing to default format
# HG changeset patch # User Yuya Nishihara# Date 1519910094 18000 # Thu Mar 01 08:14:54 2018 -0500 # Node ID 2c41855dbd2c20dedb97ac68a1909a9ffa9c0774 # Parent 09b7cc4c0d6e56e77553789225a2039f3de427fd templater: byte-stringify dict/list values before passing to default format bytestr() is applied only when no custom format string like '%d' is specified. diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -247,15 +247,20 @@ class _plainconverter(object): @staticmethod def formatdict(data, key, value, fmt, sep): '''stringify key-value pairs separated by sep''' +prefmt = pycompat.identity if fmt is None: fmt = '%s=%s' -return sep.join(fmt % (k, v) for k, v in _iteritems(data)) +prefmt = pycompat.bytestr +return sep.join(fmt % (prefmt(k), prefmt(v)) +for k, v in _iteritems(data)) @staticmethod def formatlist(data, name, fmt, sep): '''stringify iterable separated by sep''' +prefmt = pycompat.identity if fmt is None: fmt = '%s' -return sep.join(fmt % e for e in data) +prefmt = pycompat.bytestr +return sep.join(fmt % prefmt(e) for e in data) class plainformatter(baseformatter): '''the default text output scheme''' diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -99,16 +99,20 @@ class _mappable(object): def hybriddict(data, key='key', value='value', fmt=None, gen=None): """Wrap data to support both dict-like and string-like operations""" +prefmt = pycompat.identity if fmt is None: fmt = '%s=%s' +prefmt = pycompat.bytestr return _hybrid(gen, data, lambda k: {key: k, value: data[k]}, - lambda k: fmt % (k, data[k])) + lambda k: fmt % (prefmt(k), prefmt(data[k]))) def hybridlist(data, name, fmt=None, gen=None): """Wrap data to support both list-like and string-like operations""" +prefmt = pycompat.identity if fmt is None: fmt = '%s' -return _hybrid(gen, data, lambda x: {name: x}, lambda x: fmt % x) +prefmt = pycompat.bytestr +return _hybrid(gen, data, lambda x: {name: x}, lambda x: fmt % prefmt(x)) def unwraphybrid(thing): """Return an object which can be stringified possibly by using a legacy ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2568: lfs: convert hexdigest to bytes using sysbytes
durin42 updated this revision to Diff 6397. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2568?vs=6391=6397 REVISION DETAIL https://phab.mercurial-scm.org/D2568 AFFECTED FILES hgext/lfs/wrapper.py CHANGE DETAILS diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -10,11 +10,12 @@ import hashlib from mercurial.i18n import _ -from mercurial.node import bin, nullid, short +from mercurial.node import bin, hex, nullid, short from mercurial import ( error, filelog, +pycompat, revlog, util, ) @@ -85,7 +86,7 @@ text = text[offset:] # git-lfs only supports sha256 -oid = hashlib.sha256(text).hexdigest() +oid = hex(hashlib.sha256(text).digest()) self.opener.lfslocalblobstore.write(oid, text) # replace contents with metadata To: 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
D2567: lfs: use %d to encode int, not str()
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdcb6fbaa43a8: lfs: use %d to encode int, not str() (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2567?vs=6390=6396 REVISION DETAIL https://phab.mercurial-scm.org/D2567 AFFECTED FILES hgext/lfs/wrapper.py CHANGE DETAILS diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -90,7 +90,7 @@ # replace contents with metadata longoid = 'sha256:%s' % oid -metadata = pointer.gitlfspointer(oid=longoid, size=str(len(text))) +metadata = pointer.gitlfspointer(oid=longoid, size='%d' % len(text)) # by default, we expect the content to be binary. however, LFS could also # be used for non-binary content. add a special entry for non-binary data. To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2566: lfs: use byteskwargs() on some **kwargs for python 3 compat
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe30be4d2ac60: lfs: use byteskwargs() on some **kwargs for python 3 compat (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2566?vs=6389=6395 REVISION DETAIL https://phab.mercurial-scm.org/D2566 AFFECTED FILES hgext/lfs/pointer.py CHANGE DETAILS diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py --- a/hgext/lfs/pointer.py +++ b/hgext/lfs/pointer.py @@ -13,6 +13,7 @@ from mercurial import ( error, +pycompat, ) class InvalidPointer(error.RevlogError): @@ -23,7 +24,8 @@ def __init__(self, *args, **kwargs): self['version'] = self.VERSION -super(gitlfspointer, self).__init__(*args, **kwargs) +super(gitlfspointer, self).__init__(*args) +self.update(pycompat.byteskwargs(kwargs)) @classmethod def deserialize(cls, text): To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2565: lfs: add some bytestring wrappers in blobstore.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4da09b46451e: lfs: add some bytestring wrappers in blobstore.py (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2565?vs=6388=6394 REVISION DETAIL https://phab.mercurial-scm.org/D2565 AFFECTED FILES hgext/lfs/blobstore.py CHANGE DETAILS diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -18,6 +18,7 @@ from mercurial import ( error, pathutil, +pycompat, url as urlmod, util, vfs as vfsmod, @@ -281,9 +282,9 @@ See https://github.com/git-lfs/git-lfs/blob/master/docs/api/\ basic-transfers.md """ -oid = str(obj['oid']) +oid = pycompat.bytestr(obj['oid']) -href = str(obj['actions'][action].get('href')) +href = pycompat.bytestr(obj['actions'][action].get('href')) headers = obj['actions'][action].get('header', {}).items() request = util.urlreq.request(href) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2564: lfs: add missing b prefixes on some regular expressions
This revision was automatically updated to reflect the committed changes. Closed by commit rHG95bd9e396774: lfs: add missing b prefixes on some regular expressions (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2564?vs=6387=6393 REVISION DETAIL https://phab.mercurial-scm.org/D2564 AFFECTED FILES hgext/lfs/pointer.py CHANGE DETAILS diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py --- a/hgext/lfs/pointer.py +++ b/hgext/lfs/pointer.py @@ -45,12 +45,12 @@ # regular expressions used by _validate # see https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md -_keyre = re.compile(r'\A[a-z0-9.-]+\Z') -_valuere = re.compile(r'\A[^\n]*\Z') +_keyre = re.compile(br'\A[a-z0-9.-]+\Z') +_valuere = re.compile(br'\A[^\n]*\Z') _requiredre = { -'size': re.compile(r'\A[0-9]+\Z'), -'oid': re.compile(r'\Asha256:[0-9a-f]{64}\Z'), -'version': re.compile(r'\A%s\Z' % re.escape(VERSION)), +'size': re.compile(br'\A[0-9]+\Z'), +'oid': re.compile(br'\Asha256:[0-9a-f]{64}\Z'), +'version': re.compile(br'\A%s\Z' % re.escape(VERSION)), } def validate(self): To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2568: lfs: convert hexdigest to bytes using sysbytes
indygreg requested changes to this revision. indygreg added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > wrapper.py:89 > # git-lfs only supports sha256 > -oid = hashlib.sha256(text).hexdigest() > +oid = pycompat.sysbytes(hashlib.sha256(text).hexdigest()) > self.opener.lfslocalblobstore.write(oid, text) In other places, we've done `mercurial.node.hex(hashlib.sha256(text).digest())` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2568 To: 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
D2565: lfs: add some bytestring wrappers in blobstore.py
durin42 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/D2565 AFFECTED FILES hgext/lfs/blobstore.py CHANGE DETAILS diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -18,6 +18,7 @@ from mercurial import ( error, pathutil, +pycompat, url as urlmod, util, vfs as vfsmod, @@ -281,9 +282,9 @@ See https://github.com/git-lfs/git-lfs/blob/master/docs/api/\ basic-transfers.md """ -oid = str(obj['oid']) +oid = pycompat.bytestr(obj['oid']) -href = str(obj['actions'][action].get('href')) +href = pycompat.bytestr(obj['actions'][action].get('href')) headers = obj['actions'][action].get('header', {}).items() request = util.urlreq.request(href) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2569: py3: whitelist more passing tests
durin42 created this revision. Herald added a reviewer: pulkit. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2569 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -122,6 +122,7 @@ test-hghave.t test-hgignore.t test-hgk.t +test-hgweb-removed.t test-histedit-arguments.t test-histedit-base.t test-histedit-bookmark-motion.t @@ -216,6 +217,7 @@ test-narrow-update.t test-newbranch.t test-obshistory.t +test-obsmarker-template.t test-obsmarkers-effectflag.t test-obsolete-bundle-strip.t test-obsolete-changeset-exchange.t @@ -309,6 +311,7 @@ test-revset-outgoing.t test-run-tests.py test-serve.t +test-share.t test-show-stack.t test-show-work.t test-show.t @@ -338,5 +341,6 @@ test-url-rev.t test-username-newline.t test-verify.t +test-websub.t test-win32text.t test-xdg.t To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2564: lfs: add missing b prefixes on some regular expressions
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame just some b prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2564 AFFECTED FILES hgext/lfs/pointer.py CHANGE DETAILS diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py --- a/hgext/lfs/pointer.py +++ b/hgext/lfs/pointer.py @@ -45,12 +45,12 @@ # regular expressions used by _validate # see https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md -_keyre = re.compile(r'\A[a-z0-9.-]+\Z') -_valuere = re.compile(r'\A[^\n]*\Z') +_keyre = re.compile(br'\A[a-z0-9.-]+\Z') +_valuere = re.compile(br'\A[^\n]*\Z') _requiredre = { -'size': re.compile(r'\A[0-9]+\Z'), -'oid': re.compile(r'\Asha256:[0-9a-f]{64}\Z'), -'version': re.compile(r'\A%s\Z' % re.escape(VERSION)), +'size': re.compile(br'\A[0-9]+\Z'), +'oid': re.compile(br'\Asha256:[0-9a-f]{64}\Z'), +'version': re.compile(br'\A%s\Z' % re.escape(VERSION)), } def validate(self): To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2568: lfs: convert hexdigest to bytes using sysbytes
durin42 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/D2568 AFFECTED FILES hgext/lfs/wrapper.py CHANGE DETAILS diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -15,6 +15,7 @@ from mercurial import ( error, filelog, +pycompat, revlog, util, ) @@ -85,7 +86,7 @@ text = text[offset:] # git-lfs only supports sha256 -oid = hashlib.sha256(text).hexdigest() +oid = pycompat.sysbytes(hashlib.sha256(text).hexdigest()) self.opener.lfslocalblobstore.write(oid, text) # replace contents with metadata To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2567: lfs: use %d to encode int, not str()
durin42 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/D2567 AFFECTED FILES hgext/lfs/wrapper.py CHANGE DETAILS diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -90,7 +90,7 @@ # replace contents with metadata longoid = 'sha256:%s' % oid -metadata = pointer.gitlfspointer(oid=longoid, size=str(len(text))) +metadata = pointer.gitlfspointer(oid=longoid, size='%d' % len(text)) # by default, we expect the content to be binary. however, LFS could also # be used for non-binary content. add a special entry for non-binary data. To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2566: lfs: use byteskwargs() on some **kwargs for python 3 compat
durin42 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/D2566 AFFECTED FILES hgext/lfs/pointer.py CHANGE DETAILS diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py --- a/hgext/lfs/pointer.py +++ b/hgext/lfs/pointer.py @@ -13,6 +13,7 @@ from mercurial import ( error, +pycompat, ) class InvalidPointer(error.RevlogError): @@ -23,7 +24,8 @@ def __init__(self, *args, **kwargs): self['version'] = self.VERSION -super(gitlfspointer, self).__init__(*args, **kwargs) +super(gitlfspointer, self).__init__(*args) +self.update(pycompat.byteskwargs(kwargs)) @classmethod def deserialize(cls, text): To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 10 of 10] templatekw: deprecate showdict() and showlist() (API)
On Thu, Mar 01, 2018 at 08:52:00PM -0500, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1519554875 -32400 > # Sun Feb 25 19:34:35 2018 +0900 > # Node ID d6bbe8dfafaeb32e48b38c1815dda69ca0854a5e > # Parent 0e49bbe25cdc0eb0898737dd4f584e89f8b8eb6a > templatekw: deprecate showdict() and showlist() (API) queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: silence "bad escape" warning emitted by re.sub()
On Fri, Mar 2, 2018 at 3:32 PM, Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1519946556 18000 > # Thu Mar 01 18:22:36 2018 -0500 > # Node ID b9a4498025f901cce6a5ceaedf027173e11d6a59 > # Parent dfcf589a4031211a67bab022e0a1b414f364bc39 > py3: silence "bad escape" warning emitted by re.sub() > Queued, thanks. > > Since we pass user strings directly to re.sub(), we can't avoid this > warning > without a BC. > > diff --git a/mercurial/util.py b/mercurial/util.py > --- a/mercurial/util.py > +++ b/mercurial/util.py > @@ -246,6 +246,10 @@ if _dowarn: > warnings.filterwarnings(r'default', r'', DeprecationWarning, > r'mercurial') > warnings.filterwarnings(r'default', r'', DeprecationWarning, > r'hgext') > warnings.filterwarnings(r'default', r'', DeprecationWarning, > r'hgext3rd') > +if _dowarn and pycompat.ispy3: > +# silence warning emitted by passing user string to re.sub() > +warnings.filterwarnings(r'ignore', r'bad escape', 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 > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: bail on ratcheting tests forward on 3.6.0 and 3.6.1
On Fri, Mar 2, 2018 at 3:38 PM, Kevin Bullock < kbullock+mercur...@ringworld.org> wrote: > # HG changeset patch > # User Kevin Bullock> # Date 1520023077 18000 > # Fri Mar 02 15:37:57 2018 -0500 > # Node ID 71a83808184245c86280ede647e18e6cc7945594 > # Parent dfcf589a4031211a67bab022e0a1b414f364bc39 > py3: bail on ratcheting tests forward on 3.6.0 and 3.6.1 > Queued, thanks. > > diff --git a/contrib/python3-ratchet.py b/contrib/python3-ratchet.py > --- a/contrib/python3-ratchet.py > +++ b/contrib/python3-ratchet.py > @@ -80,8 +80,7 @@ def main(argv=()): > print('warning: Python 3.6.0 and 3.6.1 have ' >'a bug which breaks Mercurial') > print('(see https://bugs.python.org/issue29714 for details)') > -# TODO(augie): uncomment exit when Python 3.6.2 is available > -# sys.exit(1) > +sys.exit(1) > > rt = subprocess.Popen([opts.python3, 'run-tests.py', '-j', > str(opts.j), > '--blacklist', opts.working_tests, '--json']) > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: bail on ratcheting tests forward on 3.6.0 and 3.6.1
# HG changeset patch # User Kevin Bullock# Date 1520023077 18000 # Fri Mar 02 15:37:57 2018 -0500 # Node ID 71a83808184245c86280ede647e18e6cc7945594 # Parent dfcf589a4031211a67bab022e0a1b414f364bc39 py3: bail on ratcheting tests forward on 3.6.0 and 3.6.1 diff --git a/contrib/python3-ratchet.py b/contrib/python3-ratchet.py --- a/contrib/python3-ratchet.py +++ b/contrib/python3-ratchet.py @@ -80,8 +80,7 @@ def main(argv=()): print('warning: Python 3.6.0 and 3.6.1 have ' 'a bug which breaks Mercurial') print('(see https://bugs.python.org/issue29714 for details)') -# TODO(augie): uncomment exit when Python 3.6.2 is available -# sys.exit(1) +sys.exit(1) rt = subprocess.Popen([opts.python3, 'run-tests.py', '-j', str(opts.j), '--blacklist', opts.working_tests, '--json']) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: silence "bad escape" warning emitted by re.sub()
# HG changeset patch # User Yuya Nishihara# Date 1519946556 18000 # Thu Mar 01 18:22:36 2018 -0500 # Node ID b9a4498025f901cce6a5ceaedf027173e11d6a59 # Parent dfcf589a4031211a67bab022e0a1b414f364bc39 py3: silence "bad escape" warning emitted by re.sub() Since we pass user strings directly to re.sub(), we can't avoid this warning without a BC. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -246,6 +246,10 @@ if _dowarn: warnings.filterwarnings(r'default', r'', DeprecationWarning, r'mercurial') warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext') warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext3rd') +if _dowarn and pycompat.ispy3: +# silence warning emitted by passing user string to re.sub() +warnings.filterwarnings(r'ignore', r'bad escape', 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
D2561: util: work around Python 3 returning None at EOF instead of ''
This revision was automatically updated to reflect the committed changes. Closed by commit rHG26a6b62919e2: util: work around Python 3 returning None at EOF instead of (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2561?vs=6378=6384 REVISION DETAIL https://phab.mercurial-scm.org/D2561 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -729,6 +729,9 @@ def read(self, res, size=-1): if not self.reads: return +# Python 3 can return None from reads at EOF instead of empty strings. +if res is None: +res = '' self.fh.write('%s> read(%d) -> %d' % (self.name, size, len(res))) self._writedata(res) To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2560: util: add missing r prefix on some __setattr__ calls
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf5427483eebe: util: add missing r prefix on some __setattr__ calls (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2560?vs=6377=6383 REVISION DETAIL https://phab.mercurial-scm.org/D2560 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -509,8 +509,8 @@ ) def __init__(self, fh, observer): -object.__setattr__(self, '_orig', fh) -object.__setattr__(self, '_observer', observer) +object.__setattr__(self, r'_orig', fh) +object.__setattr__(self, r'_observer', observer) def __getattribute__(self, name): ours = { To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2559: tests: add some re and globs for test-revset on python3
This revision was automatically updated to reflect the committed changes. Closed by commit rHGedf736c3c064: tests: add some re and globs for test-revset on python3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2559?vs=6376=6382 REVISION DETAIL https://phab.mercurial-scm.org/D2559 AFFECTED FILES tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -410,7 +410,7 @@ hg: parse error at 5: not a prefix: end [255] $ log 'date("\xy")' - hg: parse error: invalid \x escape + hg: parse error: invalid \x escape* (glob) [255] $ log 'date(tip)' hg: parse error: invalid date: 'tip' @@ -1309,7 +1309,7 @@ (func (symbol 'grep') (string '(')) - hg: parse error: invalid match pattern: unbalanced parenthesis + hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \),.*) (re) [255] $ try 'grep("\bissue\d+")' (func To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2563: debugcommands: add some strkwargs love to some **args calls
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdfcf589a4031: debugcommands: add some strkwargs love to some **args calls (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2563?vs=6380=6386 REVISION DETAIL https://phab.mercurial-scm.org/D2563 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 @@ -2790,12 +2790,13 @@ if 'PUSHFILE' in args: with open(args['PUSHFILE'], r'rb') as fh: del args['PUSHFILE'] -res, output = peer._callpush(command, fh, **args) +res, output = peer._callpush(command, fh, + **pycompat.strkwargs(args)) ui.status(_('result: %s\n') % util.escapedata(res)) ui.status(_('remote output: %s\n') % util.escapedata(output)) else: -res = peer._call(command, **args) +res = peer._call(command, **pycompat.strkwargs(args)) ui.status(_('response: %s\n') % util.escapedata(res)) elif action == 'batchbegin': To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2562: debugcommands: add an r prefix to make file mode for fdopen a sysstr
This revision was automatically updated to reflect the committed changes. Closed by commit rHGff6b8484400b: debugcommands: add an r prefix to make file mode for fdopen a sysstr (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2562?vs=6379=6385 REVISION DETAIL https://phab.mercurial-scm.org/D2562 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 @@ -2257,7 +2257,7 @@ if opts['logiofd']: # Line buffered because output is line based. -logfh = os.fdopen(int(opts['logiofd']), 'ab', 1) +logfh = os.fdopen(int(opts['logiofd']), r'ab', 1) elif opts['logiofile']: logfh = open(opts['logiofile'], 'ab', 1) To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2563: debugcommands: add some strkwargs love to some **args calls
durin42 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/D2563 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 @@ -2790,12 +2790,13 @@ if 'PUSHFILE' in args: with open(args['PUSHFILE'], r'rb') as fh: del args['PUSHFILE'] -res, output = peer._callpush(command, fh, **args) +res, output = peer._callpush(command, fh, + **pycompat.strkwargs(args)) ui.status(_('result: %s\n') % util.escapedata(res)) ui.status(_('remote output: %s\n') % util.escapedata(output)) else: -res = peer._call(command, **args) +res = peer._call(command, **pycompat.strkwargs(args)) ui.status(_('response: %s\n') % util.escapedata(res)) elif action == 'batchbegin': To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2561: util: work around Python 3 returning None at EOF instead of ''
durin42 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/D2561 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -729,6 +729,9 @@ def read(self, res, size=-1): if not self.reads: return +# Python 3 can return None from reads at EOF instead of empty strings. +if res is None: +res = '' self.fh.write('%s> read(%d) -> %d' % (self.name, size, len(res))) self._writedata(res) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2562: debugcommands: add an r prefix to make file mode for fdopen a sysstr
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame just an r prefix REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2562 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 @@ -2257,7 +2257,7 @@ if opts['logiofd']: # Line buffered because output is line based. -logfh = os.fdopen(int(opts['logiofd']), 'ab', 1) +logfh = os.fdopen(int(opts['logiofd']), r'ab', 1) elif opts['logiofile']: logfh = open(opts['logiofile'], 'ab', 1) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2552: py3: whitelist more passing tests
durin42 updated this revision to Diff 6381. durin42 retitled this revision from "py3: sixteen more passing tests" to "py3: whitelist more passing tests". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2552?vs=6372=6381 REVISION DETAIL https://phab.mercurial-scm.org/D2552 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -216,6 +216,7 @@ test-narrow-update.t test-newbranch.t test-obshistory.t +test-obsmarker-template.t test-obsmarkers-effectflag.t test-obsolete-bundle-strip.t test-obsolete-changeset-exchange.t To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2560: util: add missing r prefix on some __setattr__ calls
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame just a pair of r prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2560 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -509,8 +509,8 @@ ) def __init__(self, fh, observer): -object.__setattr__(self, '_orig', fh) -object.__setattr__(self, '_observer', observer) +object.__setattr__(self, r'_orig', fh) +object.__setattr__(self, r'_observer', observer) def __getattribute__(self, name): ours = { To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2559: tests: add some re and globs for test-revset on python3
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY At this point we're down to two deprecation warnings (which I suspect are showing a bug in the test?) and one weird-looking failure. Progress! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2559 AFFECTED FILES tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -410,7 +410,7 @@ hg: parse error at 5: not a prefix: end [255] $ log 'date("\xy")' - hg: parse error: invalid \x escape + hg: parse error: invalid \x escape* (glob) [255] $ log 'date(tip)' hg: parse error: invalid date: 'tip' @@ -1309,7 +1309,7 @@ (func (symbol 'grep') (string '(')) - hg: parse error: invalid match pattern: unbalanced parenthesis + hg: parse error: invalid match pattern: (unbalanced parenthesis|missing \),.*) (re) [255] $ try 'grep("\bissue\d+")' (func To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2535: py3: use pycompat.bytestr() to convert error messages to bytes
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. Some of them have to be forcebytestr(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2535 To: pulkit, durin42, #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
D2549: debugcommands: fix repr in debugignore print with pycompat.bytestr
This revision was automatically updated to reflect the committed changes. Closed by commit rHG149fd142f498: debugcommands: fix repr in debugignore print with pycompat.bytestr (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2549?vs=6365=6371 REVISION DETAIL https://phab.mercurial-scm.org/D2549 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 @@ -1005,7 +1005,7 @@ ignore = repo.dirstate._ignore if not files: # Show all the patterns -ui.write("%s\n" % repr(ignore)) +ui.write("%s\n" % pycompat.byterepr(ignore)) else: m = scmutil.match(repo[None], pats=files) for f in m.files(): To: durin42, #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
D2552: py3: sixteen more passing tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbe27c4e310bd: py3: sixteen more passing tests (authored by durin42, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2552?vs=6348=6372#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2552?vs=6348=6372 REVISION DETAIL https://phab.mercurial-scm.org/D2552 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -14,8 +14,10 @@ test-bookmarks-merge.t test-bookmarks-rebase.t test-bookmarks-strip.t +test-bookmarks.t test-branch-option.t test-branch-tag-confict.t +test-branches.t test-bundle-phases.t test-bundle-vs-outgoing.t test-bundle2-multiple-changegroups.t @@ -47,11 +49,13 @@ test-convert-datesort.t test-convert-filemap.t test-convert-hg-sink.t +test-convert-hg-source.t test-convert-hg-startrev.t test-copy-move-merge.t test-copytrace-heuristics.t test-debugbuilddag.t test-debugbundle.t +test-debugextensions.t test-debugindexdot.t test-debugrename.t test-diff-binary-file.t @@ -75,6 +79,7 @@ test-empty-group.t test-empty.t test-encoding-func.py +test-encoding.t test-eol-add.t test-eol-clone.t test-eol-tag.t @@ -115,6 +120,7 @@ test-gpg.t test-graft.t test-hghave.t +test-hgignore.t test-hgk.t test-histedit-arguments.t test-histedit-base.t @@ -136,13 +142,15 @@ test-imports-checker.t test-inherit-mode.t test-issue1089.t +test-issue1102.t test-issue1175.t test-issue1306.t test-issue1438.t test-issue1502.t test-issue1802.t test-issue1877.t test-issue1993.t +test-issue2137.t test-issue3084.t test-issue4074.t test-issue522.t @@ -193,6 +201,7 @@ test-narrow-clone-no-ellipsis.t test-narrow-clone-nonlinear.t test-narrow-clone.t +test-narrow-commit.t test-narrow-copies.t test-narrow-debugrebuilddirstate.t test-narrow-exchange-merges.t @@ -212,6 +221,7 @@ test-obsolete-changeset-exchange.t test-obsolete-checkheads.t test-obsolete-distributed.t +test-obsolete-tag-cache.t test-parents.t test-pathconflicts-merge.t test-pathconflicts-update.t @@ -224,6 +234,7 @@ test-pull-pull-corruption.t test-pull-r.t test-pull-update.t +test-purge.t test-push-checkheads-partial-C1.t test-push-checkheads-partial-C2.t test-push-checkheads-partial-C3.t @@ -299,6 +310,7 @@ test-run-tests.py test-serve.t test-show-stack.t +test-show-work.t test-show.t test-simple-update.t test-single-head.t @@ -325,5 +337,6 @@ test-update-reverse.t test-url-rev.t test-username-newline.t +test-verify.t test-win32text.t test-xdg.t To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2558: tests: add missing b prefixes and fix a %s to %d in test-revset.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG27911e0fb50e: tests: add missing b prefixes and fix a %s to %d in test-revset.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2558?vs=6368=6375 REVISION DETAIL https://phab.mercurial-scm.org/D2558 AFFECTED FILES tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -55,7 +55,7 @@ > expr = revsetlang.formatspec(fmt, list(args)) > if ui.verbose: > tree = revsetlang.parse(expr, lookup=repo.__contains__) - > ui.note(revsetlang.prettyformat(tree), "\n") + > ui.note(revsetlang.prettyformat(tree), b"\n") > if opts["optimize"]: > opttree = revsetlang.optimize(revsetlang.analyze(tree)) > ui.note(b"* optimized:\n", revsetlang.prettyformat(opttree), @@ -65,7 +65,7 @@ > if ui.verbose: > ui.note(b"* set:\n", smartset.prettyformat(revs), b"\n") > for c in revs: - > ui.write(b"%s\n" % c) + > ui.write(b"%d\n" % c) > EOF $ cat <> $HGRCPATH > [extensions] To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2557: revset: use %d to turn an int into a bytestr
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb755eab7e677: revset: use %d to turn an int into a bytestr (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2557?vs=6367=6374 REVISION DETAIL https://phab.mercurial-scm.org/D2557 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2061,7 +2061,7 @@ try: # fast path for integer revision r = int(t) -if str(r) != t or r not in cl: +if ('%d' % r) != t or r not in cl: raise ValueError revs = [r] except ValueError: To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2556: revset: use {force,}bytestr to fix some %r formatting issues
This revision was automatically updated to reflect the committed changes. Closed by commit rHG04e50037d957: revset: use {force,}bytestr to fix some %r formatting issues (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2556?vs=6366=6373 REVISION DETAIL https://phab.mercurial-scm.org/D2556 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1011,7 +1011,8 @@ # i18n: "grep" is a keyword gr = re.compile(getstring(x, _("grep requires a string"))) except re.error as e: -raise error.ParseError(_('invalid match pattern: %s') % e) +raise error.ParseError( +_('invalid match pattern: %s') % util.forcebytestr(e)) def matches(x): c = repo[x] @@ -1845,7 +1846,8 @@ if reverse: k = k[1:] if k not in _sortkeyfuncs and k != 'topo': -raise error.ParseError(_("unknown sort key %r") % fk) +raise error.ParseError( +_("unknown sort key %r") % pycompat.bytestr(fk)) keyflags.append((k, reverse)) if len(keyflags) > 1 and any(k == 'topo' for k, reverse in keyflags): To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2541: verify: fix exception formatting bug in Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd85ef895d5f6: verify: fix exception formatting bug in Python 3 (authored by durin42, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2541?vs=6364=6370#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2541?vs=6364=6370 REVISION DETAIL https://phab.mercurial-scm.org/D2541 AFFECTED FILES mercurial/verify.py CHANGE DETAILS diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -70,9 +70,10 @@ self.errors += 1 def exc(self, linkrev, msg, inst, filename=None): -if not str(inst): -inst = repr(inst) -self.err(linkrev, "%s: %s" % (msg, inst), filename) +fmsg = pycompat.bytestr(inst) +if not fmsg: +fmsg = pycompat.byterepr(inst) +self.err(linkrev, "%s: %s" % (msg, fmsg), filename) def checklog(self, obj, name, linkrev): if not len(obj) and (self.havecl or self.havemf): To: durin42, #hg-reviewers, pulkit, 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] get-with-headers: use bytes stdout thoroughly
On Fri, Mar 2, 2018 at 2:07 PM, Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1520016631 18000 > # Fri Mar 02 13:50:31 2018 -0500 > # Node ID b71dad3502643ade9b01166ab6657d216c46c221 > # Parent 45f149bf08d12750cc4993fd3d4e6f1bb999e8d5 > get-with-headers: use bytes stdout thoroughly > Queued, thanks. > > On Python 3, sys.stdout.buffer is backed by a separate buffer from > sys.stdout. > We should choose one. > > diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py > --- a/tests/get-with-headers.py > +++ b/tests/get-with-headers.py > @@ -3,7 +3,7 @@ > """This does HTTP GET requests given a host:port and path and returns > a subset of the headers plus the body of the result.""" > > -from __future__ import absolute_import, print_function > +from __future__ import absolute_import > > import argparse > import json > @@ -23,6 +23,8 @@ try: > except ImportError: > pass > > +stdout = getattr(sys.stdout, 'buffer', sys.stdout) > + > parser = argparse.ArgumentParser() > parser.add_argument('--twice', action='store_true') > parser.add_argument('--headeronly', action='store_true') > @@ -62,21 +64,23 @@ def request(host, path, show): > conn = httplib.HTTPConnection(host) > conn.request("GET", '/' + path, None, headers) > response = conn.getresponse() > -print(response.status, response.reason) > +stdout.write(b'%d %s\n' % (response.status, > + response.reason.encode('ascii'))) > if show[:1] == ['-']: > show = sorted(h for h, v in response.getheaders() >if h.lower() not in show) > for h in [h.lower() for h in show]: > if response.getheader(h, None) is not None: > -print("%s: %s" % (h, response.getheader(h))) > +stdout.write(b"%s: %s\n" % (h.encode('ascii'), > +response.getheader(h).encode(' > ascii'))) > if not headeronly: > -print() > +stdout.write(b'\n') > data = response.read() > > if args.bodyfile: > bodyfh = open(args.bodyfile, 'wb') > else: > -bodyfh = getattr(sys.stdout, 'buffer', sys.stdout) > +bodyfh = stdout > > # Pretty print JSON. This also has the beneficial side-effect > # of verifying emitted JSON is well-formed. > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2541: verify: fix exception formatting bug in Python 3
yuja accepted this revision. yuja added inline comments. This revision is now accepted and ready to land. INLINE COMMENTS > verify.py:76 > +fmsg = pycompat.byterepr(inst) > self.err(linkrev, "%s: %s" % (msg, inst), filename) > s/inst/fmsg/ and queued, thanks. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2541 To: durin42, #hg-reviewers, pulkit, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2555: py3: two more passing tests
durin42 abandoned this revision. durin42 added a comment. going to fold this someplace else REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2555 To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2548: exchange: remove dead assignment or forcebundle1
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdf7b7d5033a5: exchange: remove dead assignment or forcebundle1 (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2548?vs=6344=6369 REVISION DETAIL https://phab.mercurial-scm.org/D2548 AFFECTED FILES mercurial/exchange.py CHANGE DETAILS diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -283,7 +283,6 @@ This function is used to allow testing of the older bundle version""" ui = op.repo.ui -forcebundle1 = False # The goal is this config is to allow developer to choose the bundle # version used during exchanged. This is especially handy during test. # Value is a list of bundle version to be picked from, highest version To: martinvonz, #hg-reviewers, pulkit, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] get-with-headers: use bytes stdout thoroughly
# HG changeset patch # User Yuya Nishihara# Date 1520016631 18000 # Fri Mar 02 13:50:31 2018 -0500 # Node ID b71dad3502643ade9b01166ab6657d216c46c221 # Parent 45f149bf08d12750cc4993fd3d4e6f1bb999e8d5 get-with-headers: use bytes stdout thoroughly On Python 3, sys.stdout.buffer is backed by a separate buffer from sys.stdout. We should choose one. diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py --- a/tests/get-with-headers.py +++ b/tests/get-with-headers.py @@ -3,7 +3,7 @@ """This does HTTP GET requests given a host:port and path and returns a subset of the headers plus the body of the result.""" -from __future__ import absolute_import, print_function +from __future__ import absolute_import import argparse import json @@ -23,6 +23,8 @@ try: except ImportError: pass +stdout = getattr(sys.stdout, 'buffer', sys.stdout) + parser = argparse.ArgumentParser() parser.add_argument('--twice', action='store_true') parser.add_argument('--headeronly', action='store_true') @@ -62,21 +64,23 @@ def request(host, path, show): conn = httplib.HTTPConnection(host) conn.request("GET", '/' + path, None, headers) response = conn.getresponse() -print(response.status, response.reason) +stdout.write(b'%d %s\n' % (response.status, + response.reason.encode('ascii'))) if show[:1] == ['-']: show = sorted(h for h, v in response.getheaders() if h.lower() not in show) for h in [h.lower() for h in show]: if response.getheader(h, None) is not None: -print("%s: %s" % (h, response.getheader(h))) +stdout.write(b"%s: %s\n" % (h.encode('ascii'), +response.getheader(h).encode('ascii'))) if not headeronly: -print() +stdout.write(b'\n') data = response.read() if args.bodyfile: bodyfh = open(args.bodyfile, 'wb') else: -bodyfh = getattr(sys.stdout, 'buffer', sys.stdout) +bodyfh = stdout # Pretty print JSON. This also has the beneficial side-effect # of verifying emitted JSON is well-formed. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2282: util: extract all date-related utils in utils/dateutil module
durin42 added a comment. I'm happy to land this, but it's going to need rebased. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2282 To: lothiraldan, #hg-reviewers, durin42 Cc: durin42, dlax, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2282: util: extract all date-related utils in utils/dateutil module
martinvonz added a comment. In https://phab.mercurial-scm.org/D2282#41464, @durin42 wrote: > I'm fine with this but would like someone else to ack it. Ack REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2282 To: lothiraldan, #hg-reviewers, durin42 Cc: durin42, dlax, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2282: util: extract all date-related utils in utils/dateutil module
durin42 accepted this revision as: durin42. durin42 added a comment. I'm fine with this but would like someone else to ack it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2282 To: lothiraldan, #hg-reviewers, durin42 Cc: durin42, dlax, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2557: revset: use %d to turn an int into a bytestr
durin42 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/D2557 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2061,7 +2061,7 @@ try: # fast path for integer revision r = int(t) -if str(r) != t or r not in cl: +if ('%d' % r) != t or r not in cl: raise ValueError revs = [r] except ValueError: To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2549: debugcommands: fix repr in debugignore print with pycompat.bytestr
durin42 updated this revision to Diff 6365. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2549?vs=6345=6365 REVISION DETAIL https://phab.mercurial-scm.org/D2549 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 @@ -1005,7 +1005,7 @@ ignore = repo.dirstate._ignore if not files: # Show all the patterns -ui.write("%s\n" % repr(ignore)) +ui.write("%s\n" % pycompat.byterepr(ignore)) else: m = scmutil.match(repo[None], pats=files) for f in m.files(): To: durin42, #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
D2558: tests: add missing b prefixes and fix a %s to %d in test-revset.t
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame just b prefixes and a %d instead of %s REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2558 AFFECTED FILES tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -55,7 +55,7 @@ > expr = revsetlang.formatspec(fmt, list(args)) > if ui.verbose: > tree = revsetlang.parse(expr, lookup=repo.__contains__) - > ui.note(revsetlang.prettyformat(tree), "\n") + > ui.note(revsetlang.prettyformat(tree), b"\n") > if opts["optimize"]: > opttree = revsetlang.optimize(revsetlang.analyze(tree)) > ui.note(b"* optimized:\n", revsetlang.prettyformat(opttree), @@ -65,7 +65,7 @@ > if ui.verbose: > ui.note(b"* set:\n", smartset.prettyformat(revs), b"\n") > for c in revs: - > ui.write(b"%s\n" % c) + > ui.write(b"%d\n" % c) > EOF $ cat <> $HGRCPATH > [extensions] To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2556: revset: use {force,}bytestr to fix some %r formatting issues
durin42 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/D2556 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1011,7 +1011,8 @@ # i18n: "grep" is a keyword gr = re.compile(getstring(x, _("grep requires a string"))) except re.error as e: -raise error.ParseError(_('invalid match pattern: %s') % e) +raise error.ParseError( +_('invalid match pattern: %s') % util.forcebytestr(e)) def matches(x): c = repo[x] @@ -1845,7 +1846,8 @@ if reverse: k = k[1:] if k not in _sortkeyfuncs and k != 'topo': -raise error.ParseError(_("unknown sort key %r") % fk) +raise error.ParseError( +_("unknown sort key %r") % pycompat.bytestr(fk)) keyflags.append((k, reverse)) if len(keyflags) > 1 and any(k == 'topo' for k, reverse in keyflags): To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2541: verify: fix exception formatting bug in Python 3
durin42 updated this revision to Diff 6364. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2541?vs=6331=6364 REVISION DETAIL https://phab.mercurial-scm.org/D2541 AFFECTED FILES mercurial/verify.py CHANGE DETAILS diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -70,8 +70,9 @@ self.errors += 1 def exc(self, linkrev, msg, inst, filename=None): -if not str(inst): -inst = repr(inst) +fmsg = pycompat.bytestr(inst) +if not fmsg: +fmsg = pycompat.byterepr(inst) self.err(linkrev, "%s: %s" % (msg, inst), filename) def checklog(self, obj, name, linkrev): To: durin42, #hg-reviewers, pulkit, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2546: tests: port test-bookmarks.t extension to Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4df06d2f60e1: tests: port test-bookmarks.t extension to Python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2546?vs=6340=6359 REVISION DETAIL https://phab.mercurial-scm.org/D2546 AFFECTED FILES tests/test-bookmarks.t CHANGE DETAILS diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -980,14 +980,14 @@ >tr = orig(self, desc, report) >def sleep(*args, **kwargs): >retry = 20 - >while retry > 0 and not os.path.exists("$TESTTMP/unpause"): + >while retry > 0 and not os.path.exists(b"$TESTTMP/unpause"): >retry -= 1 >time.sleep(0.5) - >if os.path.exists("$TESTTMP/unpause"): - >os.remove("$TESTTMP/unpause") + >if os.path.exists(b"$TESTTMP/unpause"): + >os.remove(b"$TESTTMP/unpause") ># It is important that this finalizer start with 'a', so it runs before ># the changelog finalizer appends to the changelog. - >tr.addfinalize('a-sleep', sleep) + >tr.addfinalize(b'a-sleep', sleep) >return tr > > def extsetup(ui): To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2547: purge: apply byteskwargs to opts, fixing all python3 issues here
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5a3f8da663e5: purge: apply byteskwargs to opts, fixing all python3 issues here (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2547?vs=6342=6360 REVISION DETAIL https://phab.mercurial-scm.org/D2547 AFFECTED FILES hgext/purge.py CHANGE DETAILS diff --git a/hgext/purge.py b/hgext/purge.py --- a/hgext/purge.py +++ b/hgext/purge.py @@ -31,6 +31,7 @@ from mercurial import ( cmdutil, error, +pycompat, registrar, scmutil, util, @@ -84,6 +85,7 @@ list of files that this program would delete, use the --print option. ''' +opts = pycompat.byteskwargs(opts) act = not opts.get('print') eol = '\n' if opts.get('print0'): To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2545: scmutil: fix a repr in an error message on Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbb5f5c1c3c1b: scmutil: fix a repr in an error message on Python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2545?vs=6338=6358 REVISION DETAIL https://phab.mercurial-scm.org/D2545 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -261,7 +261,8 @@ raise error.Abort(_("the name '%s' is reserved") % lbl) for c in (':', '\0', '\n', '\r'): if c in lbl: -raise error.Abort(_("%r cannot be used in a name") % c) +raise error.Abort( +_("%r cannot be used in a name") % pycompat.bytestr(c)) try: int(lbl) raise error.Abort(_("cannot use an integer as a name")) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2554: templatekw: fix dict construction in _showlist to not mix bytes and strs
This revision was automatically updated to reflect the committed changes. Closed by commit rHG45f149bf08d1: templatekw: fix dict construction in _showlist to not mix bytes and strs (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2554?vs=6350=6363 REVISION DETAIL https://phab.mercurial-scm.org/D2554 AFFECTED FILES mercurial/templatekw.py CHANGE DETAILS diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -205,7 +205,9 @@ yield separator.join(values) else: for v in values: -yield dict(v, **strmapping) +r = dict(v) +r.update(mapping) +yield r return startname = 'start_' + plural if startname in templ: To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2551: match: some minimal pycompat fixes guided by test-hgignore.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9adfa48792a7: match: some minimal pycompat fixes guided by test-hgignore.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2551?vs=6347=6361 REVISION DETAIL https://phab.mercurial-scm.org/D2551 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -16,6 +16,7 @@ encoding, error, pathutil, +pycompat, util, ) @@ -226,7 +227,7 @@ except IOError as inst: if warn: warn(_("skipping unreadable pattern file '%s': %s\n") % - (pat, inst.strerror)) + (pat, util.forcebytestr(inst.strerror))) continue # else: re or relre - which cannot be normalized kindpats.append((kind, pat, '')) @@ -428,7 +429,7 @@ @encoding.strmethod def __repr__(self): -return ('' % self._pats) +return ('' % pycompat.bytestr(self._pats)) class exactmatcher(basematcher): '''Matches the input files exactly. They are interpreted as paths, not To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2553: templatefilters: avoid infinite recursion bug in stringify
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9b6b02a5b589: templatefilters: avoid infinite recursion bug in stringify (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2553?vs=6349=6362 REVISION DETAIL https://phab.mercurial-scm.org/D2553 AFFECTED FILES mercurial/templatefilters.py CHANGE DETAILS diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -376,6 +376,12 @@ """ thing = templatekw.unwraphybrid(thing) if util.safehasattr(thing, '__iter__') and not isinstance(thing, bytes): +if isinstance(thing, str): +# This is only reachable on Python 3 (otherwise +# isinstance(thing, bytes) would have been true), and is +# here to prevent infinite recursion bugs on Python 3. +raise error.ProgrammingError( +'stringify got unexpected unicode string: %r' % thing) return "".join([stringify(t) for t in thing if t is not None]) if thing is None: return "" To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2544: bookmarks: fix a repr in a message on Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa5eefc95: bookmarks: fix a repr in a message on Python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2544?vs=6337=6357 REVISION DETAIL https://phab.mercurial-scm.org/D2544 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 @@ -84,7 +84,7 @@ # - node in nm, for non-20-bytes entry # - split(...), for string without ' ' repo.ui.warn(_('malformed line in .hg/bookmarks: %r\n') - % line) + % pycompat.bytestr(line)) except IOError as inst: if inst.errno != errno.ENOENT: raise To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2543: py3: add missing b prefixes in test-debugextensions.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG19ec5da944d5: py3: add missing b prefixes in test-debugextensions.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2543?vs=6335=6356 REVISION DETAIL https://phab.mercurial-scm.org/D2543 AFFECTED FILES tests/test-debugextensions.t CHANGE DETAILS diff --git a/tests/test-debugextensions.t b/tests/test-debugextensions.t --- a/tests/test-debugextensions.t +++ b/tests/test-debugextensions.t @@ -5,8 +5,8 @@ $ cat > extwithoutinfos.py < EOF $ cat > extwithinfos.py < testedwith = '3.0 3.1 3.2.1' - > buglink = 'https://example.org/bts' + > testedwith = b'3.0 3.1 3.2.1' + > buglink = b'https://example.org/bts' > EOF $ cat >> $HGRCPATH
D2542: tests: help dummysmtpd work on python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHGed96d1116302: tests: help dummysmtpd work on python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2542?vs=6333=6355 REVISION DETAIL https://phab.mercurial-scm.org/D2542 AFFECTED FILES tests/dummysmtpd.py CHANGE DETAILS diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -12,6 +12,7 @@ import traceback from mercurial import ( +pycompat, server, sslutil, ui as uimod, @@ -63,6 +64,19 @@ except KeyboardInterrupt: pass +def _encodestrsonly(v): +if isinstance(v, type(u'')): +return v.encode('ascii') +return v + +def bytesvars(obj): +unidict = vars(obj) +bd = {k.encode('ascii'): _encodestrsonly(v) for k, v in unidict.items()} +if bd[b'daemon_postexec'] is not None: +bd[b'daemon_postexec'] = [ +_encodestrsonly(v) for v in bd[b'daemon_postexec']] +return bd + def main(): op = optparse.OptionParser() op.add_option('-d', '--daemon', action='store_true') @@ -85,8 +99,10 @@ dummysmtpsecureserver(addr, opts.certificate) log('listening at %s:%d\n' % addr) -server.runservice(vars(opts), initfn=init, runfn=run, - runargs=[sys.executable, __file__] + sys.argv[1:]) +server.runservice( +bytesvars(opts), initfn=init, runfn=run, +runargs=[pycompat.sysexecutable, + pycompat.fsencode(__file__)] + pycompat.sysargv[1:]) if __name__ == '__main__': main() To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2539: tests: add missing b prefix in test python in test-issue2137.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc4ccc73f9d49: tests: add missing b prefix in test python in test-issue2137.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2539?vs=6329=6353 REVISION DETAIL https://phab.mercurial-scm.org/D2539 AFFECTED FILES tests/test-issue2137.t CHANGE DETAILS diff --git a/tests/test-issue2137.t b/tests/test-issue2137.t --- a/tests/test-issue2137.t +++ b/tests/test-issue2137.t @@ -18,7 +18,7 @@ > tip1 = node.short(repo.changelog.tip()) > tip2 = node.short(repo.lookup(tip1)) > assert tip1 == tip2 - > ui.write('new tip: %s\n' % tip1) + > ui.write(b'new tip: %s\n' % tip1) > return result > repo.__class__ = wraprepo > To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2538: templatefilters: convert arguments to sysstrs for unicode() ctor
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9d71bd25554b: templatefilters: convert arguments to sysstrs for unicode() ctor (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2538?vs=6328=6352 REVISION DETAIL https://phab.mercurial-scm.org/D2538 AFFECTED FILES mercurial/templatefilters.py CHANGE DETAILS diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -273,7 +273,7 @@ """Any text. Returns the input text rendered as a sequence of XML entities. """ -text = unicode(text, encoding.encoding, 'replace') +text = unicode(text, pycompat.sysstr(encoding.encoding), r'replace') return ''.join(['
D2540: tests: port helper script revlog-formatv0.py to python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9805c906aaad: tests: port helper script revlog-formatv0.py to python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2540?vs=6330=6354 REVISION DETAIL https://phab.mercurial-scm.org/D2540 AFFECTED FILES tests/revlog-formatv0.py CHANGE DETAILS diff --git a/tests/revlog-formatv0.py b/tests/revlog-formatv0.py --- a/tests/revlog-formatv0.py +++ b/tests/revlog-formatv0.py @@ -18,6 +18,7 @@ """ from __future__ import absolute_import +import binascii import os import sys @@ -56,7 +57,7 @@ for name, data in files: f = open(name, 'wb') -f.write(data.decode('hex')) +f.write(binascii.unhexlify(data)) f.close() sys.exit(0) To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2549: debugcommands: fix repr in debugignore print with pycompat.bytestr
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. `pycompat.byterepr()` or `"%r\n" %` is preferred. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2549 To: durin42, #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
D2537: tests: make get-with-headers flush after print() calls
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. Appears that this disclosed some weird issue: --- tests/test-hgweb-commands.t +++ tests/test-hgweb-commands.t.err @@ -2116,7 +2116,10 @@ $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=capabilities' | dd ibs=75 count=1 2> /dev/null; echo 200 Script output follows - lookup changegroupsubset branchmap pushkey known + close failed in file object destructor: + sys.excepthook is missing + lost sys.stderr + REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2537 To: durin42, #hg-reviewers, pulkit, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel