Re: An extension to log through standard logging module
On Thu, Jul 18, 2019 at 11:16 AM Augie Fackler wrote: > > > > On Jul 16, 2019, at 13:27, Georges Racinet > wrote: > > > > Hi there, > > > > for the needs of Heptapod [1], I ended up writing a small extension to > > divert all possible console output to the standard logging module, with > > the option to send the logs to a Sentry application. > > > > The source is at https://dev.heptapod.net/heptapod/hgext-loggingmod and > > its README provides a fairly complete documentation. > > > > I think this extension would be useful in many more general server > > settings, and should therefore probably be versioned with hg-core. Some > > polishing would have to be made to bring it up to standard, and I'd be > > happy to do that if people are interested. > > > > A short rationale: > > > > - blackbox only registers to `ui.log`, which itself doesn't have much, > > unless `ui.debug` is True [2]. Also, it insists on outputting the logs > > into the `.hg` directory, and that's pretty much useless for a multi > > repo server > > > > - logtoprocess also registers to `ui.log`. > > > > - I wanted to make it easy to use Sentry, especially since GitLab has an > > option to send its logs to Sentry by default, unsurprisingly covering > > everything but Mercurial > > > > - I wanted to make it easily configurable, and to provide repository > > information to use in the format. Together with the PID, that makes it > > possible to extract only log lines pertaining to a given request. > > > > What do you think ? > > I think it makes sense. Kyle, I think we might want this for some of our > hg API servers too? Having it in core seems sensible to me. > Having it in core seems fine to me. I can see possible ways we can use it, yes :) > > > Cheers, > > > > [1] That is, our modified GitLab CE that supports Mercurial > > > > [2] with `ui.debug` set to True, some of that debugging info actually > > spills into the HTTP responses, making them incorrect. > > > > > > -- > > Georges Racinet > > https://octobus.net > > GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics > > > > > > ___ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > -- --Kyle Note: If I've asked a question, and you're responding to me, please use *respond all*, so that other people can read any solutions we come to! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] color: issue warning in yellow
Bright/bold yellow should be considered unavailable. "Normal" yellow, which is closer to brown or maybe gold on many screens, is fine. At Google, and I think other tools like clang, generally use magenta I believe, but I have no strong preference. Keep in mind that ui.prompt is also yellow a couple lines below. On Mon, Aug 20, 2018, 06:22 Martin von Zweigbergk wrote: > I think most of us would be happy with this, but I seem to remember Kyle > always saying that it will be unreadable for users who use white background. > > On Aug 20, 2018 01:04, "Boris Feld" wrote: > > # HG changeset patch > # User Boris Feld > # Date 1534290303 -7200 > # Wed Aug 15 01:45:03 2018 +0200 > # Node ID 4144148d7aba13ece916c6f735c791ca3d93a249 > # Parent c62184c6299c09d2e8e7be340f9aee138229cb86 > # EXP-Topic color-warning > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 4144148d7aba > color: issue warning in yellow > > Using a different color for warning/error output help them to stand out and > attract user attention. At Octobus we have been using this setting for > years > with good result. > > Now that `ui.error` are colored in red, it seems reasonable to color all > other > error output in yellow. > > diff --git a/mercurial/color.py b/mercurial/color.py > --- a/mercurial/color.py > +++ b/mercurial/color.py > @@ -119,6 +119,7 @@ except ImportError: > 'formatvariant.config.default': 'green', > 'formatvariant.default': '', > 'histedit.remaining': 'red bold', > +'ui.warning': 'yellow', > 'ui.error': 'red', > 'ui.prompt': 'yellow', > 'log.changeset': 'yellow', > diff --git a/tests/test-pager.t b/tests/test-pager.t > --- a/tests/test-pager.t > +++ b/tests/test-pager.t > @@ -199,7 +199,7 @@ even though stdout is no longer a tty. > An invalid pager command name is reported sensibly if we don't have to > use shell=True in the subprocess call: >$ hg log --limit 3 --config pager.pager=this-command-better-never-exist > - missing pager command 'this-command-better-never-exist', skipping pager > + \x1b[0;33mmissing pager command 'this-command-better-never-exist', > skipping pager\x1b[0m (esc) >\x1b[0;33mchangeset: 10:46106edeeb38\x1b[0m (esc) >tag: tip >user:test > diff --git a/tests/test-status-color.t b/tests/test-status-color.t > --- a/tests/test-status-color.t > +++ b/tests/test-status-color.t > @@ -204,7 +204,7 @@ hg status: > hg status modified added removed deleted unknown never-existed ignored: > >$ hg status modified added removed deleted unknown never-existed ignored > - never-existed: * (glob) > + \x1b[0;33mnever-existed: $ENOENT$\x1b[0m (esc) >\x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) >\x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc) >\x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc) > @@ -310,9 +310,9 @@ check 'status -q' and some combinations > test unknown color > >$ hg --config color.status.modified=periwinkle status > - ignoring unknown color/effect 'periwinkle' (configured in > color.status.modified) > - ignoring unknown color/effect 'periwinkle' (configured in > color.status.modified) > - ignoring unknown color/effect 'periwinkle' (configured in > color.status.modified) > + \x1b[0;33mignoring unknown color/effect 'periwinkle' (configured in > color.status.modified)\x1b[0m (esc) > + \x1b[0;33mignoring unknown color/effect 'periwinkle' (configured in > color.status.modified)\x1b[0m (esc) > + \x1b[0;33mignoring unknown color/effect 'periwinkle' (configured in > color.status.modified)\x1b[0m (esc) >M modified >\x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc) >\x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc) > @@ -376,8 +376,8 @@ test 'resolve -l' >$ hg merge >merging a >merging b > - warning: conflicts while merging a! (edit, then use 'hg resolve --mark') > - warning: conflicts while merging b! (edit, then use 'hg resolve --mark') > + \x1b[0;33mwarning: conflicts while merging a! (edit, then use 'hg > resolve --mark')\x1b[0m (esc) > + \x1b[0;33mwarning: conflicts while merging b! (edit, then use 'hg > resolve --mark')\x1b[0m (esc) >0 files updated, 0 files merged, 0 files removed, 2 files unresolved >use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' > to abandon >[1] > ___ > 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 STABLE] hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698)
Add the test name to the end (`run-tests.py test-foo.t`) On Mon, Jun 25, 2018, 23:12 Thomas Klausner wrote: > On Mon, Jun 25, 2018 at 09:28:04AM -0400, Augie Fackler wrote: > > # HG changeset patch > > # User Augie Fackler > > # Date 1529932907 14400 > > # Mon Jun 25 09:21:47 2018 -0400 > > # Branch stable > > # Node ID 348d58daa074a5395eb483816c74c31190892d5f > > # Parent 1322ae04d3d71c9bab8ca6e70c77dfa867421c9b > > hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698) > > > > test-status-color.t fails with different output because of mismatches > > between how `tic` behaves from NetBSD's base system and ncurses' > > verison (if I understand the bug right). The bug suggested using -V to > > avoid the issue, so we'll do that. > > I've tried applying the patch to 4.6.1, but the test still fails the > same way. > > The 'tic -V' output on NetBSD goes to stderr (not stdout), could that > be the reason? > > Btw, how do I run a single test manually? > > Thanks, > Thomas > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH STABLE] hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698)
Looks good to me, though I don't have a NetBSD system to test. :) On Mon, Jun 25, 2018 at 6:28 AM, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler > # Date 1529932907 14400 > # Mon Jun 25 09:21:47 2018 -0400 > # Branch stable > # Node ID 348d58daa074a5395eb483816c74c31190892d5f > # Parent 1322ae04d3d71c9bab8ca6e70c77dfa867421c9b > hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698) > > test-status-color.t fails with different output because of mismatches > between how `tic` behaves from NetBSD's base system and ncurses' > verison (if I understand the bug right). The bug suggested using -V to > avoid the issue, so we'll do that. > > diff --git a/tests/hghave.py b/tests/hghave.py > --- a/tests/hghave.py > +++ b/tests/hghave.py > @@ -545,7 +545,11 @@ def has_tic(): > try: > import curses > curses.COLOR_BLUE > -return matchoutput('test -x "`which tic`"', br'') > +if not matchoutput('test -x "`which tic`"', br''): > +return False > +# We have a tic, but make sure it's not the NetBSD system one > +# which doesn't pass test-status-color.t. > +return not matchoutput('tic -V', br'unknown option') > except ImportError: > return False > > -- --Kyle Note: If I've asked a question, and you're responding to me, please use *respond all*, so that other people can read any solutions we come to! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] evolve: do not exit 1 when there are no troubled changesets (issue5823)
# HG changeset patch # User Kyle Lippincott # Date 1522353665 25200 # Thu Mar 29 13:01:05 2018 -0700 # Node ID 1607ec1973108d156e41aa75db6fc571fa99c0ac # Parent 9ad461df4d4d1696fe15086f6afea9cebb24a617 evolve: do not exit 1 when there are no troubled changesets (issue5823) There are possibly other cases we also do not wish to exit non-zero for in this function, but I did not analyze them closely and am just looking at resolving issue5823. diff --git a/hgext3rd/evolve/evolvecmd.py b/hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py +++ b/hgext3rd/evolve/evolvecmd.py @@ -718,6 +718,7 @@ def _handlenotrouble(ui, repo, allopt, r unselectedcategories = [c for c in troublecategories if c != targetcat] msg = None hint = None +retoverride = None troubled = { "orphan": repo.revs("orphan()"), @@ -804,14 +805,20 @@ def _handlenotrouble(ui, repo, allopt, r hint = hintmap['any+' + ('+'.join(othertroubles))] else: msg = _("no troubled changesets") +# Exit with a 0 (success) status in this case. +retoverride = 0 assert msg is not None ui.write_err("%s\n" % msg) if hint: ui.write_err("(%s)\n" % hint) -return 2 +ret = 2 else: -return 1 +ret = 1 + +if retoverride is not None: +return retoverride +return ret def _preparelistctxs(items, condition): return [item.hex() for item in items if condition(item)] diff --git a/tests/test-stabilize-order.t b/tests/test-stabilize-order.t --- a/tests/test-stabilize-order.t +++ b/tests/test-stabilize-order.t @@ -129,7 +129,6 @@ Test stabilizing a descendant predecesso $ hg evolve -v no troubled changesets - [1] Test behavior with --any ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 evolve-ext V2] help: remove a few commands from `hg` (no args) command list
# HG changeset patch # User Kyle Lippincott # Date 1512518930 28800 # Tue Dec 05 16:08:50 2017 -0800 # Node ID 21abe1e218b87428e4249e67990c345c63d521f6 # Parent 28fb347a5bf8cce93ebdfd0cc64a818e335804f9 help: remove a few commands from `hg` (no args) command list According to `hg help -e evolve`, the following commands come from the evolve extension: amend evolve fold metaedit next obslog pdiff previous prune pstatus split touch uncommit If one runs `hg` without arguments, commands that are prefixed with a ^ character are shown. From the previous list, this includes: evolve fold metaedit next previous prune split touch uncommit It feels several of these commands are not "basic commands" that someone who has never used hg before might care about. They probably also do not come close to passing the "toothbrush test": things that users are likely to use every day. This commit removes these items from the list: metaedit, touch, uncommit This means the following are kept: evolve fold next previous prune split diff --git a/hgext3rd/evolve/cmdrewrite.py b/hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py +++ b/hgext3rd/evolve/cmdrewrite.py @@ -298,7 +298,7 @@ ds.copy(src, dst) @eh.command( -'^uncommit', +'uncommit', [('a', 'all', None, _('uncommit all changes when no arguments given')), ('i', 'interactive', False, _('interactive mode to uncommit (EXPERIMENTAL)')), ('r', 'rev', '', _('revert commit content to REV instead')), @@ -617,7 +617,7 @@ lockmod.release(lock, wlock) @eh.command( -'^metaedit', +'metaedit', [('r', 'rev', [], _("revision to edit")), ('', 'fold', None, _("also fold specified revisions into one")), ('n', 'note', '', _('store a note on metaedit')), @@ -1037,7 +1037,7 @@ lockmod.release(tr, lock, wlock) @eh.command( -'^touch', +'touch', [('r', 'rev', [], 'revision to update'), ('n', 'note', '', _('store a note on touch')), ('D', 'duplicate', False, ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 evolve-ext V2] help: fix output for `hg help -e evolve` wrt 'touch' command
# HG changeset patch # User Kyle Lippincott # Date 1512519068 28800 # Tue Dec 05 16:11:08 2017 -0800 # Node ID d584dfa21ea0bfa8a0fde0800978e8e682fa7544 # Parent 21abe1e218b87428e4249e67990c345c63d521f6 help: fix output for `hg help -e evolve` wrt 'touch' command Currently, when running `hg help -e evolve`, the output looks like this on my screen: touch create successors that are identical to their predecessors except With this change, it looks like this: touch create successors that are identical to their predecessors except for the changeset ID diff --git a/hgext3rd/evolve/cmdrewrite.py b/hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py +++ b/hgext3rd/evolve/cmdrewrite.py @@ -1048,8 +1048,9 @@ # allow to choose the seed ? _('[-r] revs')) def touch(ui, repo, *revs, **opts): -"""create successors that are identical to their predecessors except -for the changeset ID +# Do not split this next line to fit into 80 cols, it is displayed when +# running `hg` with no arguments! +"""create successors that are identical to their predecessors except for the changeset ID This is used to "resurrect" changesets """ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH evolve-ext] help: fix output for `hg help -e evolve` wrt 'touch' command
# HG changeset patch # User Kyle Lippincott # Date 1512519068 28800 # Tue Dec 05 16:11:08 2017 -0800 # Node ID d584dfa21ea0bfa8a0fde0800978e8e682fa7544 # Parent 21abe1e218b87428e4249e67990c345c63d521f6 help: fix output for `hg help -e evolve` wrt 'touch' command Currently, when running `hg help -e evolve`, the output looks like this on my screen: touch create successors that are identical to their predecessors except With this change, it looks like this: touch create successors that are identical to their predecessors except for the changeset ID diff --git a/hgext3rd/evolve/cmdrewrite.py b/hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py +++ b/hgext3rd/evolve/cmdrewrite.py @@ -1048,8 +1048,9 @@ # allow to choose the seed ? _('[-r] revs')) def touch(ui, repo, *revs, **opts): -"""create successors that are identical to their predecessors except -for the changeset ID +# Do not split this next line to fit into 80 cols, it is displayed when +# running `hg` with no arguments! +"""create successors that are identical to their predecessors except for the changeset ID This is used to "resurrect" changesets """ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH evolve-ext] typos: fix typos in several locations
# HG changeset patch # User Kyle Lippincott # Date 1512426447 28800 # Mon Dec 04 14:27:27 2017 -0800 # Node ID c7efdd5d0edec14d00538cf2487a005cc7c3cbb3 # Parent adbae782aac7387d35781816cb015c8d6b845329 typos: fix typos in several locations A user at Google attempted to fix our local copy because they had noticed a typo (accross instead of across), but this will just get overwritten on our next import. This commit fixes that case and a few others that my editor found. Most of the typos were in comments, but user-visible output is changed in a few cases: - accross -> across - splitted -> split - ambigious -> ambiguous - evolvestte -> evolvestate (this is in a ui.debug, so not often seen) There is another typo that I wanted to fix, but didn't: 'supercede' is spelled 'superseed' in a few locations. I believe this is only internal to the extension, instead of being user-visible, so while it could probably be fixed easily, I wasn't 100% sure it didn't end up in a file on disk or something and might cause problems, so I left it alone. diff --git a/hgext3rd/evolve/__init__.py b/hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py +++ b/hgext3rd/evolve/__init__.py @@ -58,10 +58,10 @@ is already raising better results than the previous version (when usable). "Large" repositories (hundreds of thousand) are currently unsupported. Some key -algorithm has a naive implementation with too agressive caching, creating +algorithm has a naive implementation with too aggressive caching, creating memory consumption issue (this will get fixed). -Medium sized repositories works fine, but be prepared for a noticable initial +Medium sized repositories works fine, but be prepared for a noticeable initial cache filling. for the Mercurial repository, this is around 20 seconds The following config control the experiment:: @@ -97,7 +97,7 @@ # automatically disable obshashrange related computation and capabilities # if the repository has more than N revisions. This is meant to help large -# server deployement to enable the feature on smaller repositories while +# server deployment to enable the feature on smaller repositories while # ensuring no large repository will get affected. obshashrange.max-revs = 10 # default is None @@ -159,12 +159,12 @@ - precursors, for each obsolete changeset show the closest visible precursors. - - successors, for each obsolete changeset show the closests visible + - successors, for each obsolete changeset show the closest visible successors. It is useful when your working directory is obsolete to see what are its successors. This information can also be retrieved with the obslog command and the --all option. - obsfate, for each obsolete changeset display a line summarizing what -changed between the changeset and its successors. Dependending on the +changed between the changeset and its successors. Depending on the verbosity level (-q and -v) it display the changeset successors, the users that created the obsmarkers and the date range of these changes. @@ -1452,8 +1452,8 @@ Automatic mode only handles common use cases. For example, it avoids taking action in the case of ambiguity, and it ignores unstable changesets that are not related to your working copy. -It also refuses to solve bumped or divergent changesets unless you explicity -request such behavior (see below). +It also refuses to solve bumped or divergent changesets unless you +explicitly request such behavior (see below). Eliminating all instability around your working copy may require multiple invocations of :hg:`evolve`. Alternately, use ``--all`` to recursively @@ -1719,7 +1719,7 @@ roots = repo.revs('roots(%ld)', targetrevs) heads = repo.revs('heads(%ld)', targetrevs) if len(roots) > 1 or len(heads) > 1: -msg = "cannot solve split accross two branches\n" +msg = "cannot solve split across two branches\n" ui.write_err(msg) return 2 target = repo[heads.first()] @@ -1869,7 +1869,7 @@ base, others = divergentdata(divergent) if len(others) > 1: othersstr = "[%s]" % (','.join([str(i) for i in others])) -msg = _("skipping %d:divergent with a changeset that got splitted" +msg = _("skipping %d:divergent with a changeset that got split" " into multiple ones:\n" "|[%s]\n" "| This is not handled by automatic evolution yet\n" @@ -2172,7 +2172,7 @@ displayer.show(c) result = 0 elif children: -ui.warn(_("ambigious next changeset:\n")) +ui.warn(_("ambiguous next changeset:\n")) for c in children: displayer.show(c) ui.warn(_('explicitly update to one of them\n')) @@ -2196,7 +2196,7 @@ ui.warn(msg % len(aspc
[PATCH evolve-ext] evolve: fix typo: -list -> --list
# HG changeset patch # User Kyle Lippincott # Date 1496787013 25200 # Tue Jun 06 15:10:13 2017 -0700 # Node ID ff53569086ad8e729e2c43346a27c91efcefceca # Parent 3e62042a6bb76c01c71685e24b8900b8c502c598 evolve: fix typo: -list -> --list diff --git a/hgext3rd/evolve/__init__.py b/hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py +++ b/hgext3rd/evolve/__init__.py @@ -576,7 +576,7 @@ if reason == 'pruned': solvemsg = _("use 'hg evolve' to update to its parent successor") elif reason == 'diverged': -debugcommand = "hg evolve -list --divergent" +debugcommand = "hg evolve --list --divergent" basemsg = _("%s has diverged, use '%s' to resolve the issue") solvemsg = basemsg % (shortnode, debugcommand) elif reason == 'superseed': diff --git a/tests/test-evolve-obshistory.t b/tests/test-evolve-obshistory.t --- a/tests/test-evolve-obshistory.t +++ b/tests/test-evolve-obshistory.t @@ -1035,7 +1035,7 @@ $ hg update --hidden 'desc(A0)' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (471f378eab4c) - (471f378eab4c has diverged, use 'hg evolve -list --divergent' to resolve the issue) + (471f378eab4c has diverged, use 'hg evolve --list --divergent' to resolve the issue) Test output with amended + folded commit diff --git a/tests/test-evolve-templates.t b/tests/test-evolve-templates.t --- a/tests/test-evolve-templates.t +++ b/tests/test-evolve-templates.t @@ -464,7 +464,7 @@ $ hg up 'desc(A0)' --hidden 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (471f378eab4c) - (471f378eab4c has diverged, use 'hg evolve -list --divergent' to resolve the issue) + (471f378eab4c has diverged, use 'hg evolve --list --divergent' to resolve the issue) Precursors template should show current revision as it is the working copy $ hg tlog diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -705,7 +705,7 @@ $ hg up --hidden 2 1 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory parent is obsolete! (4538525df7e2) - (4538525df7e2 has diverged, use 'hg evolve -list --divergent' to resolve the issue) + (4538525df7e2 has diverged, use 'hg evolve --list --divergent' to resolve the issue) $ hg export 9468a5f5d8b2 | hg import - applying patch from stdin 1 new unstable changesets diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -286,7 +286,7 @@ $ hg up -C 3 --hidden 1 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory parent is obsolete! (5eb72dbe0cb4) - (5eb72dbe0cb4 has diverged, use 'hg evolve -list --divergent' to resolve the issue) + (5eb72dbe0cb4 has diverged, use 'hg evolve --list --divergent' to resolve the issue) $ hg --config extensions.purge= purge $ hg uncommit --all -X e 1 new divergent changesets ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] keepalive: set buffering=True to do more efficient reads of headers
# HG changeset patch # User Kyle Lippincott # Date 1496437706 25200 # Fri Jun 02 14:08:26 2017 -0700 # Node ID daeaaad7839bb72ab48a09638ee4f1e8a089ca9d # Parent 80511f08c101eae26b774a9759da271807e4bf0b keepalive: set buffering=True to do more efficient reads of headers Support for buffering was added to python in d09d6fe31b61, first released with python2.7. Without this, the entirety of the response headers is read byte-by-byte (it does more efficient reads when it gets to the non-header part of the response). diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -354,7 +354,8 @@ def __init__(self, sock, debuglevel=0, strict=0, method=None): httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel, - strict=True, method=method) + strict=True, method=method, + buffering=True) self.fileno = sock.fileno self.code = None self._rbuf = '' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] keepalive: pass the correct arguments to HTTPResponse
# HG changeset patch # User Kyle Lippincott # Date 1496366600 25200 # Thu Jun 01 18:23:20 2017 -0700 # Node ID 80511f08c101eae26b774a9759da271807e4bf0b # Parent 5d44d7d4076e5a96001b0f88c730fa7ea24a9e02 keepalive: pass the correct arguments to HTTPResponse python2.7's httplib.HTTPResponse takes the arguments in the following order: sock, debuglevel, strict, method, buffering This was previously passing them in as positional and skipped strict, so we set strict=method. I'm explicitly setting strict=True now to preserve the previous behavior that has been there since this file was created. diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -353,7 +353,8 @@ def __init__(self, sock, debuglevel=0, strict=0, method=None): -httplib.HTTPResponse.__init__(self, sock, debuglevel, method) +httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel, + strict=True, method=method) self.fileno = sock.fileno self.code = None self._rbuf = '' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] zsh_completion: install as _hg not hg
# HG changeset patch # User Kyle Lippincott # Date 1495830247 25200 # Fri May 26 13:24:07 2017 -0700 # Branch stable # Node ID 77fa50376abeb18871edcf69b9a4282067afda0f # Parent f928d53b687cb5738528d2eae97f58da10ca8bae zsh_completion: install as _hg not hg The contrib/zsh_completion file itself says to name it _hg. With a name like `hg`, if the user has a line like `autoload ${^fpath}/*(N-.:t)` in their zshrc, it will create a shell function named `hg` that will hide the actual hg command and make hg unusable. Separately from that though, the underscore prefix makes it actually work. The zsh man page states: The convention for autoloaded functions used in completion is that they start with an underscore This does not seem to just be a "convention", though. With the ill-advised line removed from my zshrc and the file named `/usr/local/share/zsh/site-functions/hg` (without the underscore), these completions did not seem to get loaded and the ones from the zsh installation were loaded instead. If I renamed them to be `/usr/local/share/zsh/site-functions/_hg`, however, they were loaded. I manually tested the above statement by starting a new zsh instance with the file in `/usr/local/share/zsh/site-functions` with the following names: - As `hg`, `which _hg_labels` did not show anything - As `_hg`, `which _hg_labels` showed the expected function. diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -167,7 +167,7 @@ # install zsh completions - this location appears to be # searched by default as of macOS Sierra. install -d build/mercurial/usr/local/share/zsh/site-functions/ - install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/hg + install -m 0644 contrib/zsh_completion build/mercurial/usr/local/share/zsh/site-functions/_hg # install bash completions - there doesn't appear to be a # place that's searched by default for bash, so we'll follow # the lead of Apple's git install and just put it in a ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH v2] debuglabelcomplete: fix to call debugnamecomplete in new location
# HG changeset patch # User Kyle Lippincott # Date 1489522230 25200 # Tue Mar 14 13:10:30 2017 -0700 # Node ID 71dc279eeafbfd9c61aeeec7b8b81148c57d7f4e # Parent b6f5af372c0c047340e3c6bdd27b87207b9cec92 debuglabelcomplete: fix to call debugnamecomplete in new location debugnamecomplete was moved in a9aa67ba from commands to debugcommands, but debuglabelcomplete was not modified to call it in its new location. diff -r b6f5af372c0c -r 71dc279eeafb mercurial/debugcommands.py --- a/mercurial/debugcommands.pySun Mar 12 15:27:02 2017 -0400 +++ b/mercurial/debugcommands.pyTue Mar 14 13:10:30 2017 -0700 @@ -1127,7 +1127,7 @@ @command('debuglabelcomplete', [], _('LABEL...')) def debuglabelcomplete(ui, repo, *args): '''backwards compatibility with old bash completion scripts (DEPRECATED)''' -commands.debugnamecomplete(ui, repo, *args) +debugnamecomplete(ui, repo, *args) @command('debuglocks', [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), diff -r b6f5af372c0c -r 71dc279eeafb tests/test-completion.t --- a/tests/test-completion.t Sun Mar 12 15:27:02 2017 -0400 +++ b/tests/test-completion.t Tue Mar 14 13:10:30 2017 -0700 @@ -358,3 +358,18 @@ fee fie fo + +Test debuglabelcomplete, a deprecated name for debugnamecomplete that is still +used for completions in some shells. + + $ hg debuglabelcomplete + Fum + default + fee + fie + fo + tip + $ hg debuglabelcomplete f + fee + fie + fo ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] debuglabelcomplete: fix to call debugnamecomplete in new location
# HG changeset patch # User Kyle Lippincott # Date 1489522230 25200 # Tue Mar 14 13:10:30 2017 -0700 # Node ID 8148b77193f29b1cd8c4c5b95456eaace6ff6bfc # Parent b6f5af372c0c047340e3c6bdd27b87207b9cec92 debuglabelcomplete: fix to call debugnamecomplete in new location debugnamecomplete was moved in a9aa67ba from commands to debugcommands, but debuglabelcomplete was not modified to call it in its new location. diff -r b6f5af372c0c -r 8148b77193f2 mercurial/debugcommands.py --- a/mercurial/debugcommands.pySun Mar 12 15:27:02 2017 -0400 +++ b/mercurial/debugcommands.pyTue Mar 14 13:10:30 2017 -0700 @@ -1127,7 +1127,7 @@ @command('debuglabelcomplete', [], _('LABEL...')) def debuglabelcomplete(ui, repo, *args): '''backwards compatibility with old bash completion scripts (DEPRECATED)''' -commands.debugnamecomplete(ui, repo, *args) +debugnamecomplete(ui, repo, *args) @command('debuglocks', [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] ui: remove urllib2 from being imported early
# HG changeset patch # User Kyle Lippincott # Date 1486897598 28800 # Sun Feb 12 03:06:38 2017 -0800 # Node ID 1f3234760225170767d10bfcd9cc5b2431b65471 # Parent 72f25e17af9d6a206ea374c30f229ae9513f3f23 ui: remove urllib2 from being imported early Before this change, urllib2 was brought in when constructing the ui object, and that added ~5ms on my Linux workstation to the hg startup time for every command, bringing the time for 'HGRCPATH=/dev/null hg root' from 46ms to 40ms. Now, we construct a single proxy object per initial ui creation (so that if the ui is copied they share the object), but defer the actual instantiation of it and the import of urllib2 until it's needed. diff -r 72f25e17af9d -r 1f3234760225 mercurial/ui.py --- a/mercurial/ui.py Mon Feb 13 02:31:56 2017 -0800 +++ b/mercurial/ui.py Sun Feb 12 03:06:38 2017 -0800 @@ -94,6 +94,24 @@ # pager =""", } + +class httppasswordmgrdbproxy(object): +"""Delays loading urllib2 until it's needed.""" +def __init__(self): +self._mgr = None + +def _get_mgr(self): +if self._mgr is None: +self._mgr = urlreq.httppasswordmgrwithdefaultrealm() +return self._mgr + +def add_password(self, *args, **kwargs): +return self._get_mgr().add_password(*args, **kwargs) + +def find_user_password(self, *args, **kwargs): +return self._get_mgr().find_user_password(*args, **kwargs) + + class ui(object): def __init__(self, src=None): """Create a fresh new ui object if no src given @@ -145,7 +163,7 @@ # shared read-only environment self.environ = encoding.environ -self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm() +self.httppasswordmgrdb = httppasswordmgrdbproxy() allowed = self.configlist('experimental', 'exportableenviron') if '*' in allowed: @@ -172,7 +190,7 @@ """Clear internal state that shouldn't persist across commands""" if self._progbar: self._progbar.resetstate() # reset last-print time of progress bar -self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm() +self.httppasswordmgrdb = httppasswordmgrdbproxy() def formatter(self, topic, opts): return formatter.formatter(self, topic, opts) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] test-bdiff: move import inside the function to avoid test failure
On Mon, Feb 13, 2017 at 2:29 PM, Augie Fackler wrote: > On Tue, Feb 14, 2017 at 01:59:48AM +0530, Pulkit Goyal wrote: > > # HG changeset patch > > # User Pulkit Goyal <7895pul...@gmail.com> > > # Date 1487017336 -19800 > > # Tue Feb 14 01:52:16 2017 +0530 > > # Node ID a099a0633b39efcac1a8c1e018e5bc284f0b00a3 > > # Parent 437f594e299aa68682783223e8fe60da230ee4a1 > > test-bdiff: move import inside the function to avoid test failure > > lgtm, but can one of the people that observed this report back if it > fixes your problem? > Yup, fixes it for me :) > > Thanks! > > > > > test-check-module-imports.t fails on some systems where the path of home > > directories is different than sys.prefix and sys.exec_prefix. > > Importing silenttestrunner will help avoiding that failure. > > > > diff -r 437f594e299a -r a099a0633b39 tests/test-bdiff.py > > --- a/tests/test-bdiff.py Mon Feb 13 22:15:28 2017 +0530 > > +++ b/tests/test-bdiff.py Tue Feb 14 01:52:16 2017 +0530 > > @@ -3,8 +3,6 @@ > > import struct > > import unittest > > > > -import silenttestrunner > > - > > from mercurial import ( > > bdiff, > > mpatch, > > @@ -148,4 +146,5 @@ > > ['a\n', diffreplace(2, 10, 'a\na\na\na\n', > '')]) > > > > if __name__ == '__main__': > > +import silenttestrunner > > silenttestrunner.main(__name__) > > ___ > > 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 5 of 5 v4] changegroup3: enable on 'lfs' repo requirements
On Tue, Nov 29, 2016 at 9:37 AM, Augie Fackler wrote: > On Tue, Nov 29, 2016 at 07:59:11AM +0100, Pierre-Yves David wrote: > > [cc martin because I've a question about some code mentioning > 'treemanifest' > > > > On 11/23/2016 06:39 PM, Remi Chaintron wrote: > > ># HG changeset patch > > ># User Remi Chaintron > > ># Date 1479916365 0 > > ># Wed Nov 23 15:52:45 2016 + > > ># Branch stable > > ># Node ID b421c16161aed491fec20b600df5f1278b07bc1a > > ># Parent 75ee4746c198f039a39400e855e9335afc34f1dd > > >changegroup3: enable on 'lfs' repo requirements > > > > > >`changegroup3` is required by the `lfs` extension in order to send > flags for > > >revlog objects over the wire. > > > > It seems like the commit message needs to be updated too. > > > > >diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py > > >--- a/mercurial/changegroup.py > > >+++ b/mercurial/changegroup.py > > >@@ -879,14 +879,16 @@ > > > # Changegroup versions that can be applied to the repo > > > def supportedincomingversions(repo): > > > versions = allsupportedversions(repo.ui) > > >-if 'treemanifest' in repo.requirements: > > >+if ('treemanifest' in repo.requirements or > > >+'lfs' in repo.requirements): > > > versions.add('03') > > > > I've not seen 'lfs' used anywhere yet so this changeset seems a bit > > premature. Given the code in this series I would expect the next step to > be > > a minimal usage of the new code (either by porting some of censor or by > > using a test extension). Then we can start working on exchanging these > > flagged changesets. > > > > In addition, this piece of code is suspicious. If we have a changelog > '03' > > available, we should be using it. I'm not sure why we only consider it > when > > treemanifest is used. Martin: is this the remain of a period where the > '03' > > format was experimental? Did we actually tested the new format now? Can > we > > drop this special case? > > Martin is on vacation (and you didn't add him to CC?), but we've been > using changegroup3 extensively, and I think we're happy with it. Added > spectral to confirm. > Yes, we've been using changegroup3 internally without issues for a while now. It's required for treemanifests and I'm pretty sure is required by recent versions of narrowhg. I'm fine with freezing it and making it non-experimental. > > > > > > > > return versions > > > > > > # Changegroup versions that can be created from the repo > > > def supportedoutgoingversions(repo): > > > versions = allsupportedversions(repo.ui) > > >-if 'treemanifest' in repo.requirements: > > >+if ('treemanifest' in repo.requirements or > > >+'lfs' in repo.requirements): > > > # Versions 01 and 02 support only flat manifests and it's just > too > > > # expensive to convert between the flat manifest and tree > manifest on > > > # the fly. Since tree manifests are hashed differently, all of > history > > >diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > > >--- a/mercurial/localrepo.py > > >+++ b/mercurial/localrepo.py > > >@@ -238,7 +238,7 @@ > > > class localrepository(object): > > > > > > supportedformats = set(('revlogv1', 'generaldelta', 'treemanifest', > > >-'manifestv2')) > > >+'manifestv2', 'lfs')) > > > _basesupported = supportedformats | set(('store', 'fncache', > 'shared', > > > 'dotencode')) > > > openerreqs = set(('revlogv1', 'generaldelta', 'treemanifest', > 'manifestv2')) > > >___ > > >Mercurial-devel mailing list > > >Mercurial-devel@mercurial-scm.org > > >https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > > > > > > -- > > Pierre-Yves David > > ___ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- --Kyle Note: If I've asked a question, and you're responding to me, please use *respond all*, so that other people can read any solutions we come to! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel