[PATCH] tests: stabilize test-patch.t on Windows
# HG changeset patch # User Matt Harbison# Date 1526871918 14400 # Sun May 20 23:05:18 2018 -0400 # Node ID 341bec645529aa249423f3aa683dac876d9e1510 # Parent 6acf41bb8d40c55073e846b81c7466f4b0d390dc tests: stabilize test-patch.t on Windows $PYTHON needs to be quoted when invoking with cmd.exe, because the value expands to c:/Python27/python.exe, which seems to be interpreted as 'c' being a command. We can't just convert to '\', because there are a few places that run $PYTHON directly in MSYS. If unquoted there, it results in c:Python27python.exe being run. I wonder if we should bake the quotes into the environment variable to avoid this. It also wasn't happy with the quoting around exit1.py: c:/Python27/python.exe: can't open file ''$TESTTMP/d/exit1.py'': [Errno 22] Invalid argument diff --git a/tests/test-patch.t b/tests/test-patch.t --- a/tests/test-patch.t +++ b/tests/test-patch.t @@ -97,7 +97,7 @@ Error exit (issue4746) > sys.exit(1) > EOF - $ hg import ../c/p --config ui.patch="$PYTHON '`pwd`/exit1.py'" + $ hg import ../c/p --config ui.patch="\"$PYTHON\" `pwd`/exit1.py" applying ../c/p abort: patch command failed: exited with status 1 [255] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3639: remotenames: add paths argument to remotenames revset
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch adds paths argument to the revsets provided by the remotenames extension. The revsets are remotenames(), remotebranches() and remotebookmarks(). paths can be a single path, list of paths or can be empty too which means it's an optional argument. If paths is/are passed, changesets which have remotenames from those remote paths are shown only. If paths is/are not passed, changesets from all the remote paths are shown. Passing an invalid path name does not throw error. Tests are added for the argument in tests/test-logexchange.t REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3639 AFFECTED FILES hgext/remotenames.py tests/test-logexchange.t CHANGE DETAILS diff --git a/tests/test-logexchange.t b/tests/test-logexchange.t --- a/tests/test-logexchange.t +++ b/tests/test-logexchange.t @@ -291,6 +291,7 @@ ~ Updating to revision using hoisted name +--- Deleting local bookmark to make sure we update to hoisted name only @@ -395,3 +396,173 @@ default/bar 6:87d6d6676308 default/foo 8:3e1487808078 * foo 8:3e1487808078 + +Testing the paths argument to remotenames, remotebranches and remotebookmarks revsets +-- + + $ cd .. + $ hg clone ssh://user@dummy/server client2 + requesting all changes + adding changesets + adding manifests + adding file changes + added 9 changesets with 9 changes to 9 files (+1 heads) + new changesets 18d04c59bb5d:3e1487808078 + updating to branch default + 8 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd server2 + $ hg up wat + 6 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo foo > watwat + $ hg ci -Aqm "added watwat" + $ hg bookmark bar + abort: bookmark 'bar' already exists (use -f to force) + [255] + $ hg up ec24 + 3 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo i > i + $ hg ci -Aqm "added i" + + $ cd ../client2 + $ echo "[paths]" >> .hg/hgrc + $ echo "server2 = $TESTTMP/server2" >> .hg/hgrc + $ hg pull server2 + pulling from $TESTTMP/server2 + searching for changes + adding changesets + adding manifests + adding file changes + added 2 changesets with 2 changes to 2 files + new changesets f34adec73c21:bf433e48adea + (run 'hg update' to get a working copy) + + $ hg log -Gr 'remotenames()' -T '{rev}:{node|short} {desc}\n({remotebranches}) [{remotebookmarks}]\n\n' + o 10:bf433e48adea added i + | (server2/default) [] + | + | o 9:f34adec73c21 added watwat + | | (server2/wat) [] + | | + | o 8:3e1487808078 added bar + | : (default/wat) [default/foo] + | : + @ : 7:ec2426147f0e Added h + | : (default/default) [] + | : + o : 6:87d6d6676308 Added g + :/ () [default/bar server2/bar] + : + o 3:62615734edd5 Added d + | () [server2/foo] + ~ + +Testing for a single path name which exists + + $ hg log -r 'remotebranches(default)' -GT "{rev}:{node|short} {remotebranches}\n" + o 8:3e1487808078 default/wat + | + ~ + @ 7:ec2426147f0e default/default + | + ~ + + $ hg log -r 'remotebookmarks("server2")' -GT "{rev}:{node|short} {remotebookmarks}\n" + o 6:87d6d6676308 default/bar server2/bar + : + o 3:62615734edd5 server2/foo + | + ~ + + $ hg log -r 'remotenames(default)' -GT "{rev}:{node|short} {remotenames}\n" + o 8:3e1487808078 default/foo default/wat + | + ~ + @ 7:ec2426147f0e default/default + | + o 6:87d6d6676308 default/bar server2/bar + | + ~ + +Testing for a single path name which does not exists + + $ hg log -r 'remotebranches(def)' -GT "{rev}:{node|short} {remotenames}\n" + + $ hg log -r 'remotebookmarks("server3")' -GT "{rev}:{node|short} {remotenames}\n" + + $ hg log -r 'remotenames("server3")' -GT "{rev}:{node|short} {remotenames}\n" + +Testing for multiple paths where all of them exists + + $ hg log -r 'remotenames(default, server2)' -GT "{rev}:{node|short} {remotenames}\n" + o 10:bf433e48adea server2/default + | + | o 9:f34adec73c21 server2/wat + | | + | o 8:3e1487808078 default/foo default/wat + | : + @ : 7:ec2426147f0e default/default + | : + o : 6:87d6d6676308 default/bar server2/bar + :/ + o 3:62615734edd5 server2/foo + | + ~ + + $ hg log -r 'remotebranches(default, server2)' -GT "{rev}:{node|short} {remotebranches}\n" + o 10:bf433e48adea server2/default + | + | o 9:f34adec73c21 server2/wat + | | + | o 8:3e1487808078 default/wat + | | + | ~ + @ 7:ec2426147f0e default/default + | + ~ + + $ hg log -r 'remotebookmarks(default, server2)' -GT "{rev}:{node|short} {remotebookmarks}\n" + o 8:3e1487808078 default/foo + : + : o 6:87d6d6676308 default/bar server2/bar + :/ +
D3627: status: add a config knob for setting default of --terse
This revision was automatically updated to reflect the committed changes. Closed by commit rHG18424aeece7f: status: add a config knob for setting default of --terse (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3627?vs=8835=8847 REVISION DETAIL https://phab.mercurial-scm.org/D3627 AFFECTED FILES mercurial/commands.py mercurial/configitems.py mercurial/help/config.txt tests/test-status-terse.t CHANGE DETAILS diff --git a/tests/test-status-terse.t b/tests/test-status-terse.t --- a/tests/test-status-terse.t +++ b/tests/test-status-terse.t @@ -183,3 +183,55 @@ $ hg status --terse marduic --rev 0 --rev 1 abort: cannot use --terse with --rev [255] + +Config item to set the default terseness + $ cat <> $HGRCPATH + > [commands] + > status.terse = u + > EOF + $ hg status -mu + M x/aa + M x/bb + ? a + ? b + ? x/l/ + ? x/m/ + ? x/n/ + ? y/ + +Command line flag overrides the default + $ hg status --terse= + M x/aa + M x/bb + ? a + ? b + ? x/l/aa + ? x/l/u/a/bb + ? x/l/u/bb + ? x/m/aa + ? x/n/aa + ? y/l + ? y/m + $ hg status --terse=mardu + M x/aa + M x/bb + ? a + ? b + ? x/l/ + ? x/m/ + ? x/n/ + ? y/ + +Specifying --rev should still work, with the terseness disabled. + $ hg status --rev 0 + M x/aa + M x/bb + ? a + ? b + ? x/l/aa + ? x/l/u/a/bb + ? x/l/u/bb + ? x/m/aa + ? x/n/aa + ? y/l + ? y/m diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -442,6 +442,10 @@ Make paths in :hg:`status` output relative to the current directory. (default: False) +``status.terse`` +Default value for the --terse flag, which condenes status output. +(default: empty) + ``update.check`` Determines what level of checking :hg:`update` will perform before moving to a destination revision. Valid values are ``abort``, ``none``, diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -193,6 +193,9 @@ coreconfigitem('commands', 'status.skipstates', default=[], ) +coreconfigitem('commands', 'status.terse', +default='', +) coreconfigitem('commands', 'status.verbose', default=False, ) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4809,6 +4809,8 @@ service = server.createservice(ui, repo, opts) return server.runservice(opts, initfn=service.init, runfn=service.run) +_NOTTERSE = 'nothing' + @command('^status|st', [('A', 'all', None, _('show status of all files')), ('m', 'modified', None, _('show only modified files')), @@ -4819,7 +4821,7 @@ ('u', 'unknown', None, _('show only unknown (not tracked) files')), ('i', 'ignored', None, _('show only ignored files')), ('n', 'no-status', None, _('hide status prefix')), -('t', 'terse', '', _('show the terse output (EXPERIMENTAL)')), +('t', 'terse', _NOTTERSE, _('show the terse output (EXPERIMENTAL)')), ('C', 'copies', None, _('show source of copied files')), ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), ('', 'rev', [], _('show difference from revision'), _('REV')), @@ -4917,6 +4919,11 @@ revs = opts.get('rev') change = opts.get('change') terse = opts.get('terse') +if terse is _NOTTERSE: +if revs: +terse = '' +else: +terse = ui.config('commands', 'status.terse') if revs and change: msg = _('cannot specify --rev and --change at the same time') To: durin42, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3628: status: add default of --terse=u to tweakdefaults (BC)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6acf41bb8d40: status: add default of --terse=u to tweakdefaults (BC) (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3628?vs=8836=8848 REVISION DETAIL https://phab.mercurial-scm.org/D3628 AFFECTED FILES mercurial/ui.py tests/test-status.t CHANGE DETAILS diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -109,11 +109,8 @@ tweaking defaults works $ hg status --cwd a --config ui.tweakdefaults=yes - ? 1/in_a_1 - ? in_a - ? ../b/1/in_b_1 - ? ../b/2/in_b_2 - ? ../b/in_b + ? . + ? ../b/ ? ../in_root $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes ? a/1/in_a_1 (glob) @@ -123,11 +120,8 @@ ? b/in_b (glob) ? in_root $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config ui.tweakdefaults=yes - ? 1/in_a_1 (glob) - ? in_a - ? ../b/1/in_b_1 (glob) - ? ../b/2/in_b_2 (glob) - ? ../b/in_b (glob) + ? . + ? ../b/ ? ../in_root (glob) relative paths can be requested @@ -157,11 +151,8 @@ > status.relative = False > EOF $ hg status --cwd a --config ui.tweakdefaults=yes - ? a/1/in_a_1 - ? a/in_a - ? b/1/in_b_1 - ? b/2/in_b_2 - ? b/in_b + ? a/ + ? b/ ? in_root $ cd .. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -66,6 +66,8 @@ update.check = noconflict # Show conflicts information in `hg status` status.verbose = True +# Collapse entire directories that contain only unknown files +status.terse = u [diff] git = 1 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
D3627: status: add a config knob for setting default of --terse
pulkit accepted this revision. pulkit added a comment. > I'm very unhappy with how the default value for --terse looks rigt > now, but it does *work*. The alternative would be to define an > "optional string" flag type using fancyopts.customopt and then use > that, leaving the default as None. Does anyone have a strong > preference for that, or a better idea? I am fine with the current approach. Queued the series, many thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3627 To: durin42, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
pulkit added a comment. In https://phab.mercurial-scm.org/D2409#56200, @khanchi97 wrote: > In https://phab.mercurial-scm.org/D2409#44682, @pulkit wrote: > > > In https://phab.mercurial-scm.org/D2409#43891, @khanchi97 wrote: > > > > > pulkit: Can you please review it? I have made the requested changes. > > > > > > I am sorry but I will like this to wait before we land the new state format thing. I don't want to put more information in old state files which don't have good format. But yes, if someone else feels we can go with this, I am fine with that too. > > > @pulkit do we have new state format pushed in? Not yet. I have started reiterating over the series and hopefully we will be in a state to take this patch in few weeks or maybe a month. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
pulkit added a comment. > `hg close-branch` allows closing arbitrary heads. It is equivalent to > checking out the given revisions and commit an empty change with > `hg commit --close-branch`. I am -1 on having a new command for this. How about adding this as a `--close` flag to `hg branch` command? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3187: phase: add dry-run functionality
pulkit added inline comments. INLINE COMMENTS > commands.py:3898 > if newdata[cl.rev(n)] < targetphase] > +if opts['dry_run']: > +rejected = [] Since all the logic is copy-pasted from phases.advanceboundary and phases.retractboundary, why not we just pass the `--dry-run` option there and get the count from those functions only. > test-phases.t:990 > + $ hg phase --draft 0 5 --force -n > + phase changed for 4 changesets > + This is not very much helpful. In such cases, how about showing the range of changesets, something like: f7b1eb17ad24::925d80f479bb public -> draft b385d13d5ed4::fdc0253c25cf secret -> draft REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3187 To: khanchi97, pulkit, #hg-reviewers Cc: av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3638: py3: add 3 new passing tests to whitelist
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We ave crossed the 500 mark! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3638 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 @@ -372,6 +372,7 @@ test-push-checkheads-unpushed-D7.t test-push-http.t test-push-warn.t +test-push.t test-pushvars.t test-rebase-abort.t test-rebase-base-flag.t @@ -438,11 +439,13 @@ test-simplemerge.py test-single-head.t test-sparse-clear.t +test-sparse-clone.t test-sparse-import.t test-sparse-merges.t test-sparse-profiles.t test-sparse-requirement.t test-sparse-verbose-json.t +test-sparse.t test-split.t test-ssh-clone-r.t test-ssh-proto.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3635: py3: add support for NoneType in stringutil.pprint()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY There are some places in codebase where we try to print the value None, however `'%s' % None` is invalid on Python 3. So it will be good to have support in stringutil.pprint() REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3635 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -29,6 +29,8 @@ if bprefix: return "b'%s'" % escapestr(o) return "'%s'" % escapestr(o) +elif o is None: +return 'None' elif isinstance(o, bytearray): # codecs.escape_encode() can't handle bytearray, so escapestr fails # without coercion. To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3636: py3: use pycompat.fsencode() to convert user value to bytes
pulkit 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/D3636 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 @@ -1400,7 +1400,7 @@ try: st = vfs.lstat(name) age = now - st[stat.ST_MTIME] -user = util.username(st.st_uid) +user = pycompat.fsencode(util.username(st.st_uid)) locker = vfs.readlock(name) if ":" in locker: host, pid = locker.split(':') To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3637: py3: add b'' prefixes in tests/test-revset2.t
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3637 AFFECTED FILES tests/test-revset2.t CHANGE DETAILS diff --git a/tests/test-revset2.t b/tests/test-revset2.t --- a/tests/test-revset2.t +++ b/tests/test-revset2.t @@ -1589,11 +1589,11 @@ > > revsetpredicate = registrar.revsetpredicate() > - > @revsetpredicate('custom1()') + > @revsetpredicate(b'custom1()') > def custom1(repo, subset, x): > return revset.baseset([1]) > - > raise error.Abort('intentional failure of loading extension') + > raise error.Abort(b'intentional failure of loading extension') > EOF $ cat < .hg/hgrc > [extensions] @@ -1611,14 +1611,14 @@ > from mercurial import encoding, registrar > cmdtable = {} > command = registrar.command(cmdtable) - > @command('printprevset') + > @command(b'printprevset') > def printprevset(ui, repo): > alias = {} - > p = encoding.environ.get('P') + > p = encoding.environ.get(b'P') > if p: - > alias['P'] = p - > revs = repo.anyrevs(['P'], user=True, localalias=alias) - > ui.write('P=%r\n' % list(revs)) + > alias[b'P'] = p + > revs = repo.anyrevs([b'P'], user=True, localalias=alias) + > ui.write(b'P=%r\n' % list(revs)) > EOF $ cat >> .hg/hgrc
D3634: py3: add r'' prefixes to fix kwargs handling in hgext/sparse.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This fixes two of sparse tests which were failing on Python 3. 1. skip-blame because just r'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3634 AFFECTED FILES hgext/sparse.py CHANGE DETAILS diff --git a/hgext/sparse.py b/hgext/sparse.py --- a/hgext/sparse.py +++ b/hgext/sparse.py @@ -138,9 +138,9 @@ extensions.wrapfunction(logcmdutil, '_initialrevs', _initialrevs) def _clonesparsecmd(orig, ui, repo, *args, **opts): -include_pat = opts.get('include') -exclude_pat = opts.get('exclude') -enableprofile_pat = opts.get('enable_profile') +include_pat = opts.get(r'include') +exclude_pat = opts.get(r'exclude') +enableprofile_pat = opts.get(r'enable_profile') include = exclude = enableprofile = False if include_pat: pat = include_pat @@ -178,7 +178,7 @@ 'also include directories of added files in sparse config')) def _add(orig, ui, repo, *pats, **opts): -if opts.get('sparse'): +if opts.get(r'sparse'): dirs = set() for pat in pats: dirname, basename = util.split(pat) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3633: py3: use bytes in tests/printenv.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch add b'' prefixes and adds some .encode() calls to convert str to bytes on Python 3. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3633 AFFECTED FILES tests/printenv.py CHANGE DETAILS diff --git a/tests/printenv.py b/tests/printenv.py --- a/tests/printenv.py +++ b/tests/printenv.py @@ -39,14 +39,15 @@ if k.startswith("HG_") and v] env.sort() -out.write("%s hook: " % name) +out.write(b"%s hook: " % name.encode('ascii')) if os.name == 'nt': filter = lambda x: x.replace('\\', '/') else: filter = lambda x: x -vars = ["%s=%s" % (k, filter(v)) for k, v in env] -out.write(" ".join(vars)) -out.write("\n") +vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii')) +for k, v in env] +out.write(b" ".join(vars)) +out.write(b"\n") out.close() sys.exit(exitcode) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3632: py3: use stringutil.pprint() to prevent b'' prefixes in output
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch uses stringutil.pprint to print a list with bytes in it to prevent the b'' prefixes in the output. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3632 AFFECTED FILES mercurial/dispatch.py CHANGE DETAILS diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -288,8 +288,8 @@ req.args[2] != 'serve' or req.args[3] != '--stdio'): raise error.Abort( -_('potentially unsafe serve --stdio invocation: %r') % -(req.args,)) +_('potentially unsafe serve --stdio invocation: %s') % +(stringutil.pprint(req.args),)) try: debugger = 'pdb' To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3631: py3: use pycompat.fsencode to convert path to bytes
pulkit 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/D3631 AFFECTED FILES contrib/hg-ssh CHANGE DETAILS diff --git a/contrib/hg-ssh b/contrib/hg-ssh --- a/contrib/hg-ssh +++ b/contrib/hg-ssh @@ -39,6 +39,7 @@ from mercurial import ( dispatch, +pycompat, ui as uimod, ) @@ -69,7 +70,7 @@ path = cmdargv[2] repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) if repo in allowed_paths: -cmd = [b'-R', repo, b'serve', b'--stdio'] +cmd = [b'-R', pycompat.fsencode(repo), b'serve', b'--stdio'] req = dispatch.request(cmd) if readonly: if not req.ui: To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3630: py3: add b'' prefixes in tests/test-ssh.t and tests/test-ssh-bundle1.t
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3630 AFFECTED FILES tests/test-ssh-bundle1.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 @@ -457,12 +457,12 @@ > > def wrappedpush(orig, repo, *args, **kwargs): > res = orig(repo, *args, **kwargs) - > repo.ui.write('local stdout\n') + > repo.ui.write(b'local stdout\n') > repo.ui.flush() > return res > > def extsetup(ui): - > extensions.wrapfunction(exchange, 'push', wrappedpush) + > extensions.wrapfunction(exchange, b'push', wrappedpush) > EOF $ cat >> .hg/hgrc << EOF @@ -572,7 +572,7 @@ $ cat > $TESTTMP/failhook << EOF > def hook(ui, repo, **kwargs): - > ui.write('hook failure!\n') + > ui.write(b'hook failure!\n') > ui.flush() > return 1 > EOF diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -444,11 +444,11 @@ > > def wrappedpush(orig, repo, *args, **kwargs): > res = orig(repo, *args, **kwargs) - > repo.ui.write('local stdout\n') + > repo.ui.write(b'local stdout\n') > return res > > def extsetup(ui): - > extensions.wrapfunction(exchange, 'push', wrappedpush) + > extensions.wrapfunction(exchange, b'push', wrappedpush) > EOF $ cat >> .hg/hgrc << EOF @@ -537,7 +537,7 @@ $ cat > $TESTTMP/failhook << EOF > def hook(ui, repo, **kwargs): - > ui.write('hook failure!\n') + > ui.write(b'hook failure!\n') > ui.flush() > return 1 > EOF To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3629: py3: add b'' prefixes in contrib/hg-ssh
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3629 AFFECTED FILES contrib/hg-ssh CHANGE DETAILS diff --git a/contrib/hg-ssh b/contrib/hg-ssh --- a/contrib/hg-ssh +++ b/contrib/hg-ssh @@ -69,15 +69,15 @@ path = cmdargv[2] repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) if repo in allowed_paths: -cmd = ['-R', repo, 'serve', '--stdio'] +cmd = [b'-R', repo, b'serve', b'--stdio'] req = dispatch.request(cmd) if readonly: if not req.ui: req.ui = uimod.ui.load() -req.ui.setconfig('hooks', 'pretxnopen.hg-ssh', - 'python:__main__.rejectpush', 'hg-ssh') -req.ui.setconfig('hooks', 'prepushkey.hg-ssh', - 'python:__main__.rejectpush', 'hg-ssh') +req.ui.setconfig(b'hooks', b'pretxnopen.hg-ssh', + b'python:__main__.rejectpush', b'hg-ssh') +req.ui.setconfig(b'hooks', b'prepushkey.hg-ssh', + b'python:__main__.rejectpush', b'hg-ssh') dispatch.dispatch(req) else: sys.stderr.write('Illegal repository "%s"\n' % repo) @@ -87,7 +87,7 @@ sys.exit(255) def rejectpush(ui, **kwargs): -ui.warn(("Permission denied\n")) +ui.warn((b"Permission denied\n")) # mercurial hooks use unix process conventions for hook return values # so a truthy return means failure return True To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2721: util: observable proxy objects for sockets
pulkit added inline comments. INLINE COMMENTS > util.py:1014 > + > +def setsockopt(self, level, optname, value): > +if not self.states: While debugging the test failure on Python 3.6, the caller at line 751 can pass 5 positional arguments. Here is the traceback after running test-wireproto-command-branchmap.t: + ** Unknown exception encountered with possibly-broken third-party extension drawdag + ** which supports versions unknown of Mercurial. + ** Please disable drawdag and try your action again. + ** If that fixes the bug please report it to the extension author. + ** Python 3.6.5 (default, Mar 29 2018, 03:28:50) [GCC 5.4.0 20160609] + ** Mercurial Distributed SCM (version 4.6+251-5a87bf0bd343) + ** Extensions loaded: drawdag + Traceback (most recent call last): +File "/tmp/hgtests.esettwc6/install/bin/hg", line 41, in + dispatch.run() +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 90, in run + status = dispatch(req) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 213, in dispatch + ret = _runcatch(req) or 0 +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 354, in _runcatch + return _callcatch(ui, _runcatchfunc) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 362, in _callcatch + return scmutil.callcatch(ui, func) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/scmutil.py", line 161, in callcatch + return func() +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 344, in _runcatchfunc + return _dispatch(req) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 974, in _dispatch + cmdpats, cmdoptions) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 730, in runcommand + ret = _runcommand(ui, options, cmd, d) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 982, in _runcommand + return cmdfunc() +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/dispatch.py", line 971, in + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/util.py", line 1550, in check + return func(*args, **kwargs) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/debugcommands.py", line 2932, in debugwireproto + peer = httppeer.makepeer(ui, path, opener=opener) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/httppeer.py", line 951, in makepeer + respurl, info = performhandshake(ui, url, opener, requestbuilder) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/httppeer.py", line 871, in performhandshake + resp = sendrequest(ui, opener, req) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/httppeer.py", line 311, in sendrequest + res = opener.open(req) +File "/usr/lib/python3.6/urllib/request.py", line 526, in open + response = self._open(req, data) +File "/usr/lib/python3.6/urllib/request.py", line 544, in _open + '_open', req) +File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain + result = func(*args) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/url.py", line 331, in http_open + return self.do_open(self._makeconnection, req) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/keepalive.py", line 240, in do_open + self._start_transaction(h, req) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/url.py", line 301, in _start_transaction + return keepalive.HTTPHandler._start_transaction(self, h, req) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/keepalive.py", line 343, in _start_transaction + h.endheaders() +File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders + self._send_output(message_body, encode_chunked=encode_chunked) +File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output + self.send(msg) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/keepalive.py", line 563, in safesend + self.connect() +File "/usr/lib/python3.6/http/client.py", line 937, in connect + self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/util.py", line 738, in setsockopt + r'setsockopt', *args, **kwargs) +File "/tmp/hgtests.esettwc6/install/lib/python/mercurial/util.py", line 679, in _observedcall + fn(res, *args, **kwargs) + TypeError: setsockopt() takes 4 positional arguments but 5 were given + [1] I am not sure whether this exact code path is tested on Python 2 or not. Can you have a look? REPOSITORY rHG Mercurial
D2721: util: observable proxy objects for sockets
pulkit added inline comments. INLINE COMMENTS > util.py:1019 > +self.fh.write('%s> setsockopt(%r, %r, %r) -> %r\n' % ( > +self.name, level, optname, value)) > + If I am understanding this correctly, this can lead to `TypeError: not enough arguments for format string` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2721 To: indygreg, #hg-reviewers, durin42 Cc: pulkit, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel