[PATCH STABLE] statprof: sort by time percentage as a secondary key

2018-10-23 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1540351037 14400
#  Tue Oct 23 23:17:17 2018 -0400
# Branch stable
# Node ID 3662c0ac3ab4b256ecabb348cc91605ee8973abb
# Parent  49c7b701fdc2a8659b6f752aef507764d40ed5d0
statprof: sort by time percentage as a secondary key

On Windows, os.times() only returns user and system times.  Real elapsed time is
0.  That results in no actual times reported, an end wall time of 0.00, and
seemingly randomly sorted stack frames.  This at least provides test stability
in test-profile.t.

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -501,7 +501,10 @@ def display_by_line(data, fp):
 '''Print the profiler data with each sample line represented
 as one row in a table.  Sorted by self-time per line.'''
 stats = SiteStats.buildstats(data.samples)
-stats.sort(reverse=True, key=lambda x: x.selfseconds())
+
+# Windows doesn't collect selfseconds, and everything is 0.  So break the
+# tie and use selfpercent for test stability.
+stats.sort(reverse=True, key=lambda x: (x.selfseconds(), x.selfpercent()))
 
 fp.write(b'%5.5s %10.10s   %7.7s  %-8.8s\n' % (
 b'%  ', b'cumulative', b'self', b''))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5188: narrow: replace filtering in list comprehension by set operations

2018-10-23 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I didn't think of this while reviewing the patch.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5188

AFFECTED FILES
  hgext/narrow/narrowcommands.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -400,10 +400,10 @@
 
 # filter the user passed additions and deletions into actual additions and
 # deletions of excludes and includes
-addedincludes = set([i for i in addedincludes if i not in oldincludes])
-removedincludes = set([i for i in removedincludes if i in oldincludes])
-addedexcludes = set([i for i in addedexcludes if i not in oldexcludes])
-removedexcludes = set([i for i in removedexcludes if i in oldexcludes])
+addedincludes -= oldincludes
+removedincludes &= oldincludes
+addedexcludes -= oldexcludes
+removedexcludes &= oldexcludes
 
 widening = addedincludes or removedexcludes
 narrowing = removedincludes or addedexcludes



To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-10-23 Thread Matthew DeVore via Mercurial-devel
From: Matt DeVore 

My e-mail client was mangling spaces, which is why you couldn't apply the
patch earlier. I'm sending this again with a different tool and e-mail address.


# HG changeset patch
# User Matt DeVore 
# Date 1539816481 25200
#  Wed Oct 17 15:48:01 2018 -0700
# Node ID 13c2fe6d3b30a743daa1984404a70ed769779d11
# Parent  a0e7fa019290d5348c4a83f6b287f2612d645025
blackbox: add configitem for format of log timestamps

Sometimes blackbox logs are used to report performance problems, but the
timestamps are only at second granularity, so often the timings have to
stated separately by the reporter. This is inconvenient and error-prone,
so I would like to include %f in the date format. This patch makes that
possible.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -33,6 +33,11 @@ Examples::
   # rotate up to N log files when the current one gets too big
   maxfiles = 3
 
+  [blackbox]
+  # Include nanoseconds in log entries with %f (see Python function
+  # datetime.datetime.strftime)
+  date-format = '%Y-%m-%d @ %H:%M:%S.%f'
+
 """
 
 from __future__ import absolute_import
@@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'date-format',
+default='%Y/%m/%d %H:%M:%S',
+)
 
 lastui = None
 
@@ -169,7 +177,9 @@ def wrapui(ui):
 return
 ui._bbinlog = True
 default = self.configdate('devel', 'default-date')
-date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
+format = ui.config('blackbox', 'date-format')
+date = dateutil.datestr(default,
+ui.config('blackbox', 'date-format'))
 user = procutil.getuser()
 pid = '%d' % procutil.getpid()
 formattedmsg = msg[0] % msg[1:]
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -82,6 +82,16 @@ recursive aliases work correctly
   1970/01/01 00:00:00 bob @ (5000)> 
so-confusing exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @ (5000)> 
blackbox
 
+custom date format
+  $ rm ./.hg/blackbox.log
+  $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
+  >--config devel.default-date='1334347993 0' --traceback status
+  A a
+  $ hg blackbox
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
(glob)
+  1970/01/01 00:00:00 bob @ (5000)> 
blackbox
+
 incoming change tracking
 
 create two heads to verify that we only see one change in the log later


___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5187: help: describe what ui.tweakdefaults changes, concretely

2018-10-23 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Currently, one has to look at the code.
  A few things are suboptimal:
  
  - probably not translatable
  - some lines don't seem to be wrapped (they are a bit too long)
  - if some extension modified ui.tweakrc, it's unlikely to be reflected in the 
help
  
  but it seems to better this way than without help at all.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5187

AFFECTED FILES
  mercurial/help.py
  mercurial/help/config.txt

CHANGE DETAILS

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -2370,6 +2370,10 @@
 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
 not include ``tweakdefaults``. (default: False)
 
+It currently means::
+
+  .. tweakdefaultsmarker
+
 ``username``
 The committer of a changeset created when running "commit".
 Typically a person's name and email address, e.g. ``Fred Widget
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -30,6 +30,7 @@
 templatefilters,
 templatefuncs,
 templatekw,
+ui,
 util,
 )
 from .hgweb import (
@@ -436,6 +437,11 @@
 addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
 dedent=True)
+def docplaceholder():
+pass
+docplaceholder.__doc__ = ui.tweakrc
+addtopicsymbols('config', '.. tweakdefaultsmarker', {'': docplaceholder},
+dedent=True)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
   **opts):



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5186: help: when replacing placeholders in help files, insert indented text

2018-10-23 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  So one can add text without hardcoding the indentation it will need.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5186

AFFECTED FILES
  mercurial/help.py
  mercurial/help/hgweb.txt

CHANGE DETAILS

diff --git a/mercurial/help/hgweb.txt b/mercurial/help/hgweb.txt
--- a/mercurial/help/hgweb.txt
+++ b/mercurial/help/hgweb.txt
@@ -83,4 +83,4 @@
 
 The following web commands and their URLs are available:
 
-  .. webcommandsmarker
+.. webcommandsmarker
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -391,6 +391,12 @@
 single documentation block and use it to overwrite the marker in doc.
 """
 entries = []
+markerindent = 0
+markerpos = doc.find(marker)
+if markerpos >= 0:
+newlinepos = doc.rfind('\n', 0, markerpos)
+if newlinepos >= 0:
+markerindent = markerpos - newlinepos - 1
 for name in sorted(items):
 text = (pycompat.getdoc(items[name]) or '').rstrip()
 if (not text
@@ -407,7 +413,7 @@
 if l.strip().startswith('>>>'):
 break
 if dedent:
-doclines.append(l.rstrip())
+doclines.append(markerindent * ' ' + l.rstrip())
 else:
 doclines.append('  ' + l.strip())
 entries.append('\n'.join(doclines))



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5185: storage: update sqlitestore to use the new `deltamode` parameter

2018-10-23 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa0e7fa019290: storage: update sqlitestore to use the new 
`deltamode` parameter (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5185?vs=12328=12329

REVISION DETAIL
  https://phab.mercurial-scm.org/D5185

AFFECTED FILES
  hgext/sqlitestore.py

CHANGE DETAILS

diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py
--- a/hgext/sqlitestore.py
+++ b/hgext/sqlitestore.py
@@ -559,7 +559,8 @@
 return not storageutil.filedataequivalent(self, node, fulltext)
 
 def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
-  assumehaveparentrevisions=False, deltaprevious=False):
+  assumehaveparentrevisions=False,
+  deltamode=repository.CG_DELTAMODE_STD):
 if nodesorder not in ('nodes', 'storage', None):
 raise error.ProgrammingError('unhandled value for nodesorder: %s' %
  nodesorder)
@@ -590,7 +591,7 @@
 deltaparentfn=deltabases.__getitem__,
 revisiondata=revisiondata,
 assumehaveparentrevisions=assumehaveparentrevisions,
-deltaprevious=deltaprevious):
+deltamode=deltamode):
 
 yield delta
 



To: lothiraldan, #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] blackbox: add configitem for format of log timestamps

2018-10-23 Thread Matthew DeVore

Below is the updated patch, but only the Node ID and Parent have changed.
The context lines haven't changed.

Thank you for the review!

- Matt



# HG changeset patch
# User Matt DeVore 
# Date 1539816481 25200
#  Wed Oct 17 15:48:01 2018 -0700
# Node ID 2e598639da17601b731454614ecba2c13f6b91a9
# Parent  dce0e0f78f0f10578a17b586fe061e1985dd5c5f
blackbox: add configitem for format of log timestamps

Sometimes blackbox logs are used to report performance problems, but the
timestamps are only at second granularity, so often the timings have to
stated separately by the reporter. This is inconvenient and error-prone,
so I would like to include %f in the date format. This patch makes that
possible.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -33,6 +33,11 @@ Examples::
   # rotate up to N log files when the current one gets too big
   maxfiles = 3

+  [blackbox]
+  # Include nanoseconds in log entries with %f (see Python function
+  # datetime.datetime.strftime)
+  date-format = '%Y-%m-%d @ %H:%M:%S.%f'
+
 """

 from __future__ import absolute_import
@@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'date-format',
+default='%Y/%m/%d %H:%M:%S',
+)

 lastui = None

@@ -169,7 +177,9 @@ def wrapui(ui):
 return
 ui._bbinlog = True
 default = self.configdate('devel', 'default-date')
-date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
+format = ui.config('blackbox', 'date-format')
+date = dateutil.datestr(default,
+ui.config('blackbox', 'date-format'))
 user = procutil.getuser()
 pid = '%d' % procutil.getpid()
 formattedmsg = msg[0] % msg[1:]
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -82,6 +82,16 @@ recursive aliases work correctly
   1970/01/01 00:00:00 bob @ (5000)> 
so-confusing exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @ (5000)> 
blackbox

+custom date format
+  $ rm ./.hg/blackbox.log
+  $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
+  >--config devel.default-date='1334347993 0' --traceback status
+  A a
+  $ hg blackbox
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
(glob)
+  1970/01/01 00:00:00 bob @ (5000)> 
blackbox
+
 incoming change tracking

 create two heads to verify that we only see one change in the log later


___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5185: storage: update sqlitestore to use the new `deltamode` parameter

2018-10-23 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While updating the filelog class, I forget to update the sqlitestore, tests
  are now passing with this patch.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5185

AFFECTED FILES
  hgext/sqlitestore.py

CHANGE DETAILS

diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py
--- a/hgext/sqlitestore.py
+++ b/hgext/sqlitestore.py
@@ -559,7 +559,8 @@
 return not storageutil.filedataequivalent(self, node, fulltext)
 
 def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
-  assumehaveparentrevisions=False, deltaprevious=False):
+  assumehaveparentrevisions=False,
+  deltamode=repository.CG_DELTAMODE_STD):
 if nodesorder not in ('nodes', 'storage', None):
 raise error.ProgrammingError('unhandled value for nodesorder: %s' %
  nodesorder)
@@ -590,7 +591,7 @@
 deltaparentfn=deltabases.__getitem__,
 revisiondata=revisiondata,
 assumehaveparentrevisions=assumehaveparentrevisions,
-deltaprevious=deltaprevious):
+deltamode=deltamode):
 
 yield delta
 



To: lothiraldan, #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 STABLE STABLE V2] phase: add an archived phase

2018-10-23 Thread Augie Fackler
queued, thanks

> On Oct 23, 2018, at 11:56, Boris Feld  wrote:
> 
> # HG changeset patch
> # User Boris Feld 
> # Date 1539780421 -7200
> #  Wed Oct 17 14:47:01 2018 +0200
> # Branch stable
> # Node ID 14ea5d230fdd42269ac04658e357684531c00736
> # Parent  36ba91e069486f8283199f92d6d3d19b8580e85c
> # EXP-Topic archived-phase
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 14ea5d230fdd
> phase: add an archived phase
> 
> This phase allows for hidden changesets in the "user space". It differs from
> the "internal" phase which is intended for internal by-product only. There
> have been discussions at the 4.8 sprint to use such phase to speedup cleanup
> after history rewriting operation.
> 
> Shipping it in the same release as the 'internal-phase' groups the associated
> `requires` entry. The important bit is to have support for this phase in the
> earliest version of mercurial possible. Adding the UI to manipulate this new
> phase later seems fine.
> 
> The current plan for archived usage and user interface are as follow. On a
> repository with internal-phase on and evolution off:
> 
> * history rewriting command set rewritten changeset in the archived phase.
>  (This mean updating the cleanupnodes method).
> * keep `hg unbundle .hg/strip-backup/X.hg` as a way to restore changeset for
>  now
>  (backup bundle need to contains phase data)
> * [maybe] add a `hg strip --soft` advance flag
>  (a light way to expose the feature without getting in the way of a better
>  UI)
> 
> Mercurial 4.8 freeze is too close to get the above in by then.
> 
> We don't introduce a new repository `requirement` as we reuse the one
> introduced with the 'archived' phase during the 4.8 cycle.
> 
> diff --git a/mercurial/phases.py b/mercurial/phases.py
> --- a/mercurial/phases.py
> +++ b/mercurial/phases.py
> @@ -129,11 +129,13 @@ HIDEABLE_FLAG = 32 # Phases that are hid
> # record phase index
> public, draft, secret = range(3)
> internal = INTERNAL_FLAG | HIDEABLE_FLAG
> +archived = HIDEABLE_FLAG
> allphases = range(internal + 1)
> trackedphases = allphases[1:]
> # record phase names
> phasenames = [None] * len(allphases)
> phasenames[:3] = ['public', 'draft', 'secret']
> +phasenames[archived] = 'archived'
> phasenames[internal] = 'internal'
> # record phase property
> mutablephases = tuple(allphases[1:])
> @@ -446,8 +448,9 @@ class phasecache(object):
> def _retractboundary(self, repo, tr, targetphase, nodes):
> # Be careful to preserve shallow-copied values: do not update
> # phaseroots values, replace them.
> -if targetphase == internal and not supportinternal(repo):
> -msg = 'this repository does not support the internal phase'
> +if targetphase in (archived, internal) and not supportinternal(repo):
> +name = phasenames[targetphase]
> +msg = 'this repository does not support the %s phase' % name
> raise error.ProgrammingError(msg)
> 
> repo = repo.unfiltered()
> diff --git a/tests/test-phases.t b/tests/test-phases.t
> --- a/tests/test-phases.t
> +++ b/tests/test-phases.t
> @@ -850,6 +850,10 @@ Check we deny its usage on older reposit
>   ** ProgrammingError: this repository does not support the internal phase
>   raise error.ProgrammingError(msg)
>   mercurial.error.ProgrammingError: this repository does not support the 
> internal phase
> +  $ hg --config "phases.new-commit=archived" commit -m "my test archived 
> commit" 2>&1 | grep ProgrammingError
> +  ** ProgrammingError: this repository does not support the archived phase
> +  raise error.ProgrammingError(msg)
> +  mercurial.error.ProgrammingError: this repository does not support the 
> archived phase
> 
>   $ cd ..
> 
> @@ -878,7 +882,8 @@ Commit an internal changesets
>   test-debug-phase: new rev 1:  x -> 96
>   test-hook-close-phase: c01c42dffc7f81223397e99652a0703f83e1c5ea:   -> 
> internal
> 
> -Usual visibility rules apply when working directory parents
> +The changeset is a working parent descendant.
> +Per the usual visibility rules, it is made visible.
> 
>   $ hg log -G -l 3
>   @  changeset:   1:c01c42dffc7f
> @@ -904,3 +909,45 @@ Commit is hidden as expected
>  date:Thu Jan 01 00:00:00 1970 +
>  summary: A
> 
> +
> +Test for archived phase
> +---
> +
> +Commit an archived changesets
> +
> +  $ echo B > B
> +  $ hg add B
> +  $ hg status
> +  A B
> +  $ hg --config "phases.new-commit=archived" commit -m "my test archived 
> commit"
> +  test-debug-phase: new rev 2:  x -> 32
> +  test-hook-close-phase: 8df5997c3361518f733d1ae67cd3adb9b0eaf125:   -> 
> archived
> +
> +The changeset is a working parent descendant.
> +Per the usual visibility rules, it is made visible.
> +
> +  $ hg log -G -l 3
> +  @  changeset:   2:8df5997c3361
> +  |  tag: tip
> +  |  parent:  0:4a2df7238c3b
> +  |  user:test
> +  |  

D5183: narrow: rework logic to check whether we need to widen and narrow

2018-10-23 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG30a7d3b6b281: narrow: rework logic to check whether we need 
to widen and narrow (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5183?vs=12325=12327

REVISION DETAIL
  https://phab.mercurial-scm.org/D5183

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  tests/test-narrow-clone-non-narrow-server.t
  tests/test-narrow-widen-no-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -144,12 +144,7 @@
 wireprotocol command
 
   $ hg tracked --addinclude widest/f
-  comparing with ssh://user@dummy/master
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 0 changesets with 0 changes to 0 files
+  nothing to widen or narrow
 
 Pull down the newly added upstream revision.
 
diff --git a/tests/test-narrow-clone-non-narrow-server.t 
b/tests/test-narrow-clone-non-narrow-server.t
--- a/tests/test-narrow-clone-non-narrow-server.t
+++ b/tests/test-narrow-clone-non-narrow-server.t
@@ -58,7 +58,11 @@
   comparing with http://localhost:$HGPORT1/
   searching for changes
   looking for local changes to affected paths
+
   $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
+  nothing to widen or narrow
+
+  $ hg tracked --addinclude f9 http://localhost:$HGPORT1/
   comparing with http://localhost:$HGPORT1/
   abort: server does not support narrow clones
   [255]
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -392,9 +392,21 @@
 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
+
+only_show = not (addedincludes or removedincludes or addedexcludes or
+ removedexcludes or newrules)
+
+oldincludes, oldexcludes = repo.narrowpats
+
+# filter the user passed additions and deletions into actual additions and
+# deletions of excludes and includes
+addedincludes = set([i for i in addedincludes if i not in oldincludes])
+removedincludes = set([i for i in removedincludes if i in oldincludes])
+addedexcludes = set([i for i in addedexcludes if i not in oldexcludes])
+removedexcludes = set([i for i in removedexcludes if i in oldexcludes])
+
 widening = addedincludes or removedexcludes
 narrowing = removedincludes or addedexcludes
-only_show = not widening and not narrowing
 
 # Only print the current narrowspec.
 if only_show:
@@ -413,6 +425,10 @@
 fm.end()
 return 0
 
+if not widening and not narrowing:
+ui.status(_("nothing to widen or narrow\n"))
+return 0
+
 with repo.wlock(), repo.lock():
 cmdutil.bailifchanged(repo)
 
@@ -432,7 +448,6 @@
 
 commoninc = discovery.findcommonincoming(repo, remote)
 
-oldincludes, oldexcludes = repo.narrowpats
 if narrowing:
 newincludes = oldincludes - removedincludes
 newexcludes = oldexcludes | addedexcludes



To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5182: tests: show that adding an already included path still calls narrow_widen()

2018-10-23 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd362a41ee5dd: tests: show that adding an already included 
path still calls narrow_widen() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5182?vs=12320=12326

REVISION DETAIL
  https://phab.mercurial-scm.org/D5182

AFFECTED FILES
  tests/test-narrow-widen-no-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -140,6 +140,17 @@
   $ hg id -n
   2
 
+Test that extending already included files should not call narrow_widen
+wireprotocol command
+
+  $ hg tracked --addinclude widest/f
+  comparing with ssh://user@dummy/master
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 0 changes to 0 files
+
 Pull down the newly added upstream revision.
 
   $ hg pull



To: pulkit, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5183: narrow: rework logic to check whether we need to widen and narrow

2018-10-23 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 12325.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5183?vs=12321=12325

REVISION DETAIL
  https://phab.mercurial-scm.org/D5183

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  tests/test-narrow-clone-non-narrow-server.t
  tests/test-narrow-widen-no-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -144,12 +144,7 @@
 wireprotocol command
 
   $ hg tracked --addinclude widest/f
-  comparing with ssh://user@dummy/master
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 0 changesets with 0 changes to 0 files
+  nothing to widen or narrow
 
 Pull down the newly added upstream revision.
 
diff --git a/tests/test-narrow-clone-non-narrow-server.t 
b/tests/test-narrow-clone-non-narrow-server.t
--- a/tests/test-narrow-clone-non-narrow-server.t
+++ b/tests/test-narrow-clone-non-narrow-server.t
@@ -58,7 +58,11 @@
   comparing with http://localhost:$HGPORT1/
   searching for changes
   looking for local changes to affected paths
+
   $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
+  nothing to widen or narrow
+
+  $ hg tracked --addinclude f9 http://localhost:$HGPORT1/
   comparing with http://localhost:$HGPORT1/
   abort: server does not support narrow clones
   [255]
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -392,9 +392,21 @@
 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
+
+only_show = not (addedincludes or removedincludes or addedexcludes or
+ removedexcludes or newrules)
+
+oldincludes, oldexcludes = repo.narrowpats
+
+# filter the user passed additions and deletions into actual additions and
+# deletions of excludes and includes
+addedincludes = set([i for i in addedincludes if i not in oldincludes])
+removedincludes = set([i for i in removedincludes if i in oldincludes])
+addedexcludes = set([i for i in addedexcludes if i not in oldexcludes])
+removedexcludes = set([i for i in removedexcludes if i in oldexcludes])
+
 widening = addedincludes or removedexcludes
 narrowing = removedincludes or addedexcludes
-only_show = not widening and not narrowing
 
 # Only print the current narrowspec.
 if only_show:
@@ -413,6 +425,10 @@
 fm.end()
 return 0
 
+if not widening and not narrowing:
+ui.status(_("nothing to widen or narrow\n"))
+return 0
+
 with repo.wlock(), repo.lock():
 cmdutil.bailifchanged(repo)
 
@@ -432,7 +448,6 @@
 
 commoninc = discovery.findcommonincoming(repo, remote)
 
-oldincludes, oldexcludes = repo.narrowpats
 if narrowing:
 newincludes = oldincludes - removedincludes
 newexcludes = oldexcludes | addedexcludes



To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH STABLE STABLE V2] phase: add an archived phase

2018-10-23 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539780421 -7200
#  Wed Oct 17 14:47:01 2018 +0200
# Branch stable
# Node ID 14ea5d230fdd42269ac04658e357684531c00736
# Parent  36ba91e069486f8283199f92d6d3d19b8580e85c
# EXP-Topic archived-phase
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
14ea5d230fdd
phase: add an archived phase

This phase allows for hidden changesets in the "user space". It differs from
the "internal" phase which is intended for internal by-product only. There
have been discussions at the 4.8 sprint to use such phase to speedup cleanup
after history rewriting operation.

Shipping it in the same release as the 'internal-phase' groups the associated
`requires` entry. The important bit is to have support for this phase in the
earliest version of mercurial possible. Adding the UI to manipulate this new
phase later seems fine.

The current plan for archived usage and user interface are as follow. On a
repository with internal-phase on and evolution off:

* history rewriting command set rewritten changeset in the archived phase.
  (This mean updating the cleanupnodes method).
* keep `hg unbundle .hg/strip-backup/X.hg` as a way to restore changeset for
  now
  (backup bundle need to contains phase data)
* [maybe] add a `hg strip --soft` advance flag
  (a light way to expose the feature without getting in the way of a better
  UI)

Mercurial 4.8 freeze is too close to get the above in by then.

We don't introduce a new repository `requirement` as we reuse the one
introduced with the 'archived' phase during the 4.8 cycle.

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -129,11 +129,13 @@ HIDEABLE_FLAG = 32 # Phases that are hid
 # record phase index
 public, draft, secret = range(3)
 internal = INTERNAL_FLAG | HIDEABLE_FLAG
+archived = HIDEABLE_FLAG
 allphases = range(internal + 1)
 trackedphases = allphases[1:]
 # record phase names
 phasenames = [None] * len(allphases)
 phasenames[:3] = ['public', 'draft', 'secret']
+phasenames[archived] = 'archived'
 phasenames[internal] = 'internal'
 # record phase property
 mutablephases = tuple(allphases[1:])
@@ -446,8 +448,9 @@ class phasecache(object):
 def _retractboundary(self, repo, tr, targetphase, nodes):
 # Be careful to preserve shallow-copied values: do not update
 # phaseroots values, replace them.
-if targetphase == internal and not supportinternal(repo):
-msg = 'this repository does not support the internal phase'
+if targetphase in (archived, internal) and not supportinternal(repo):
+name = phasenames[targetphase]
+msg = 'this repository does not support the %s phase' % name
 raise error.ProgrammingError(msg)
 
 repo = repo.unfiltered()
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -850,6 +850,10 @@ Check we deny its usage on older reposit
   ** ProgrammingError: this repository does not support the internal phase
   raise error.ProgrammingError(msg)
   mercurial.error.ProgrammingError: this repository does not support the 
internal phase
+  $ hg --config "phases.new-commit=archived" commit -m "my test archived 
commit" 2>&1 | grep ProgrammingError
+  ** ProgrammingError: this repository does not support the archived phase
+  raise error.ProgrammingError(msg)
+  mercurial.error.ProgrammingError: this repository does not support the 
archived phase
 
   $ cd ..
 
@@ -878,7 +882,8 @@ Commit an internal changesets
   test-debug-phase: new rev 1:  x -> 96
   test-hook-close-phase: c01c42dffc7f81223397e99652a0703f83e1c5ea:   -> 
internal
 
-Usual visibility rules apply when working directory parents
+The changeset is a working parent descendant.
+Per the usual visibility rules, it is made visible.
 
   $ hg log -G -l 3
   @  changeset:   1:c01c42dffc7f
@@ -904,3 +909,45 @@ Commit is hidden as expected
  date:Thu Jan 01 00:00:00 1970 +
  summary: A
   
+
+Test for archived phase
+---
+
+Commit an archived changesets
+
+  $ echo B > B
+  $ hg add B
+  $ hg status
+  A B
+  $ hg --config "phases.new-commit=archived" commit -m "my test archived 
commit"
+  test-debug-phase: new rev 2:  x -> 32
+  test-hook-close-phase: 8df5997c3361518f733d1ae67cd3adb9b0eaf125:   -> 
archived
+
+The changeset is a working parent descendant.
+Per the usual visibility rules, it is made visible.
+
+  $ hg log -G -l 3
+  @  changeset:   2:8df5997c3361
+  |  tag: tip
+  |  parent:  0:4a2df7238c3b
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: my test archived commit
+  |
+  o  changeset:   0:4a2df7238c3b
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: A
+  
+
+Commit is hidden as expected
+
+  $ hg up 0
+  0 files 

D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-23 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D5146#77493, @durin42 wrote:
  
  > In https://phab.mercurial-scm.org/D5146#77492, @pulkit wrote:
  >
  > > I remember using chistedit and finding that the `.hg/chisedit` file is 
not deleted after chistedit is completed. Looking at code, I am unable to find 
code which deletes that file. Can you please have a look and delete that file 
after a successfull or aborted chistedit?
  >
  >
  > That file is an implementation detail, so that histedit can pass rules to 
itself. It's a little gross, but not harmful.
  >
  > Could I persuade you to let us clean that up later as a follow-up?
  
  
  Yeah sure!

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5146

To: durin42, #hg-reviewers, martinvonz
Cc: martinvonz, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-23 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5146#77492, @pulkit wrote:
  
  > I remember using chistedit and finding that the `.hg/chisedit` file is not 
deleted after chistedit is completed. Looking at code, I am unable to find code 
which deletes that file. Can you please have a look and delete that file after 
a successfull or aborted chistedit?
  
  
  That file is an implementation detail, so that histedit can pass rules to 
itself. It's a little gross, but not harmful.
  
  Could I persuade you to let us clean that up later as a follow-up?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5146

To: durin42, #hg-reviewers, martinvonz
Cc: martinvonz, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-23 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  I remember using chistedit and finding that the `.hg/chisedit` file is not 
deleted after chistedit is completed. Looking at code, I am unable to find code 
which deletes that file. Can you please have a look and delete that file after 
a successfull or aborted chistedit?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5146

To: durin42, #hg-reviewers, martinvonz
Cc: martinvonz, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5183: narrow: rework logic to check whether we need to widen and narrow

2018-10-23 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> martinvonz wrote in narrowcommands.py:429
> nit: s/extend/widen/? that seems like the natural opposite to (the verb) 
> "narrow"

I am fine with anyone, you can fix this in flight or I can send an updated 
version too.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5183

To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5002: extensions: fix up many many debug logs that use %r

2018-10-23 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 12323.
durin42 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5002?vs=11910=12323

REVISION DETAIL
  https://phab.mercurial-scm.org/D5002

AFFECTED FILES
  mercurial/extensions.py
  mercurial/hg.py
  tests/test-bad-extension.t
  tests/test-extension-timing.t

CHANGE DETAILS

diff --git a/tests/test-extension-timing.t b/tests/test-extension-timing.t
--- a/tests/test-extension-timing.t
+++ b/tests/test-extension-timing.t
@@ -46,23 +46,23 @@
   $ hg foo --traceback --config devel.debug.extensions=yes --debug 2>&1
   debug.extensions: loading extensions
   debug.extensions: - processing 1 entries
-  debug.extensions:   - loading extension: 'foobar'
-  debug.extensions:   > 'foobar' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'foobar'
-  debug.extensions: - invoking registered callbacks: 'foobar'
+  debug.extensions:   - loading extension: foobar
+  debug.extensions:   > foobar extension loaded in * (glob)
+  debug.extensions: - validating extension tables: foobar
+  debug.extensions: - invoking registered callbacks: foobar
   debug.extensions: > callbacks completed in * (glob)
   debug.extensions: > loaded 1 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'foobar'
+  debug.extensions:   - running uisetup for foobar
   uisetup called [debug]
   uisetup called
   uisetup called [status]
-  debug.extensions:   > uisetup for 'foobar' took * (glob)
+  debug.extensions:   > uisetup for foobar took * (glob)
   debug.extensions: > all uisetup took * (glob)
   debug.extensions: - executing extsetup hooks
-  debug.extensions:   - running extsetup for 'foobar'
-  debug.extensions:   > extsetup for 'foobar' took * (glob)
+  debug.extensions:   - running extsetup for foobar
+  debug.extensions:   > extsetup for foobar took * (glob)
   debug.extensions: > all extsetup took * (glob)
   debug.extensions: - executing remaining aftercallbacks
   debug.extensions: > remaining aftercallbacks completed in * (glob)
@@ -87,7 +87,7 @@
   debug.extensions:   - running reposetup for foobar
   reposetup called for a
   ui == repo.ui
-  debug.extensions:   > reposetup for 'foobar' took * (glob)
+  debug.extensions:   > reposetup for foobar took * (glob)
   debug.extensions: > all reposetup took * (glob)
   Foo
 
diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -85,21 +85,21 @@
   > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not 
import|ModuleNotFound'
   debug.extensions: loading extensions
   debug.extensions: - processing 5 entries
-  debug.extensions:   - loading extension: 'gpg'
-  debug.extensions:   > 'gpg' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'gpg'
-  debug.extensions: - invoking registered callbacks: 'gpg'
+  debug.extensions:   - loading extension: gpg
+  debug.extensions:   > gpg extension loaded in * (glob)
+  debug.extensions: - validating extension tables: gpg
+  debug.extensions: - invoking registered callbacks: gpg
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext'
+  debug.extensions:   - loading extension: badext
   *** failed to import extension badext from $TESTTMP/badext.py: bit bucket 
overflow
   Traceback (most recent call last):
   Exception: bit bucket overflow
-  debug.extensions:   - loading extension: 'baddocext'
-  debug.extensions:   > 'baddocext' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'baddocext'
-  debug.extensions: - invoking registered callbacks: 'baddocext'
+  debug.extensions:   - loading extension: baddocext
+  debug.extensions:   > baddocext extension loaded in * (glob)
+  debug.extensions: - validating extension tables: baddocext
+  debug.extensions: - invoking registered callbacks: baddocext
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext2'
+  debug.extensions:   - loading extension: badext2
   debug.extensions: - could not import hgext.badext2 (No module named 
*badext2*): trying hgext3rd.badext2 (glob)
   Traceback (most recent call last):
   ImportError: No module named badext2 (no-py3 !)
@@ -121,16 +121,16 @@
   debug.extensions: > loaded 2 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'gpg'
-  debug.extensions:   > uisetup for 'gpg' took * (glob)
-  debug.extensions:   - running uisetup for 'baddocext'
-  debug.extensions:   > uisetup for 'baddocext' took * (glob)
+  debug.extensions:   - running uisetup for gpg
+  

D5184: py3: port test-log-exthook.t to Python 3

2018-10-23 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For once an easy one.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5184

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-log-exthook.t

CHANGE DETAILS

diff --git a/tests/test-log-exthook.t b/tests/test-log-exthook.t
--- a/tests/test-log-exthook.t
+++ b/tests/test-log-exthook.t
@@ -9,10 +9,12 @@
   >   logcmdutil,
   >   repair,
   > )
+  > def brot13(b):
+  > return codecs.encode(b.decode('utf8'), 'rot-13').encode('utf8')
   > def rot13description(self, ctx):
-  > summary = codecs.encode("summary", 'rot-13')
-  > description = ctx.description().strip().splitlines()[0].encode('rot13')
-  > self.ui.write("%s: %s\n" % (summary, description))
+  > description = ctx.description().strip().splitlines()[0]
+  > self.ui.write(b"%s: %s\n" % (brot13(b"summary"),
+  >  brot13(description)))
   > def reposetup(ui, repo):
   > logcmdutil.changesetprinter._exthook = rot13description
   > EOF
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -309,6 +309,7 @@
 test-linerange.py
 test-locate.t
 test-lock-badness.t
+test-log-exthook.t
 test-log-linerange.t
 test-log.t
 test-logexchange.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


D5183: narrow: rework logic to check whether we need to widen and narrow

2018-10-23 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> narrowcommands.py:429
> +if not widening and not narrowing:
> +ui.status(_("nothing to extend or narrow\n"))
> +return 0

nit: s/extend/widen/? that seems like the natural opposite to (the verb) 
"narrow"

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5183

To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@40415: 8 new changesets

2018-10-23 Thread Mercurial Commits
8 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/997997eb8367
changeset:   40408:997997eb8367
user:Martin von Zweigbergk 
date:Tue Sep 05 15:24:22 2017 -0700
summary: archive: create alwaysmatcher when no matcher provided

https://www.mercurial-scm.org/repo/hg/rev/5eefd32cb382
changeset:   40409:5eefd32cb382
user:Martin von Zweigbergk 
date:Tue Sep 05 15:24:25 2017 -0700
summary: archive: use manifest.matches() to simplify and speed up matching

https://www.mercurial-scm.org/repo/hg/rev/3b782669561d
changeset:   40410:3b782669561d
user:Pulkit Goyal 
date:Sat Oct 20 00:05:50 2018 +0300
summary: py3: make sure we pass sysstr in sqlite3.connect()

https://www.mercurial-scm.org/repo/hg/rev/bad46c934c31
changeset:   40411:bad46c934c31
user:Pulkit Goyal 
date:Sat Oct 20 00:12:20 2018 +0300
summary: py3: add one more passing test to whitelist

https://www.mercurial-scm.org/repo/hg/rev/ab09e797fbed
changeset:   40412:ab09e797fbed
user:rdama...@google.com
date:Sat Oct 13 05:02:55 2018 -0700
summary: help: allow commands to be hidden

https://www.mercurial-scm.org/repo/hg/rev/1ddd202c47d9
changeset:   40413:1ddd202c47d9
user:rdama...@google.com
date:Sat Oct 13 05:43:39 2018 -0700
summary: help: allow hiding of help topics

https://www.mercurial-scm.org/repo/hg/rev/444861dc1e55
changeset:   40414:444861dc1e55
user:rdama...@google.com
date:Thu Oct 18 19:57:05 2018 -0700
summary: help: displaying documented aliases by default

https://www.mercurial-scm.org/repo/hg/rev/dce0e0f78f0f
changeset:   40415:dce0e0f78f0f
bookmark:@default
tag: tip
user:rdama...@google.com
date:Thu Oct 18 19:57:30 2018 -0700
summary: help: displaying extension commands by default

-- 
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


D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-23 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 12322.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5146?vs=12221=12322

REVISION DETAIL
  https://phab.mercurial-scm.org/D5146

AFFECTED FILES
  hgext/histedit.py
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1203,7 +1203,11 @@
 "chunkselector": [
 "text",
 "curses",
-]
+],
+"histedit": [
+"text",
+"curses",
+],
 }
 
 # Feature-specific interface
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -183,7 +183,11 @@
 
 from __future__ import absolute_import
 
+import fcntl
+import functools
 import os
+import struct
+import termios
 
 from mercurial.i18n import _
 from mercurial import (
@@ -198,6 +202,7 @@
 extensions,
 hg,
 lock,
+logcmdutil,
 merge as mergemod,
 mergeutil,
 node,
@@ -235,6 +240,9 @@
 configitem('histedit', 'singletransaction',
 default=False,
 )
+configitem('ui', 'interface.histedit',
+default=None,
+)
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -915,6 +923,562 @@
 raise error.Abort(msg, hint=hint)
 return repo[roots[0]].node()
 
+# Curses Support
+try:
+import curses
+except ImportError:
+curses = None
+
+KEY_LIST = ['pick', 'edit', 'fold', 'drop', 'mess', 'roll']
+ACTION_LABELS = {
+'fold': '^fold',
+'roll': '^roll',
+}
+
+COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN  = 1, 2, 3, 4
+
+E_QUIT, E_HISTEDIT = 1, 2
+E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7
+MODE_INIT, MODE_PATCH, MODE_RULES, MODE_HELP = 0, 1, 2, 3
+
+KEYTABLE = {
+'global': {
+'h': 'next-action',
+'KEY_RIGHT': 'next-action',
+'l': 'prev-action',
+'KEY_LEFT':  'prev-action',
+'q': 'quit',
+'c': 'histedit',
+'C': 'histedit',
+'v': 'showpatch',
+'?': 'help',
+},
+MODE_RULES: {
+'d': 'action-drop',
+'e': 'action-edit',
+'f': 'action-fold',
+'m': 'action-mess',
+'p': 'action-pick',
+'r': 'action-roll',
+' ': 'select',
+'j': 'down',
+'k': 'up',
+'KEY_DOWN':  'down',
+'KEY_UP':'up',
+'J': 'move-down',
+'K': 'move-up',
+'KEY_NPAGE': 'move-down',
+'KEY_PPAGE': 'move-up',
+'0': 'goto',  # Used for 0..9
+},
+MODE_PATCH: {
+' ': 'page-down',
+'KEY_NPAGE': 'page-down',
+'KEY_PPAGE': 'page-up',
+'j': 'line-down',
+'k': 'line-up',
+'KEY_DOWN':  'line-down',
+'KEY_UP':'line-up',
+'J': 'down',
+'K': 'up',
+},
+MODE_HELP: {
+},
+}
+
+def screen_size():
+return struct.unpack('hh', fcntl.ioctl(1, termios.TIOCGWINSZ, ''))
+
+class histeditrule(object):
+def __init__(self, ctx, pos, action='pick'):
+self.ctx = ctx
+self.action = action
+self.origpos = pos
+self.pos = pos
+self.conflicts = []
+
+def __str__(self):
+# Some actions ('fold' and 'roll') combine a patch with a previous one.
+# Add a marker showing which patch they apply to, and also omit the
+# description for 'roll' (since it will get discarded). Example 
display:
+#
+#  #10 pick   316392:06a16c25c053   add option to skip tests
+#  #11 ^roll  316393:71313c964cc5
+#  #12 pick   316394:ab31f3973b0d   include mfbt for mozilla-config.h
+#  #13 ^fold  316395:14ce5803f4c3   fix warnings
+#
+# The carets point to the changeset being folded into ("roll this
+# changeset into the changeset above").
+action = ACTION_LABELS.get(self.action, self.action)
+h = self.ctx.hex()[0:12]
+r = self.ctx.rev()
+desc = self.ctx.description().splitlines()[0].strip()
+if self.action == 'roll':
+desc = ''
+return "#{0:<2} {1:<6} {2}:{3}   {4}".format(
+self.origpos, action, r, h, desc)
+
+def checkconflicts(self, other):
+if other.pos > self.pos and other.origpos <= self.origpos:
+if set(other.ctx.files()) & set(self.ctx.files()) != set():
+self.conflicts.append(other)
+return self.conflicts
+
+if other in self.conflicts:
+self.conflicts.remove(other)
+return self.conflicts
+
+#  EVENTS ===
+def movecursor(state, oldpos, newpos):
+

Re: [PATCH v2] graft: introduce --base option for using custom base revision while merging

2018-10-23 Thread Augie Fackler


> On Oct 14, 2018, at 11:15, Mads Kiilerich  wrote:
> 
> # HG changeset patch
> # User Mads Kiilerich 
> # Date 1539529698 -7200
> #  Sun Oct 14 17:08:18 2018 +0200
> # Node ID 258029c642d97ef663396476c63ce34dbef89b13
> # Parent  38ac525b44c93fcadb3680d4ded56f1e5a0029b2
> graft: introduce --base option for using custom base revision while merging

queued

At the sprint you had mentioned maybe being able to use this to help backing 
out a merge - if you know the incantation for that maybe send that as a 
follow-up for the verbose help?

> 
> The graft command usually performs an internal merge of the current parent
> revision with the graft revision, using p1 of the grafted revision as base for
> the merge.
> 
> As a trivial extension of this, we introduce the --base option to allow for
> using another base revision.
> 
> This can be used as a building block for grafting and collapsing multiple
> changesets at once, or for grafting the resulting change from a merge as a
> single simple change. (This is kind of similar to backout --parent ... only
> different: this graft base must be an ancestor, but is usually *not* a 
> parent.)
> 
> This is probably an advanced use case, and we do thus not show it in the
> non-verbose help.
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2223,6 +2223,8 @@ def forget(ui, repo, *pats, **opts):
> @command(
> 'graft',
> [('r', 'rev', [], _('revisions to graft'), _('REV')),
> + ('', 'base', '',
> +  _('base revision when doing the graft merge (ADVANCED)'), _('REV')),
>  ('c', 'continue', False, _('resume interrupted graft')),
>  ('', 'stop', False, _('stop interrupted graft')),
>  ('', 'abort', False, _('abort interrupted graft')),
> @@ -2267,6 +2269,35 @@ def graft(ui, repo, *revs, **opts):
> 
> .. container:: verbose
> 
> +  The --base option exposes more of how graft internally uses merge with 
> a
> +  custom base revision. --base can be used to specify another ancestor 
> than
> +  the first and only parent.
> +
> +  The command::
> +
> +hg graft -r 345 --base 234
> +
> +  is thus pretty much the same as::
> +
> +hg diff -r 234 -r 345 | hg import
> +
> +  but using merge to resolve conflicts and track moved files.
> +
> +  The result of a merge can thus be backported as a single commit by
> +  specifying one of the merge parents as base, and thus effectively
> +  grafting the changes from the other side.
> +
> +  It is also possible to collapse multiple changesets and clean up 
> history
> +  by specifying another ancestor as base, much like rebase --collapse
> +  --keep.
> +
> +  The commit message can be tweaked after the fact using commit --amend .
> +
> +  For using non-ancestors as the base to backout changes, see the backout
> +  command and the hidden --parent option.
> +
> +.. container:: verbose
> +
>   Examples:
> 
>   - copy a single change to the stable branch and edit its description::
> @@ -2290,6 +2321,15 @@ def graft(ui, repo, *revs, **opts):
> 
>   hg log -r "sort(all(), date)"
> 
> +  - backport the result of a merge as a single commit::
> +
> +  hg graft -r 123 --base 123^
> +
> +  - land a feature branch as one changeset::
> +
> +  hg up -cr default
> +  hg graft -r featureX --base "ancestor('featureX', 'default')"
> +
> See :hg:`help revisions` for more about specifying revisions.
> 
> Returns 0 on successful completion.
> @@ -2305,6 +2345,9 @@ def _dograft(ui, repo, *revs, **opts):
> 
> revs = list(revs)
> revs.extend(opts.get('rev'))
> +basectx = None
> +if opts.get('base'):
> +basectx = scmutil.revsingle(repo, opts['base'], None)
> # a dict of data to be stored in state file
> statedata = {}
> # list of new nodes created by ongoing graft
> @@ -2384,13 +2427,16 @@ def _dograft(ui, repo, *revs, **opts):
> revs = scmutil.revrange(repo, revs)
> 
> skipped = set()
> -# check for merges
> -for rev in repo.revs('%ld and merge()', revs):
> -ui.warn(_('skipping ungraftable merge revision %d\n') % rev)
> -skipped.add(rev)
> +if basectx is None:
> +# check for merges
> +for rev in repo.revs('%ld and merge()', revs):
> +ui.warn(_('skipping ungraftable merge revision %d\n') % rev)
> +skipped.add(rev)
> revs = [r for r in revs if r not in skipped]
> if not revs:
> return -1
> +if basectx is not None and len(revs) != 1:
> +raise error.Abort(_('only one revision allowed with --base '))
> 
> # Don't check in the --continue case, in effect retaining --force across
> # --continues. That's because without --force, any revisions we decided to
> @@ -2398,7 +2444,7 @@ def _dograft(ui, repo, *revs, **opts):
> # way to the graftstate. With --force, any revisions we 

Re: [PATCH 4 of 4 V2] changegroup: add a option to create bundle with full snapshot only

2018-10-23 Thread Augie Fackler
seems fine, queued

> On Oct 18, 2018, at 06:56, Boris Feld  wrote:
> 
> # HG changeset patch
> # User Boris Feld 
> # Date 1539858666 -7200
> #  Thu Oct 18 12:31:06 2018 +0200
> # Node ID 4c805ec9e478424e631ed8bb7ba6fd65714cfd15
> # Parent  2a54c05a0e8901bb171721024843531f95382616
> # EXP-Topic slim-bundle
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 4c805ec9e478
> changegroup: add a option to create bundle with full snapshot only
> 
> This is easy to implement now and can be useful for benchmarking.
> 
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -698,7 +698,7 @@ def deltagroup(repo, store, nodes, ischa
> total=len(nodes))
> 
> configtarget = repo.ui.config('devel', 'bundle.delta')
> -if configtarget not in ('', 'p1'):
> +if configtarget not in ('', 'p1', 'full'):
> msg = _("""config "devel.bundle.delta" as unknown value: %s""")
> repo.ui.warn(msg % configtarget)
> 
> @@ -707,6 +707,8 @@ def deltagroup(repo, store, nodes, ischa
> deltamode = repository.CG_DELTAMODE_PREV
> elif configtarget == 'p1':
> deltamode = repository.CG_DELTAMODE_P1
> +elif configtarget == 'full':
> +deltamode = repository.CG_DELTAMODE_FULL
> 
> revisions = store.emitrevisions(
> nodes,
> diff --git a/tests/test-bundle.t b/tests/test-bundle.t
> --- a/tests/test-bundle.t
> +++ b/tests/test-bundle.t
> @@ -905,3 +905,7 @@ Test the option that create slim bundle
> 
>   $ hg bundle -a --config devel.bundle.delta=p1 ./slim.hg
>   3 changesets found
> +
> +Test the option that create and no-delta's bundle
> +  $ hg bundle -a --config devel.bundle.delta=full ./full.hg
> +  3 changesets found
> ___
> 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 PoC] relnotes: various tweaks for release notes (PoC)

2018-10-23 Thread Augie Fackler
This looks like a huge improvement. When you're ready, please feel encouraged 
to send a patch for me to check-in.

Thanks for improving our release notes! It's been on my "we should fix that" 
list for so long I mostly forgot.


> On Oct 19, 2018, at 10:25, Anton Shestakov  wrote:
> 
> # HG changeset patch
> # User Anton Shestakov 
> # Date 1539958193 -28800
> #  Fri Oct 19 22:09:53 2018 +0800
> # Node ID a9decc4cc129f53082c5bc4b1bc3597cf2ab167f
> # Parent  a9838dfc27b81bc3618b187c172d55e102b4faa8
> # EXP-Topic stream-obsmarkers
> relnotes: various tweaks for release notes (PoC)
> 
> This is a rough version of what I'm planning to use to post release notes for
> 4.8rc0 when it gets released (but if someone beats me to it: use this patch).
> 
> Stop filtering out commits that are expected to be covered by releasenotes
> extension: now we want two lists, one for WhatsNew and one for ReleaseX.Y.
> 
> Exclude starting revision. When 4.7.2 was released, its section on WhatsNew
> page included one fix from 4.7.1 because it was the last commit included in
> that release (IOW it was tagged 4.7.1).
> 
> AFAIU nargs=1 is not needed, and it was making args.startrev and args.stoprev
> be lists.
> 
> Also just skip BC and API sections if there are no such items.
> 
> diff --git a/contrib/relnotes b/contrib/relnotes
> --- a/contrib/relnotes
> +++ b/contrib/relnotes
> @@ -9,11 +9,6 @@ import argparse
> import re
> import subprocess
> 
> -# Regenerate this list with
> -#   hg export 'grep("\.\. [a-z]+::")' | grep '^\.\.' | \
> -# sed 's/.. //;s/::.*//' | sort -u
> -rnsections = ["api", "bc", "container", "feature", "fix", "note", "perf"]
> -
> rules = {
> # keep
> r"\(issue": 100,
> @@ -88,7 +83,6 @@ def main():
> "startrev",
> metavar="REV",
> type=str,
> -nargs=1,
> help=(
> "Starting revision for the release notes. This revision "
> "won't be included, but later revisions will."
> @@ -99,7 +93,6 @@ def main():
> metavar="REV",
> type=str,
> default="@",
> -nargs=1,
> help=(
> "Stop revision for release notes. This revision will be included,"
> " but no later revisions will. This revision needs to be "
> @@ -114,7 +107,7 @@ def main():
> "extensions.releasenotes=",
> "releasenotes",
> "-r",
> -"%s::%s" % (args.startrev[0], args.stoprev[0]),
> +"%s::%s - %s" % (args.startrev, args.stoprev, args.startrev),
> ]
> ).decode("utf-8")
> # Find all release notes from un-relnotes-flagged commits.
> @@ -124,8 +117,8 @@ def main():
> "hg",
> "log",
> "-r",
> -r'%s::%s - merge() - grep("\n\.\. (%s)::")'
> -% (args.startrev[0], args.stoprev[0], "|".join(rnsections)),
> +r'%s::%s - merge() - %s'
> +% (args.startrev, args.stoprev, args.startrev),
> "-T",
> r"{desc|firstline}\n",
> ]
> @@ -167,12 +160,14 @@ def main():
> for d in sorted(groups[g]):
> print(" * %s" % d)
> 
> -print("\n=== BC ===\n")
> +if bcs:
> +print("\n=== BC ===\n")
> 
> for d in sorted(bcs):
> print(" * %s" % d)
> 
> -print("\n=== API Changes ===\n")
> +if apis:
> +print("\n=== API Changes ===\n")
> 
> for d in sorted(apis):
> print(" * %s" % d)
> ___
> 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 3 of 3] branchmap: do not specify changelog as an argument

2018-10-23 Thread Augie Fackler
queued, very nice

> On Oct 23, 2018, at 08:43, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1540296673 -32400
> #  Tue Oct 23 21:11:13 2018 +0900
> # Node ID 9dbe2753c9eabb95eda4cb8be726dd5e29f4cc7a
> # Parent  759c7efd7c9132ce6dac5bbd9a37e70acb420d24
> branchmap: do not specify changelog as an argument
> 
> Since (unfiltered)repo.changelog lookup gets as fast as __dict__ lookup,
> there's no point to pass in changelog instance.
> 
>  $ hg perfbranchmap --clear-revbranch -R mozilla-central
>  ! base
>  (orig) wall 20.593091 comb 20.60 user 20.52 sys 0.08 (best of 3)
>  (this) wall 20.129126 comb 20.13 user 20.02 sys 0.11 (best of 3)
> 
> This backs out most of the changes in 76d4272bd57b and 47c03042cd1d.
> 
> diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
> --- a/mercurial/branchmap.py
> +++ b/mercurial/branchmap.py
> @@ -281,7 +281,7 @@ class branchcache(dict):
> newbranches = {}
> getbranchinfo = repo.revbranchcache().branchinfo
> for r in revgen:
> -branch, closesbranch = getbranchinfo(r, changelog=cl)
> +branch, closesbranch = getbranchinfo(r)
> newbranches.setdefault(branch, []).append(r)
> if closesbranch:
> self._closednodes.add(cl.node(r))
> @@ -407,10 +407,10 @@ class revbranchcache(object):
> self._rbcrevslen = len(self._repo.changelog)
> self._rbcrevs = bytearray(self._rbcrevslen * _rbcrecsize)
> 
> -def branchinfo(self, rev, changelog=None):
> +def branchinfo(self, rev):
> """Return branch name and close flag for rev, using and updating
> persistent cache."""
> -changelog = changelog or self._repo.changelog
> +changelog = self._repo.changelog
> rbcrevidx = rev * _rbcrecsize
> 
> # avoid negative index, changelog.read(nullrev) is fast without cache
> @@ -419,7 +419,7 @@ class revbranchcache(object):
> 
> # if requested rev isn't allocated, grow and cache the rev info
> if len(self._rbcrevs) < rbcrevidx + _rbcrecsize:
> -return self._branchinfo(rev, changelog=changelog)
> +return self._branchinfo(rev)
> 
> # fast path: extract data from cache, use it if node is matching
> reponode = changelog.node(rev)[:_rbcnodelen]
> @@ -447,11 +447,11 @@ class revbranchcache(object):
> self._rbcrevslen = min(self._rbcrevslen, truncate)
> 
> # fall back to slow path and make sure it will be written to disk
> -return self._branchinfo(rev, changelog=changelog)
> +return self._branchinfo(rev)
> 
> -def _branchinfo(self, rev, changelog=None):
> +def _branchinfo(self, rev):
> """Retrieve branch info from changelog and update _rbcrevs"""
> -changelog = changelog or self._repo.changelog
> +changelog = self._repo.changelog
> b, close = changelog.branchinfo(rev)
> if b in self._namesreverse:
> branchidx = self._namesreverse[b]
> @@ -462,7 +462,7 @@ class revbranchcache(object):
> reponode = changelog.node(rev)
> if close:
> branchidx |= _rbccloseflag
> -self._setcachedata(rev, reponode, branchidx, changelog)
> +self._setcachedata(rev, reponode, branchidx)
> return b, close
> 
> def setdata(self, branch, rev, node, close):
> @@ -485,16 +485,14 @@ class revbranchcache(object):
> if r'branchinfo' in vars(self):
> del self.branchinfo
> 
> -def _setcachedata(self, rev, node, branchidx, changelog=None):
> +def _setcachedata(self, rev, node, branchidx):
> """Writes the node's branch data to the in-memory cache data."""
> if rev == nullrev:
> return
> -
> -changelog = changelog or self._repo.changelog
> rbcrevidx = rev * _rbcrecsize
> if len(self._rbcrevs) < rbcrevidx + _rbcrecsize:
> self._rbcrevs.extend('\0' *
> - (len(changelog) * _rbcrecsize -
> + (len(self._repo.changelog) * _rbcrecsize -
>   len(self._rbcrevs)))
> pack_into(_rbcrecfmt, self._rbcrevs, rbcrevidx, node, branchidx)
> self._rbcrevslen = min(self._rbcrevslen, rev)
> ___
> 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] exewrapper: apply clang-format to silence test-check-clang-format.t

2018-10-23 Thread Augie Fackler
queued for stable, thanks

> On Oct 23, 2018, at 08:28, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1540295181 -32400
> #  Tue Oct 23 20:46:21 2018 +0900
> # Branch stable
> # Node ID 36ba91e069486f8283199f92d6d3d19b8580e85c
> # Parent  7b48c616431d49f6ccff4cbbd155a27c46a14ff0
> exewrapper: apply clang-format to silence test-check-clang-format.t
> 
> diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
> --- a/mercurial/exewrapper.c
> +++ b/mercurial/exewrapper.c
> @@ -25,7 +25,7 @@ int strcpy_s(char *d, size_t n, const ch
> 
> #define _tcscpy_s strcpy_s
> #define _tcscat_s strcat_s
> -#define _countof(array) (sizeof(array)/sizeof(array[0]))
> +#define _countof(array) (sizeof(array) / sizeof(array[0]))
> #endif
> 
> static TCHAR pyscript[MAX_PATH + 10];
> @@ -43,7 +43,7 @@ int _tmain(int argc, TCHAR *argv[])
>   HANDLE hfind;
>   const char *err;
>   HMODULE pydll;
> - void(__cdecl * Py_SetPythonHome)(TCHAR *home);
> + void(__cdecl * Py_SetPythonHome)(TCHAR * home);
>   int(__cdecl * Py_Main)(int argc, TCHAR *argv[]);
> 
>   if (GetModuleFileName(NULL, pyscript, _countof(pyscript)) == 0) {
> @@ -86,11 +86,12 @@ int _tmain(int argc, TCHAR *argv[])
>   scenario, so let's load python dll from this dir. */
>   FindClose(hfind);
>   _tcscpy_s(pydllfile, _countof(pydllfile), pyhome);
> - _tcscat_s(pydllfile, _countof(pydllfile), _T("\\") 
> _T(HGPYTHONLIB)
> - _T(".dll"));
> + _tcscat_s(pydllfile, _countof(pydllfile),
> +   _T("\\") _T(HGPYTHONLIB) _T(".dll"));
>   pydll = LoadLibrary(pydllfile);
>   if (pydll == NULL) {
> - err = "failed to load private Python DLL " HGPYTHONLIB 
> ".dll";
> + err = "failed to load private Python DLL " HGPYTHONLIB
> +   ".dll";
>   goto bail;
>   }
>   Py_SetPythonHome =
> ___
> 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


D5183: narrow: rework logic to check whether we need to widen and narrow

2018-10-23 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch reworks logic which calculates whether we need to extend or narrow
  our working copy or not.
  
  We filter the addincludes, removeincludes, addexcludes and removeexcludes 
passed
  from user to the actual added and removed includes and excludes. What that 
means
  is a user can pass an already included path as addincludes, a path which is 
not
  included as removeincludes etc. In such situations the old logic use to think 
we
  need to do some work, whereas we don't need to do that work.
  
  In old logic, even if we don't have anything new to include but it believes we
  need to call widen, this adds some good amount of work on large repository. A
  widen calls involves computing incomming csets, calling the narrow_widen() 
which
  in non-ellipses cases goes through all the set of csets which are available
  which can take ~2-3 mins on large repos. Those 2-3 minutes are spend on doing
  nothing which a client can prevent by checking is there really anything which
  needs to be included.
  
  The tests changes shows that we don't go to the server anymore in such cases
  which is nice.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5183

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  tests/test-narrow-clone-non-narrow-server.t
  tests/test-narrow-widen-no-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -144,12 +144,7 @@
 wireprotocol command
 
   $ hg tracked --addinclude widest/f
-  comparing with ssh://user@dummy/master
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 0 changesets with 0 changes to 0 files
+  nothing to extend or narrow
 
 Pull down the newly added upstream revision.
 
diff --git a/tests/test-narrow-clone-non-narrow-server.t 
b/tests/test-narrow-clone-non-narrow-server.t
--- a/tests/test-narrow-clone-non-narrow-server.t
+++ b/tests/test-narrow-clone-non-narrow-server.t
@@ -58,7 +58,11 @@
   comparing with http://localhost:$HGPORT1/
   searching for changes
   looking for local changes to affected paths
+
   $ hg tracked --addinclude f1 http://localhost:$HGPORT1/
+  nothing to extend or narrow
+
+  $ hg tracked --addinclude f9 http://localhost:$HGPORT1/
   comparing with http://localhost:$HGPORT1/
   abort: server does not support narrow clones
   [255]
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -392,9 +392,21 @@
 removedincludes = narrowspec.parsepatterns(opts['removeinclude'])
 addedexcludes = narrowspec.parsepatterns(opts['addexclude'])
 removedexcludes = narrowspec.parsepatterns(opts['removeexclude'])
+
+only_show = not (addedincludes or removedincludes or addedexcludes or
+ removedexcludes or newrules)
+
+oldincludes, oldexcludes = repo.narrowpats
+
+# filter the user passed additions and deletions into actual additions and
+# deletions of excludes and includes
+addedincludes = set([i for i in addedincludes if i not in oldincludes])
+removedincludes = set([i for i in removedincludes if i in oldincludes])
+addedexcludes = set([i for i in addedexcludes if i not in oldexcludes])
+removedexcludes = set([i for i in removedexcludes if i in oldexcludes])
+
 widening = addedincludes or removedexcludes
 narrowing = removedincludes or addedexcludes
-only_show = not widening and not narrowing
 
 # Only print the current narrowspec.
 if only_show:
@@ -413,6 +425,10 @@
 fm.end()
 return 0
 
+if not widening and not narrowing:
+ui.status(_("nothing to extend or narrow\n"))
+return 0
+
 with repo.wlock(), repo.lock():
 cmdutil.bailifchanged(repo)
 
@@ -432,7 +448,6 @@
 
 commoninc = discovery.findcommonincoming(repo, remote)
 
-oldincludes, oldexcludes = repo.narrowpats
 if narrowing:
 newincludes = oldincludes - removedincludes
 newexcludes = oldexcludes | addedexcludes



To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5182: tests: show that adding an already included path still calls narrow_widen()

2018-10-23 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds tests demonstrating that we still go to the server in
  non-ellipses widening when we have that path already on the client and there 
is
  nothing new to download.
  
  The next patch will try to make client side logic smart and not go to the 
server
  if we don't need to download anything.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5182

AFFECTED FILES
  tests/test-narrow-widen-no-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -140,6 +140,17 @@
   $ hg id -n
   2
 
+Test that extending already included files should not call narrow_widen
+wireprotocol command
+
+  $ hg tracked --addinclude widest/f
+  comparing with ssh://user@dummy/master
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 0 changes to 0 files
+
 Pull down the newly added upstream revision.
 
   $ hg pull



To: pulkit, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 3] branchmap: do not specify changelog as an argument

2018-10-23 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1540296673 -32400
#  Tue Oct 23 21:11:13 2018 +0900
# Node ID 9dbe2753c9eabb95eda4cb8be726dd5e29f4cc7a
# Parent  759c7efd7c9132ce6dac5bbd9a37e70acb420d24
branchmap: do not specify changelog as an argument

Since (unfiltered)repo.changelog lookup gets as fast as __dict__ lookup,
there's no point to pass in changelog instance.

  $ hg perfbranchmap --clear-revbranch -R mozilla-central
  ! base
  (orig) wall 20.593091 comb 20.60 user 20.52 sys 0.08 (best of 3)
  (this) wall 20.129126 comb 20.13 user 20.02 sys 0.11 (best of 3)

This backs out most of the changes in 76d4272bd57b and 47c03042cd1d.

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -281,7 +281,7 @@ class branchcache(dict):
 newbranches = {}
 getbranchinfo = repo.revbranchcache().branchinfo
 for r in revgen:
-branch, closesbranch = getbranchinfo(r, changelog=cl)
+branch, closesbranch = getbranchinfo(r)
 newbranches.setdefault(branch, []).append(r)
 if closesbranch:
 self._closednodes.add(cl.node(r))
@@ -407,10 +407,10 @@ class revbranchcache(object):
 self._rbcrevslen = len(self._repo.changelog)
 self._rbcrevs = bytearray(self._rbcrevslen * _rbcrecsize)
 
-def branchinfo(self, rev, changelog=None):
+def branchinfo(self, rev):
 """Return branch name and close flag for rev, using and updating
 persistent cache."""
-changelog = changelog or self._repo.changelog
+changelog = self._repo.changelog
 rbcrevidx = rev * _rbcrecsize
 
 # avoid negative index, changelog.read(nullrev) is fast without cache
@@ -419,7 +419,7 @@ class revbranchcache(object):
 
 # if requested rev isn't allocated, grow and cache the rev info
 if len(self._rbcrevs) < rbcrevidx + _rbcrecsize:
-return self._branchinfo(rev, changelog=changelog)
+return self._branchinfo(rev)
 
 # fast path: extract data from cache, use it if node is matching
 reponode = changelog.node(rev)[:_rbcnodelen]
@@ -447,11 +447,11 @@ class revbranchcache(object):
 self._rbcrevslen = min(self._rbcrevslen, truncate)
 
 # fall back to slow path and make sure it will be written to disk
-return self._branchinfo(rev, changelog=changelog)
+return self._branchinfo(rev)
 
-def _branchinfo(self, rev, changelog=None):
+def _branchinfo(self, rev):
 """Retrieve branch info from changelog and update _rbcrevs"""
-changelog = changelog or self._repo.changelog
+changelog = self._repo.changelog
 b, close = changelog.branchinfo(rev)
 if b in self._namesreverse:
 branchidx = self._namesreverse[b]
@@ -462,7 +462,7 @@ class revbranchcache(object):
 reponode = changelog.node(rev)
 if close:
 branchidx |= _rbccloseflag
-self._setcachedata(rev, reponode, branchidx, changelog)
+self._setcachedata(rev, reponode, branchidx)
 return b, close
 
 def setdata(self, branch, rev, node, close):
@@ -485,16 +485,14 @@ class revbranchcache(object):
 if r'branchinfo' in vars(self):
 del self.branchinfo
 
-def _setcachedata(self, rev, node, branchidx, changelog=None):
+def _setcachedata(self, rev, node, branchidx):
 """Writes the node's branch data to the in-memory cache data."""
 if rev == nullrev:
 return
-
-changelog = changelog or self._repo.changelog
 rbcrevidx = rev * _rbcrecsize
 if len(self._rbcrevs) < rbcrevidx + _rbcrecsize:
 self._rbcrevs.extend('\0' *
- (len(changelog) * _rbcrecsize -
+ (len(self._repo.changelog) * _rbcrecsize -
   len(self._rbcrevs)))
 pack_into(_rbcrecfmt, self._rbcrevs, rbcrevidx, node, branchidx)
 self._rbcrevslen = min(self._rbcrevslen, rev)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3] filecache: unimplement __set__() and __delete__() (API)

2018-10-23 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1540025760 -32400
#  Sat Oct 20 17:56:00 2018 +0900
# Node ID 759c7efd7c9132ce6dac5bbd9a37e70acb420d24
# Parent  6a3a42dfcdd0ccb628ae3b8f3129b26db32a7ff0
filecache: unimplement __set__() and __delete__() (API)

Implementing __set__() implies that the descriptor can't be overridden by
obj.__dict__, which means any property access involves slow function call.

  "Data descriptors with __set__() and __get__() defined always override
  a redefinition in an instance dictionary. In contrast, non-data descriptors
  can be overridden by instances."

  https://docs.python.org/2.7/reference/datamodel.html#invoking-descriptors

This patch basically backs out 236bb604dc39, "scmutil: update cached copy
when filecached attribute is assigned (issue3263)." The problem described
in issue3263 (which is #3264 in Bugzilla) should no longer happen since
repo._bookmarkcurrent has been moved to repo._bookmarks.active. We still
have a risk of introducing similar bugs, but I think that's the cost we
have to pay.

  $ hg perfrevset 'branch(tip)' -R mercurial
  (orig) wall 0.139511 comb 0.14 user 0.14 sys 0.00 (best of 66)
  (prev) wall 0.114195 comb 0.11 user 0.11 sys 0.00 (best of 81)
  (this) wall 0.099038 comb 0.11 user 0.10 sys 0.01 (best of 93)

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -317,7 +317,7 @@ class dirstate(object):
 return copies
 
 def setbranch(self, branch):
-self._branch = encoding.fromlocal(branch)
+self.__class__._branch.set(self, encoding.fromlocal(branch))
 f = self._opener('branch', 'w', atomictemp=True, checkambig=True)
 try:
 f.write(self._branch + '\n')
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -91,17 +91,16 @@ class _basefilecache(scmutil.filecache):
 def __get__(self, repo, type=None):
 if repo is None:
 return self
-# inlined the fast path as the cost of function call matters
+# proxy to unfiltered __dict__ since filtered repo has no entry
 unfi = repo.unfiltered()
 try:
 return unfi.__dict__[self.sname]
 except KeyError:
 pass
 return super(_basefilecache, self).__get__(unfi, type)
-def __set__(self, repo, value):
-return super(_basefilecache, self).__set__(repo.unfiltered(), value)
-def __delete__(self, repo):
-return super(_basefilecache, self).__delete__(repo.unfiltered())
+
+def set(self, repo, value):
+return super(_basefilecache, self).set(repo.unfiltered(), value)
 
 class repofilecache(_basefilecache):
 """filecache for files in .hg but outside of .hg/store"""
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1249,16 +1249,15 @@ class filecache(object):
 results cached. The decorated function is called. The results are stashed
 away in a ``_filecache`` dict on the object whose method is decorated.
 
-On subsequent access, the cached result is returned.
-
-On external property set operations, stat() calls are performed and the new
-value is cached.
+On subsequent access, the cached result is used as it is set to the
+instance dictionary.
 
-On property delete operations, cached data is removed.
+On external property set/delete operations, the caller must update the
+corresponding _filecache entry appropriately. Use __class__..set()
+instead of directly setting .
 
-When using the property API, cached data is always returned, if available:
-no stat() is performed to check if the file has changed and if the function
-needs to be called to reflect file changes.
+When using the property API, the cached data is always used if available.
+No stat() is performed to check if the file has changed.
 
 Others can muck about with the state of the ``_filecache`` dict. e.g. they
 can populate an entry before the property's getter is called. In this case,
@@ -1291,11 +1290,8 @@ class filecache(object):
 # if accessed on the class, return the descriptor itself.
 if obj is None:
 return self
-# do we need to check if the file changed?
-try:
-return obj.__dict__[self.sname]
-except KeyError:
-pass
+
+assert self.sname not in obj.__dict__
 
 entry = obj._filecache.get(self.name)
 
@@ -1315,7 +1311,10 @@ class filecache(object):
 obj.__dict__[self.sname] = entry.obj
 return entry.obj
 
-def __set__(self, obj, value):
+# don't implement __set__(), which would make __dict__ lookup as slow as
+# function call.
+
+def set(self, obj, value):
 if self.name not in obj._filecache:
 # we add an entry for the 

[PATCH 1 of 3] filecache: use try-except for faster __dict__ lookup

2018-10-23 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1540030385 -32400
#  Sat Oct 20 19:13:05 2018 +0900
# Node ID 6a3a42dfcdd0ccb628ae3b8f3129b26db32a7ff0
# Parent  dce0e0f78f0f10578a17b586fe061e1985dd5c5f
filecache: use try-except for faster __dict__ lookup

Python function call is slow, and the cost could be significant here.

  $ hg perfrevset 'branch(tip)' -R mercurial
  (orig) wall 0.139511 comb 0.14 user 0.14 sys 0.00 (best of 66)
  (this) wall 0.114195 comb 0.11 user 0.11 sys 0.00 (best of 81)

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -91,7 +91,13 @@ class _basefilecache(scmutil.filecache):
 def __get__(self, repo, type=None):
 if repo is None:
 return self
-return super(_basefilecache, self).__get__(repo.unfiltered(), type)
+# inlined the fast path as the cost of function call matters
+unfi = repo.unfiltered()
+try:
+return unfi.__dict__[self.sname]
+except KeyError:
+pass
+return super(_basefilecache, self).__get__(unfi, type)
 def __set__(self, repo, value):
 return super(_basefilecache, self).__set__(repo.unfiltered(), value)
 def __delete__(self, repo):
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1292,9 +1292,10 @@ class filecache(object):
 if obj is None:
 return self
 # do we need to check if the file changed?
-if self.sname in obj.__dict__:
-assert self.name in obj._filecache, self.name
+try:
 return obj.__dict__[self.sname]
+except KeyError:
+pass
 
 entry = obj._filecache.get(self.name)
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH STABLE] exewrapper: apply clang-format to silence test-check-clang-format.t

2018-10-23 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1540295181 -32400
#  Tue Oct 23 20:46:21 2018 +0900
# Branch stable
# Node ID 36ba91e069486f8283199f92d6d3d19b8580e85c
# Parent  7b48c616431d49f6ccff4cbbd155a27c46a14ff0
exewrapper: apply clang-format to silence test-check-clang-format.t

diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
--- a/mercurial/exewrapper.c
+++ b/mercurial/exewrapper.c
@@ -25,7 +25,7 @@ int strcpy_s(char *d, size_t n, const ch
 
 #define _tcscpy_s strcpy_s
 #define _tcscat_s strcat_s
-#define _countof(array) (sizeof(array)/sizeof(array[0]))
+#define _countof(array) (sizeof(array) / sizeof(array[0]))
 #endif
 
 static TCHAR pyscript[MAX_PATH + 10];
@@ -43,7 +43,7 @@ int _tmain(int argc, TCHAR *argv[])
HANDLE hfind;
const char *err;
HMODULE pydll;
-   void(__cdecl * Py_SetPythonHome)(TCHAR *home);
+   void(__cdecl * Py_SetPythonHome)(TCHAR * home);
int(__cdecl * Py_Main)(int argc, TCHAR *argv[]);
 
if (GetModuleFileName(NULL, pyscript, _countof(pyscript)) == 0) {
@@ -86,11 +86,12 @@ int _tmain(int argc, TCHAR *argv[])
scenario, so let's load python dll from this dir. */
FindClose(hfind);
_tcscpy_s(pydllfile, _countof(pydllfile), pyhome);
-   _tcscat_s(pydllfile, _countof(pydllfile), _T("\\") 
_T(HGPYTHONLIB)
-   _T(".dll"));
+   _tcscat_s(pydllfile, _countof(pydllfile),
+ _T("\\") _T(HGPYTHONLIB) _T(".dll"));
pydll = LoadLibrary(pydllfile);
if (pydll == NULL) {
-   err = "failed to load private Python DLL " HGPYTHONLIB 
".dll";
+   err = "failed to load private Python DLL " HGPYTHONLIB
+ ".dll";
goto bail;
}
Py_SetPythonHome =
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@40407: new changeset

2018-10-23 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/3d76a8e627a6
changeset:   40407:3d76a8e627a6
bookmark:@default
tag: tip
parent:  40403:bf249bb60087
user:Martin von Zweigbergk 
date:Tue Sep 05 15:21:21 2017 -0700
summary: archive: change "matcnfn" argument to a real matcher

-- 
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


D5156: help: displaying extension commands by default

2018-10-23 Thread rdamazio (Rodrigo Damazio Bovendorp)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdce0e0f78f0f: help: displaying extension commands by 
default (authored by rdamazio, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5156?vs=12257=12319#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5156?vs=12257=12319

REVISION DETAIL
  https://phab.mercurial-scm.org/D5156

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -820,6 +820,11 @@
   > def nohelp(ui, *args, **kwargs):
   > pass
   > 
+  > @command(b'hashelp', [], b'hg hashelp', norepo=True)
+  > def hashelp(ui, *args, **kwargs):
+  > """Extension command's help"""
+  > pass
+  > 
   > def uisetup(ui):
   > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
   > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
@@ -904,6 +909,19 @@
   
   (some details hidden, use --verbose to show complete help)
 
+Test that default list of commands includes extension commands that have help,
+but not those that don't, except in verbose mode, when a keyword is passed, or
+when help about the extension is requested.
+
+#if no-extraextensions
+
+  $ hg help | grep hashelp
+   hashelp   Extension command's help
+  $ hg help | grep nohelp
+  [1]
+  $ hg help -v | grep nohelp
+   nohelp(no help text available)
+
   $ hg help -k nohelp
   Commands:
   
@@ -913,144 +931,15 @@
   
nohelp (no help text available)
 
-Test that default list of commands omits extension commands
-
-#if no-extraextensions
-
-  $ hg help
-  Mercurial Distributed SCM
+  $ hg help helpext
+  helpext extension - no help text available
   
   list of commands:
   
-  Repository creation:
-  
-   clone make a copy of an existing repository
-   init  create a new repository in the given directory
-  
-  Remote repository management:
-  
-   incoming  show new changesets found in source
-   outgoing  show changesets not found in the destination
-   paths show aliases for remote repositories
-   pull  pull changes from the specified source
-   push  push changes to the specified destination
-   serve start stand-alone webserver
-  
-  Change creation:
-  
-   commitcommit the specified files or all outstanding changes
-  
-  Change manipulation:
-  
-   backout   reverse effect of earlier changeset
-   graft copy changes from other branches onto the current branch
-   merge merge another revision into working directory
-  
-  Change organization:
-  
-   bookmarks create a new bookmark or list existing bookmarks
-   branchset or show the current branch name
-   branches  list repository named branches
-   phase set or show the current phase name
-   tag   add one or more tags for the current or given revision
-   tags  list repository tags
-  
-  File content management:
-  
-   annotate  show changeset information by line for each file
-   cat   output the current or given revision of files
-   copy  mark files as copied for the next commit
-   diff  diff repository (or selected files)
-   grep  search revision history for a pattern in specified files
-  
-  Change navigation:
-  
-   bisectsubdivision search of changesets
-   heads show branch heads
-   hgalias   My doc
-   identify  identify the working directory or specified revision
-   log   show revision history of entire repository or files
-  
-  Working directory management:
-  
-   add   add the specified files on the next commit
-   addremove add all new files, delete all missing files
-   files list tracked files
-   forgetforget the specified files on the next commit
-   removeremove the specified files on the next commit
-   renamerename files; equivalent of copy + remove
-   resolve   redo merges or set/view the merge status of files
-   revertrestore files to their checkout state
-   root  print the root (top) of the current working directory
-   statusshow changed files in the working directory
-   summary   summarize working directory state
-   updateupdate working directory (or switch revisions)
-  
-  Change import/export:
-  
-   archive   create an unversioned archive of a repository revision
-   bundlecreate a bundle file
-   exportdump the header and diffs for one or more changesets
-   importimport an ordered set of patches
-   unbundle  apply one or more bundle files
-  
-  Repository maintenance:
-  
-   manifest  output the current or given revision of the project manifest
-   recover   roll back an interrupted transaction
-   verifyverify the integrity of the 

D5087: help: displaying documented aliases by default

2018-10-23 Thread rdamazio (Rodrigo Damazio Bovendorp)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG444861dc1e55: help: displaying documented aliases by 
default (authored by rdamazio, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5087?vs=12256=12318#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5087?vs=12256=12318

REVISION DETAIL
  https://phab.mercurial-scm.org/D5087

AFFECTED FILES
  mercurial/dispatch.py
  mercurial/help.py
  mercurial/registrar.py
  tests/test-alias.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -823,18 +823,38 @@
   > def uisetup(ui):
   > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
   > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
+  > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
+  > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
+  > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
   > 
   > EOF
   $ echo '[extensions]' >> $HGRCPATH
   $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
 
 Test for aliases
 
+  $ hg help | grep hgalias
+   hgalias   My doc
+
   $ hg help hgalias
   hg hgalias [--remote]
   
   alias for: hg summary
   
+  My doc
+  
+  defined by: helpext
+  
+  options:
+  
+--remote check for push and pull
+  
+  (some details hidden, use --verbose to show complete help)
+  $ hg help hgaliasnodoc
+  hg hgaliasnodoc [--remote]
+  
+  alias for: hg summary
+  
   summarize working directory state
   
   This generates a brief summary of the working directory state, including
@@ -947,6 +967,7 @@
   
bisectsubdivision search of changesets
heads show branch heads
+   hgalias   My doc
identify  identify the working directory or specified revision
log   show revision history of entire repository or files
   
@@ -2662,6 +2683,13 @@
   hgalias
   
   
+  My doc
+  
+  
+  
+  hgaliasnodoc
+  
+  
   summarize working directory state
   
   
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -68,17 +68,17 @@
 help
 
   $ hg help -c | grep myinit
-   myinit This is my documented alias for init.
+   myinit   This is my documented alias for init.
   $ hg help -c | grep mycommit
-   mycommit   This is my alias with only doc.
+   mycommit This is my alias with only doc.
   $ hg help -c | grep cleanstatus
-   cleanstatusshow changed files in the working directory
+  [1]
   $ hg help -c | grep lognull
-   lognullLogs the null rev
+   lognull  Logs the null rev
   $ hg help -c | grep dln
-   dlnLogs the null rev
+  [1]
   $ hg help -c | grep recursivedoc
-   recursivedoc   Logs the null rev in debug mode
+   recursivedoc Logs the null rev in debug mode
   $ hg help myinit
   hg myinit [OPTIONS] [BLA] [BLE]
   
@@ -602,7 +602,7 @@
 help for a shell alias
 
   $ hg help -c | grep rebate
-   rebate This is my alias which just prints something.
+   rebate   This is my alias which just prints something.
   $ hg help rebate
   hg rebate [MYARGS]
   
diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -169,6 +169,10 @@
 """
 
 # Command categories for grouping them in help output.
+# These can also be specified for aliases, like:
+# [alias]
+# myalias = something
+# myalias:category = repo
 CATEGORY_REPO_CREATION = 'repo'
 CATEGORY_REMOTE_REPO_MANAGEMENT = 'remote'
 CATEGORY_COMMITTING = 'commit'
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -189,12 +189,25 @@
 if notomitted:
 rst.append('\n\n.. container:: notomitted\n\n%s\n\n' % notomitted)
 
-def filtercmd(ui, cmd, kw, doc):
+def filtercmd(ui, cmd, func, kw, doc):
 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
+# Debug command, and user is not looking for those.
 return True
-if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
+if not ui.verbose:
+if not kw and not doc:
+# Command had no documentation, no point in showing it by default.
+return True
+if getattr(func, 'alias', False) and not getattr(func, 'owndoc', 
False):
+# Alias didn't have its own documentation.
+return True
+if doc and any(w in doc for w in _exclkeywords):
+# Documentation has excluded keywords.
+return True
+if kw == "shortlist" and not getattr(func, 'helpbasic', False):
+# We're presenting the short list but the command is not basic.
 return True
 if ui.configbool('help', 'hidden-command.%s' % cmd):
+# Configuration explicitly 

D5077: help: allow hiding of help topics

2018-10-23 Thread rdamazio (Rodrigo Damazio Bovendorp)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1ddd202c47d9: help: allow hiding of help topics (authored 
by rdamazio, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5077?vs=12255=12317#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5077?vs=12255=12317

REVISION DETAIL
  https://phab.mercurial-scm.org/D5077

AFFECTED FILES
  mercurial/configitems.py
  mercurial/help.py
  tests/test-help-hide.t

CHANGE DETAILS

diff --git a/tests/test-help-hide.t b/tests/test-help-hide.t
--- a/tests/test-help-hide.t
+++ b/tests/test-help-hide.t
@@ -125,3 +125,131 @@
scripting Using Mercurial from scripts and automation
   
   (use 'hg help -v' to show built-in aliases and global options)
+
+Test hiding some topics.
+
+  $ hg --config help.hidden-topic.deprecated=true \
+  > --config help.hidden-topic.internals=true \
+  > --config help.hidden-topic.scripting=true help
+  Mercurial Distributed SCM
+  
+  list of commands:
+  
+  Repository creation:
+  
+   clone make a copy of an existing repository
+   init  create a new repository in the given directory
+  
+  Remote repository management:
+  
+   incoming  show new changesets found in source
+   outgoing  show changesets not found in the destination
+   paths show aliases for remote repositories
+   pull  pull changes from the specified source
+   push  push changes to the specified destination
+   serve start stand-alone webserver
+  
+  Change creation:
+  
+   commitcommit the specified files or all outstanding changes
+  
+  Change manipulation:
+  
+   backout   reverse effect of earlier changeset
+   graft copy changes from other branches onto the current branch
+   merge merge another revision into working directory
+  
+  Change organization:
+  
+   bookmarks create a new bookmark or list existing bookmarks
+   branchset or show the current branch name
+   branches  list repository named branches
+   phase set or show the current phase name
+   tag   add one or more tags for the current or given revision
+   tags  list repository tags
+  
+  File content management:
+  
+   annotate  show changeset information by line for each file
+   cat   output the current or given revision of files
+   copy  mark files as copied for the next commit
+   diff  diff repository (or selected files)
+   grep  search revision history for a pattern in specified files
+  
+  Change navigation:
+  
+   bisectsubdivision search of changesets
+   heads show branch heads
+   identify  identify the working directory or specified revision
+   log   show revision history of entire repository or files
+  
+  Working directory management:
+  
+   add   add the specified files on the next commit
+   addremove add all new files, delete all missing files
+   files list tracked files
+   forgetforget the specified files on the next commit
+   removeremove the specified files on the next commit
+   renamerename files; equivalent of copy + remove
+   resolve   redo merges or set/view the merge status of files
+   revertrestore files to their checkout state
+   root  print the root (top) of the current working directory
+   statusshow changed files in the working directory
+   summary   summarize working directory state
+   updateupdate working directory (or switch revisions)
+  
+  Change import/export:
+  
+   archive   create an unversioned archive of a repository revision
+   bundlecreate a bundle file
+   exportdump the header and diffs for one or more changesets
+   importimport an ordered set of patches
+   unbundle  apply one or more bundle files
+  
+  Repository maintenance:
+  
+   manifest  output the current or given revision of the project manifest
+   recover   roll back an interrupted transaction
+   verifyverify the integrity of the repository
+  
+  Help:
+  
+   configshow combined config settings from all hgrc files
+   help  show help for a given topic or a help overview
+   version   output version and copyright information
+  
+  additional help topics:
+  
+  Mercurial identifiers:
+  
+   filesets  Specifying File Sets
+   hgignore  Syntax for Mercurial Ignore Files
+   patterns  File Name Patterns
+   revisions Specifying Revisions
+   urls  URL Paths
+  
+  Mercurial output:
+  
+   color Colorizing Outputs
+   dates Date Formats
+   diffs Diff Formats
+   templatingTemplate Usage
+  
+  Mercurial configuration:
+  
+   configConfiguration Files
+   environment   Environment Variables
+   extensionsUsing Additional Features
+   flags 

D5076: help: allow commands to be hidden

2018-10-23 Thread rdamazio (Rodrigo Damazio Bovendorp)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGab09e797fbed: help: allow commands to be hidden (authored 
by rdamazio, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5076?vs=12254=12316

REVISION DETAIL
  https://phab.mercurial-scm.org/D5076

AFFECTED FILES
  mercurial/configitems.py
  mercurial/help.py
  tests/test-help-hide.t

CHANGE DETAILS

diff --git a/tests/test-help-hide.t b/tests/test-help-hide.t
new file mode 100644
--- /dev/null
+++ b/tests/test-help-hide.t
@@ -0,0 +1,127 @@
+Test hiding some commands (which also happens to hide an entire category).
+
+  $ hg --config help.hidden-command.clone=true \
+  > --config help.hidden-command.init=true help
+  Mercurial Distributed SCM
+  
+  list of commands:
+  
+  Remote repository management:
+  
+   incoming  show new changesets found in source
+   outgoing  show changesets not found in the destination
+   paths show aliases for remote repositories
+   pull  pull changes from the specified source
+   push  push changes to the specified destination
+   serve start stand-alone webserver
+  
+  Change creation:
+  
+   commitcommit the specified files or all outstanding changes
+  
+  Change manipulation:
+  
+   backout   reverse effect of earlier changeset
+   graft copy changes from other branches onto the current branch
+   merge merge another revision into working directory
+  
+  Change organization:
+  
+   bookmarks create a new bookmark or list existing bookmarks
+   branchset or show the current branch name
+   branches  list repository named branches
+   phase set or show the current phase name
+   tag   add one or more tags for the current or given revision
+   tags  list repository tags
+  
+  File content management:
+  
+   annotate  show changeset information by line for each file
+   cat   output the current or given revision of files
+   copy  mark files as copied for the next commit
+   diff  diff repository (or selected files)
+   grep  search revision history for a pattern in specified files
+  
+  Change navigation:
+  
+   bisectsubdivision search of changesets
+   heads show branch heads
+   identify  identify the working directory or specified revision
+   log   show revision history of entire repository or files
+  
+  Working directory management:
+  
+   add   add the specified files on the next commit
+   addremove add all new files, delete all missing files
+   files list tracked files
+   forgetforget the specified files on the next commit
+   removeremove the specified files on the next commit
+   renamerename files; equivalent of copy + remove
+   resolve   redo merges or set/view the merge status of files
+   revertrestore files to their checkout state
+   root  print the root (top) of the current working directory
+   statusshow changed files in the working directory
+   summary   summarize working directory state
+   updateupdate working directory (or switch revisions)
+  
+  Change import/export:
+  
+   archive   create an unversioned archive of a repository revision
+   bundlecreate a bundle file
+   exportdump the header and diffs for one or more changesets
+   importimport an ordered set of patches
+   unbundle  apply one or more bundle files
+  
+  Repository maintenance:
+  
+   manifest  output the current or given revision of the project manifest
+   recover   roll back an interrupted transaction
+   verifyverify the integrity of the repository
+  
+  Help:
+  
+   configshow combined config settings from all hgrc files
+   help  show help for a given topic or a help overview
+   version   output version and copyright information
+  
+  additional help topics:
+  
+  Mercurial identifiers:
+  
+   filesets  Specifying File Sets
+   hgignore  Syntax for Mercurial Ignore Files
+   patterns  File Name Patterns
+   revisions Specifying Revisions
+   urls  URL Paths
+  
+  Mercurial output:
+  
+   color Colorizing Outputs
+   dates Date Formats
+   diffs Diff Formats
+   templatingTemplate Usage
+  
+  Mercurial configuration:
+  
+   configConfiguration Files
+   environment   Environment Variables
+   extensionsUsing Additional Features
+   flags Command-line flags
+   hgweb Configuring hgweb
+   merge-tools   Merge Tools
+   pager Pager Support
+  
+  Concepts:
+  
+   bundlespecBundle File Formats
+   glossary  Glossary
+   phasesWorking with Phases
+   subrepos  Subrepositories
+  
+  Miscellaneous:
+  
+   deprecatedDeprecated Features
+   internals Technical 

D5174: py3: make sure we pass sysstr in sqlite3.connect()

2018-10-23 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3b782669561d: py3: make sure we pass sysstr in 
sqlite3.connect() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5174?vs=12293=12314

REVISION DETAIL
  https://phab.mercurial-scm.org/D5174

AFFECTED FILES
  hgext/sqlitestore.py

CHANGE DETAILS

diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py
--- a/hgext/sqlitestore.py
+++ b/hgext/sqlitestore.py
@@ -63,6 +63,7 @@
 from mercurial import (
 ancestor,
 dagop,
+encoding,
 error,
 extensions,
 localrepo,
@@ -1020,7 +1021,7 @@
 def makedb(path):
 """Construct a database handle for a database at path."""
 
-db = sqlite3.connect(path)
+db = sqlite3.connect(encoding.strfromlocal(path))
 db.text_factory = bytes
 
 res = db.execute(r'PRAGMA user_version').fetchone()[0]



To: pulkit, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5175: py3: add one more passing test to whitelist

2018-10-23 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbad46c934c31: py3: add one more passing test to whitelist 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5175?vs=12287=12315

REVISION DETAIL
  https://phab.mercurial-scm.org/D5175

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
@@ -261,6 +261,7 @@
 test-identify.t
 test-impexp-branch.t
 test-import-bypass.t
+test-import-context.t
 test-import-eol.t
 test-import-merge.t
 test-import-unknown.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


D5087: help: displaying documented aliases by default

2018-10-23 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Queued the series for 4.9, many thanks.
  
  > @@ -523,16 +538,20 @@
  > 
  >   f = fs[0]
  >   syns[f] = ', '.join(fs)
  >   func = e[0]
  > 
  > +alias = getattr(func, 'alias', False)
  
  Removed unused variable `alias`.
  
  > @@ -554,11 +557,14 @@
  > 
  > 1. drop prefix in old-style help lines so hg shows the alias self.help = 
self.help[4 + len(cmd):]
  > 
  >   +self.owndoc = 'doc' in cfg doc = cfg.get('doc', 
pycompat.getdoc(fn)) if doc is not None: doc = pycompat.sysstr(doc) 
self.__doc__ = doc
  > 
  >   +self.helpcategory = cfg.get('category', 
registrar.command.CATEGORY_NONE)
  
  Maybe the default can be derived from the aliased command?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5087

To: rdamazio, #hg-reviewers, durin42, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5087: help: displaying documented aliases by default

2018-10-23 Thread Yuya Nishihara
Queued the series for 4.9, many thanks.

> @@ -523,16 +538,20 @@
>  f = fs[0]
>  syns[f] = ', '.join(fs)
>  func = e[0]
> +alias = getattr(func, 'alias', False)

Removed unused variable `alias`.

> @@ -554,11 +557,14 @@
>  # drop prefix in old-style help lines so hg shows the alias
>  self.help = self.help[4 + len(cmd):]
>  
> +self.owndoc = 'doc' in cfg
>  doc = cfg.get('doc', pycompat.getdoc(fn))
>  if doc is not None:
>  doc = pycompat.sysstr(doc)
>  self.__doc__ = doc
>  
> +self.helpcategory = cfg.get('category', 
> registrar.command.CATEGORY_NONE)

Maybe the default can be derived from the aliased command?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel