Re: [PATCH 1 of 2 V2] manifest: allow specifying the revlog filename

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Tue, Feb 28, 2017 at 11:44 AM, Durham Goode  wrote:
> # HG changeset patch
> # User Durham Goode 
> # Date 1488304382 28800
> #  Tue Feb 28 09:53:02 2017 -0800
> # Node ID 0a5e6ad0a25c348384bb6c14a51057b3587e2857
> # Parent  88203f26ea57627cabd7cf9c4f7843661d6c43ae
> manifest: allow specifying the revlog filename
>
> Previously we had hardcoded the manifest filename to be 00manifest.i. In our
> external treemanifest extension, we want to allow writing a treemanifest side 
> by
> side with a flat manifest, so we need to be able to store the root revisions 
> at
> a different location (in our extension we use 00manifesttree.i).
>
> This patches moves the revlog name to a parameter so we can adjust it.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -1132,7 +1132,13 @@ class manifestrevlog(revlog.revlog):
>  '''A revlog that stores manifest texts. This is responsible for caching 
> the
>  full-text manifest contents.
>  '''
> -def __init__(self, opener, dir='', dirlogcache=None):
> +def __init__(self, opener, dir='', dirlogcache=None,
> + indexfile='00manifest.i'):
> +"""Constructs a new manifest revlog
> +
> +`indexfile` - used by extensions to have two manifests at once, like
> +when transitioning between flatmanifeset and treemanifests.
> +"""
>  # During normal operations, we expect to deal with not more than four
>  # revs at a time (such as during commit --amend). When rebasing large
>  # stacks of commits, the number can go up, hence the config knob 
> below.
> @@ -1150,12 +1156,11 @@ class manifestrevlog(revlog.revlog):
>
>  self._fulltextcache = util.lrucachedict(cachesize)
>
> -indexfile = "00manifest.i"
>  if dir:
>  assert self._treeondisk, 'opts is %r' % opts
>  if not dir.endswith('/'):
>  dir = dir + '/'
> -indexfile = "meta/" + dir + "00manifest.i"
> +indexfile = "meta/" + dir + indexfile
>  self._dir = dir
>  # The dirlogcache is kept on the root manifest log
>  if dir:

What I meant was for indexfile==None to be the default. I think it's
easier to follow if indexfile being set means that that's the exact
name to use. It also gives more flexibility to put the subdirectory
files in a different place. The patch would then look as follows. I
think that means your extension will pass None where it would pass
"00manifest.i" with your version above, so I assume it's similarly
simple. What do you think?

diff -r 0bb3089fe735 mercurial/manifest.py
--- a/mercurial/manifest.py Sat Feb 25 14:09:55 2017 +0900
+++ b/mercurial/manifest.py Tue Feb 28 22:17:28 2017 -0800
@@ -1132,7 +1132,12 @@ class manifestrevlog(revlog.revlog):
 '''A revlog that stores manifest texts. This is responsible for caching the
 full-text manifest contents.
 '''
-def __init__(self, opener, dir='', dirlogcache=None):
+def __init__(self, opener, dir='', dirlogcache=None, indexfile=None):
+"""Constructs a new manifest revlog
+
+`indexfile` - used by extensions to have two manifests at once, like
+when transitioning between flatmanifeset and treemanifests.
+"""
 # During normal operations, we expect to deal with not more than four
 # revs at a time (such as during commit --amend). When rebasing large
 # stacks of commits, the number can go up, hence the config knob below.
@@ -1150,12 +1155,15 @@ class manifestrevlog(revlog.revlog):

 self._fulltextcache = util.lrucachedict(cachesize)

-indexfile = "00manifest.i"
 if dir:
 assert self._treeondisk, 'opts is %r' % opts
 if not dir.endswith('/'):
 dir = dir + '/'
-indexfile = "meta/" + dir + "00manifest.i"
+
+if indexfile is None:
+indexfile = "00manifest.i"
+if dir:
+indexfile = "meta/" + dir + "00manifest.i"
 self._dir = dir
 # The dirlogcache is kept on the root manifest log
 if dir:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] internals: add some brief documentation about censor

2017-02-28 Thread Matt Harbison

On Mon, 27 Feb 2017 18:11:15 -0500, Augie Fackler  wrote:


# HG changeset patch
# User Augie Fackler 
# Date 1485220644 18000
#  Mon Jan 23 20:17:24 2017 -0500
# Node ID 065219350c9ce3c31a35d13fe97be0673e321e09
# Parent  3f8f53190d6afed0aca6c6527236edad28ce785c
internals: add some brief documentation about censor


This is needed to keep test-install.t happy:

diff --git a/contrib/wix/help.wxs b/contrib/wix/help.wxs
--- a/contrib/wix/help.wxs
+++ b/contrib/wix/help.wxs
@@ -38,6 +38,7 @@
 
   Guid="$(var.help.internals.guid)" Win64='$(var.IsX64)'>
 KeyPath="yes" />

+
 />
 />

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


Re: [PATCH] ui: remove superfluous indent in _write()

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Feb 24, 2017 at 9:58 PM, Yuya Nishihara  wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1487999395 -32400
> #  Sat Feb 25 14:09:55 2017 +0900
> # Node ID 18c067150b3c2b55da2a72c2eec55c65de12523e
> # Parent  b4cb86ab4c719eb615a4308eafd8b1386a511eeb
> ui: remove superfluous indent in _write()

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


Re: [PATCH 6 of 8 V2] hgweb: link to diff with linerange in filelog template

2017-02-28 Thread Gregory Szorc
On Sat, Feb 25, 2017 at 1:06 AM, Denis Laxalde  wrote:

> # HG changeset patch
> # User Denis Laxalde 
> # Date 1484838729 -3600
> #  Thu Jan 19 16:12:09 2017 +0100
> # Node ID 206b34cf11b768c4e74582ffb89e78feedbce7ef
> # Parent  7fbe70c91d65683ab3984f7c80edc85f5c02860c
> # Available At https://hg.logilab.org/users/dlaxalde/hg
> #  hg pull https://hg.logilab.org/users/dlaxalde/hg -r
> 206b34cf11b7
> # EXP-Topic linerange-log/hgweb-filelog
> hgweb: link to diff with linerange in filelog template
>
> When "linerange" query parameter is present on a filelog request, the
> "diff"
> links in revision table rows will also have this parameter.
>
> Not sure this is that good from a user experience point of view, maybe an
> additional "block diff" link would be better.
>
> (Still only the gitweb template is updated.)
>
> diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/
> map
> --- a/mercurial/templates/gitweb/map
> +++ b/mercurial/templates/gitweb/map
> @@ -293,7 +293,7 @@ filelogentry = '
>  
>  
>file |
> -  diff |
> +   "?")}linerange={linerange}')}">diff |
>

{linerange} needs escaped because ':' is a reserved character in URLs. It
should be encoded as %3A in the HTML.


>annotate
>{rename%filelogrename}
>  
> diff --git a/tests/test-hgweb-filelog.t b/tests/test-hgweb-filelog.t
> --- a/tests/test-hgweb-filelog.t
> +++ b/tests/test-hgweb-filelog.t
> @@ -726,7 +726,7 @@ before addition - error
>
>
>file |
> -  diff |
> +  diff |
>annotate
>
>
> @@ -742,7 +742,7 @@ before addition - error
>
>
>file |
> -  diff |
> +  diff |
>annotate
>
>
> @@ -826,7 +826,7 @@ before addition - error
>
>
>file |
> -  diff |
> +   href="/diff/46c1a66bd8fc/c?revcount=1=gitweb=1:2">diff
> |
>annotate
>
>
> ___
> 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 2 of 8 V2] hgweb: handle a "linerange" request parameter in filelog command

2017-02-28 Thread Gregory Szorc
On Sat, Feb 25, 2017 at 1:05 AM, Denis Laxalde  wrote:

> # HG changeset patch
> # User Denis Laxalde 
> # Date 1484844060 -3600
> #  Thu Jan 19 17:41:00 2017 +0100
> # Node ID 43d99fe8dcb510540db19366fcac8159d4e26691
> # Parent  17c6195ce42f3cbb47cee53aeb4e6a4e5074878a
> # Available At https://hg.logilab.org/users/dlaxalde/hg
> #  hg pull https://hg.logilab.org/users/dlaxalde/hg -r
> 43d99fe8dcb5
> # EXP-Topic linerange-log/hgweb-filelog
> hgweb: handle a "linerange" request parameter in filelog command
>
> We now handle a "linerange" URL query parameter to filter filelog using
> a logic similar to followlines() revset.
> The URL syntax is: log//?linerange=:
> As a result, filelog entries only consists of revision changing specified
> line range.
>
> The linerange information is propagated to "more"/"less" navigation links
> but
> not to numeric navigation links as this would apparently require a
> dedicated
> "revnav" class.
>
> Only the gitweb template got updated for now.
>
> diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.
> py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -28,6 +28,7 @@ from .common import (
>
>  from .. import (
>  archival,
> +context,
>  encoding,
>  error,
>  graphmod,
> @@ -969,6 +970,8 @@ def filelog(web, req, tmpl):
>  except ValueError:
>  pass
>
> +lrange = webutil.linerange(req)
> +
>  lessvars = copy.copy(tmpl.defaults['sessionvars'])
>  lessvars['revcount'] = max(revcount / 2, 1)
>  morevars = copy.copy(tmpl.defaults['sessionvars'])
> @@ -982,26 +985,48 @@ def filelog(web, req, tmpl):
>  repo = web.repo
>  revs = fctx.filelog().revs(start, end - 1)
>  entries = []
> -for i in revs:
> -iterfctx = fctx.filectx(i)
> -entries.append(dict(
> -parity=next(parity),
> -filerev=i,
> -file=f,
> -rename=webutil.renamelink(iterfctx),
> -**webutil.commonentry(repo, iterfctx)))
> -entries.reverse()
> +linerange = None
> +if lrange is not None:
> +linerange = webutil.formatlinerange(*lrange)
> +# deactivate numeric nav links when linerange is specified as this
> +# would required a dedicated "revnav" class
> +nav = None
> +ancestors = context.blockancestors(fctx, *lrange)
> +for i, (c, lr) in enumerate(ancestors, 1):
> +# follow renames accross filtered (not in range) revisions
> +path = c.path()
> +entries.append(dict(
> +parity=next(parity),
> +filerev=c.rev(),
> +file=path,
> +linerange=webutil.formatlinerange(*lr),
> +**webutil.commonentry(repo, c)))
> +if i == revcount:
> +break
> +lessvars['linerange'] = webutil.formatlinerange(*lrange)
> +morevars['linerange'] = lessvars['linerange']
> +else:
> +for i in revs:
> +iterfctx = fctx.filectx(i)
> +entries.append(dict(
> +parity=next(parity),
> +filerev=i,
> +file=f,
> +rename=webutil.renamelink(iterfctx),
> +**webutil.commonentry(repo, iterfctx)))
> +entries.reverse()
> +revnav = webutil.filerevnav(web.repo, fctx.path())
> +nav = revnav.gen(end - 1, revcount, count)
>
>  latestentry = entries[:1]
>
> -revnav = webutil.filerevnav(web.repo, fctx.path())
> -nav = revnav.gen(end - 1, revcount, count)
>  return tmpl("filelog",
>  file=f,
>  nav=nav,
>  symrev=webutil.symrevorshortnode(req, fctx),
>  entries=entries,
>  latestentry=latestentry,
> +linerange=linerange,
>  revcount=revcount,
>  morevars=morevars,
>  lessvars=lessvars,
> diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
> --- a/mercurial/hgweb/webutil.py
> +++ b/mercurial/hgweb/webutil.py
> @@ -18,6 +18,7 @@ from ..node import hex, nullid, short
>
>  from .common import (
>  ErrorResponse,
> +HTTP_BAD_REQUEST,
>  HTTP_NOT_FOUND,
>  paritygen,
>  )
> @@ -313,6 +314,25 @@ def filectx(repo, req):
>
>  return fctx
>
> +def linerange(req):
> +linerange = req.form.get('linerange')
> +if linerange is None:
> +return None
> +if len(linerange) > 1:
> +raise ErrorResponse(HTTP_BAD_REQUEST,
> +'redundant linerange parameter')
> +try:
> +try:
> +fromline, toline = map(int, linerange[0].split(':', 1))
> +except ValueError:
> +raise ValueError('invalid linerange parameter')
> +return util.processlinerange(fromline, toline)
> +except ValueError as exc:
> +

Re: [PATCH 04 of 11] hgweb: handle a "linerange" request parameter in filelog command

2017-02-28 Thread Gregory Szorc
On Thu, Feb 23, 2017 at 6:54 AM, Yuya Nishihara  wrote:

> On Wed, 22 Feb 2017 16:09:58 +0100, Denis Laxalde wrote:
> > # HG changeset patch
> > # User Denis Laxalde 
> > # Date 1484844060 -3600
> > #  Thu Jan 19 17:41:00 2017 +0100
> > # Node ID 4d83e067c9c6e0f5fb7b126a9739aa9dd8113af4
> > # Parent  0a725b74eeb2a8eca6d1d82ba8ec8c2d188e8684
> > # EXP-Topic linerange-log/hgweb-filelog
> > hgweb: handle a "linerange" request parameter in filelog command
> >
> > We now handle a "linerange" URL query parameter to filter filelog using
> > a logic similar to followlines() revset.
> > The URL syntax is: log//?linerange=-
>
> Nit: how about copying the : syntax from revset?
>

I agree with this suggestion (consistency is good) and see it has been
incorporated into the v2 series. However, I'd like to state for the record
that ':' is a reserved character in URLs and needs to be percent escaped.
So that's slightly annoying, especially for power users that may wish to
tweak URLs in their browser. Although, I'm pretty sure the URL parsers in
browsers will allow the literal ':' so it shouldn't be a big deal in
practice.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 5] transaction: introduce scope

2017-02-28 Thread Durham Goode



On 2/28/17 2:41 PM, Martin von Zweigbergk wrote:

On Tue, Feb 28, 2017 at 2:34 PM, Durham Goode  wrote:



On 2/27/17 9:35 AM, Jun Wu wrote:


# HG changeset patch
# User Jun Wu 
# Date 1488185788 28800
#  Mon Feb 27 00:56:28 2017 -0800
# Node ID 5dac612ec9a87553fcd329100846bcb01bae9d80
# Parent  b4cb86ab4c719eb615a4308eafd8b1386a511eeb
# Available At
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=32KRbLZXwqv-6cN9kkgbRvm2CXLXQaqOiiVERyotxSQ=QQPzFUNWmG02Bz8xilA5LPRAfljxDn-s2-q1qSGuXps=
#  hg pull
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=32KRbLZXwqv-6cN9kkgbRvm2CXLXQaqOiiVERyotxSQ=QQPzFUNWmG02Bz8xilA5LPRAfljxDn-s2-q1qSGuXps=
-r 5dac612ec9a8
transaction: introduce scope

Previously, transaction tries to cover everything: bookmarks, dirstate,
phaseroots, and branch. It backs them up unconditionally.

That could be inefficient if we still back up the dirstate in a giant
repo,
where the transaction is only intended to change bookmarks.

This patch introduces "scope" to transactions, which is a set of things
that
the transaction should cover. For bookmark-only update, it could avoid
specifying the "dirstate" scope to be more efficient.



I was talking with Jun about this in person and a few things came up.  I
proposed we just reenable hardlink support for transaction backups of
atomic-rewrite-files like the dirstate. That would remove the IO of copying
that I assumed was the problem. However, it turns out the dirstate doesn't
even use the tr.addbackup() mechanism that everything else uses.  Instead,
it writes out the *current* contents of the inmemory dirstate and treats
that as the backup, which seems extra wrong since the current inmemory data
may not match the data on disk that we're about to overwrite, and extra
wrong since it means CPU time spent serializing the dirstate whenever a
transaction opens.

Seems like we should refactor the dirstate/dirstateguard business to use the
real transaction logic, then we could benefit from the hardlink backups
optimization.


I was also wondering why it was treated differently. Great if we can
clean that up.


Jun tried and it seems it will require some significant effort.



Not that such a refactor should block this series.


If what you describe above is done, would there still be a desire for
this series or would we undo this series once the dirstate-cleanup and
hard-linking is done?


If the only benefit from the scope work is for the dirstate, then yea we 
could undo this series after the dirstate refactor is done.


There may be other benefits to having the concept of scope though. If we 
moved the scope concept up to the lock level too (I've always said we 
should combine lock and transactions into one concept...) it might allow 
us to get rid of the repo.wlock() and repo.lock() differences, and the 
user just specifies a scope they care about.  If we take it farther, we 
could identify scopes that are independent and allow multiple locks at 
the same time. But that's very future work.

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


Re: [PATCH 1 of 5] transaction: introduce scope

2017-02-28 Thread Jun Wu
Excerpts from Martin von Zweigbergk's message of 2017-02-28 14:41:47 -0800:
> > I was talking with Jun about this in person and a few things came up.  I
> > proposed we just reenable hardlink support for transaction backups of
> > atomic-rewrite-files like the dirstate. That would remove the IO of copying
> > that I assumed was the problem. However, it turns out the dirstate doesn't
> > even use the tr.addbackup() mechanism that everything else uses.  Instead,
> > it writes out the *current* contents of the inmemory dirstate and treats
> > that as the backup, which seems extra wrong since the current inmemory data
> > may not match the data on disk that we're about to overwrite, and extra
> > wrong since it means CPU time spent serializing the dirstate whenever a
> > transaction opens.
> >
> > Seems like we should refactor the dirstate/dirstateguard business to use the
> > real transaction logic, then we could benefit from the hardlink backups
> > optimization.
> 
> I was also wondering why it was treated differently. Great if we can
> clean that up.

Note: I had attempted to do it that way by the following change:

# HG changeset patch
# User Jun Wu 
# Date 1488183419 28800
#  Mon Feb 27 00:16:59 2017 -0800
# Node ID 71621760eaf6b99416e5f274a07a10b370c78691
# Parent  b4cb86ab4c719eb615a4308eafd8b1386a511eeb
# Available At https://bitbucket.org/quark-zju/hg-draft
#  hg pull https://bitbucket.org/quark-zju/hg-draft -r 
71621760eaf6
debug: try to use transaction for dirstate backup

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1083,6 +1083,5 @@ class localrepository(object):
 # discard all changes (including ones already written
 # out) in this transaction
-repo.dirstate.restorebackup(None, prefix='journal.')
-
+# repo.dirstate.restorebackup(None, prefix='journal.')
 repo.invalidate(clearfilecache=True)
 
@@ -1123,4 +1122,5 @@ class localrepository(object):
 # to stored data if transaction has no error.
 tr.addpostclose('refresh-filecachestats', 
self._refreshfilecachestats)
+tr.addbackup('dirstate')
 self._transref = weakref.ref(tr)
 return tr
@@ -1128,5 +1128,4 @@ class localrepository(object):
 def _journalfiles(self):
 return ((self.svfs, 'journal'),
-(self.vfs, 'journal.dirstate'),
 (self.vfs, 'journal.branch'),
 (self.vfs, 'journal.desc'),
@@ -1138,5 +1137,4 @@ class localrepository(object):
 
 def _writejournal(self, desc):
-self.dirstate.savebackup(None, prefix='journal.')
 self.vfs.write("journal.branch",
   encoding.fromlocal(self.dirstate.branch()))

However, *many* tests will fail. I can use some time to try again but that
won't guarantee a success.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 5] transaction: introduce scope

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Tue, Feb 28, 2017 at 2:34 PM, Durham Goode  wrote:
>
>
> On 2/27/17 9:35 AM, Jun Wu wrote:
>>
>> # HG changeset patch
>> # User Jun Wu 
>> # Date 1488185788 28800
>> #  Mon Feb 27 00:56:28 2017 -0800
>> # Node ID 5dac612ec9a87553fcd329100846bcb01bae9d80
>> # Parent  b4cb86ab4c719eb615a4308eafd8b1386a511eeb
>> # Available At
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=32KRbLZXwqv-6cN9kkgbRvm2CXLXQaqOiiVERyotxSQ=QQPzFUNWmG02Bz8xilA5LPRAfljxDn-s2-q1qSGuXps=
>> #  hg pull
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=32KRbLZXwqv-6cN9kkgbRvm2CXLXQaqOiiVERyotxSQ=QQPzFUNWmG02Bz8xilA5LPRAfljxDn-s2-q1qSGuXps=
>> -r 5dac612ec9a8
>> transaction: introduce scope
>>
>> Previously, transaction tries to cover everything: bookmarks, dirstate,
>> phaseroots, and branch. It backs them up unconditionally.
>>
>> That could be inefficient if we still back up the dirstate in a giant
>> repo,
>> where the transaction is only intended to change bookmarks.
>>
>> This patch introduces "scope" to transactions, which is a set of things
>> that
>> the transaction should cover. For bookmark-only update, it could avoid
>> specifying the "dirstate" scope to be more efficient.
>
>
> I was talking with Jun about this in person and a few things came up.  I
> proposed we just reenable hardlink support for transaction backups of
> atomic-rewrite-files like the dirstate. That would remove the IO of copying
> that I assumed was the problem. However, it turns out the dirstate doesn't
> even use the tr.addbackup() mechanism that everything else uses.  Instead,
> it writes out the *current* contents of the inmemory dirstate and treats
> that as the backup, which seems extra wrong since the current inmemory data
> may not match the data on disk that we're about to overwrite, and extra
> wrong since it means CPU time spent serializing the dirstate whenever a
> transaction opens.
>
> Seems like we should refactor the dirstate/dirstateguard business to use the
> real transaction logic, then we could benefit from the hardlink backups
> optimization.

I was also wondering why it was treated differently. Great if we can
clean that up.

>
> Not that such a refactor should block this series.

If what you describe above is done, would there still be a desire for
this series or would we undo this series once the dirstate-cleanup and
hard-linking is done?

>
> ___
> 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 1 of 5] transaction: introduce scope

2017-02-28 Thread Durham Goode



On 2/27/17 9:35 AM, Jun Wu wrote:

# HG changeset patch
# User Jun Wu 
# Date 1488185788 28800
#  Mon Feb 27 00:56:28 2017 -0800
# Node ID 5dac612ec9a87553fcd329100846bcb01bae9d80
# Parent  b4cb86ab4c719eb615a4308eafd8b1386a511eeb
# Available At 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=32KRbLZXwqv-6cN9kkgbRvm2CXLXQaqOiiVERyotxSQ=QQPzFUNWmG02Bz8xilA5LPRAfljxDn-s2-q1qSGuXps=
#  hg pull 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bitbucket.org_quark-2Dzju_hg-2Ddraft=DwIGaQ=5VD0RTtNlTh3ycd41b3MUw=nuarHzhP1wi1T9iURRCj1A=32KRbLZXwqv-6cN9kkgbRvm2CXLXQaqOiiVERyotxSQ=QQPzFUNWmG02Bz8xilA5LPRAfljxDn-s2-q1qSGuXps=
  -r 5dac612ec9a8
transaction: introduce scope

Previously, transaction tries to cover everything: bookmarks, dirstate,
phaseroots, and branch. It backs them up unconditionally.

That could be inefficient if we still back up the dirstate in a giant repo,
where the transaction is only intended to change bookmarks.

This patch introduces "scope" to transactions, which is a set of things that
the transaction should cover. For bookmark-only update, it could avoid
specifying the "dirstate" scope to be more efficient.


I was talking with Jun about this in person and a few things came up.  I 
proposed we just reenable hardlink support for transaction backups of 
atomic-rewrite-files like the dirstate. That would remove the IO of 
copying that I assumed was the problem. However, it turns out the 
dirstate doesn't even use the tr.addbackup() mechanism that everything 
else uses.  Instead, it writes out the *current* contents of the 
inmemory dirstate and treats that as the backup, which seems extra wrong 
since the current inmemory data may not match the data on disk that 
we're about to overwrite, and extra wrong since it means CPU time spent 
serializing the dirstate whenever a transaction opens.


Seems like we should refactor the dirstate/dirstateguard business to use 
the real transaction logic, then we could benefit from the hardlink 
backups optimization.


Not that such a refactor should block this series.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] smartset: reorder initialization of baseset in more intuitive way

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Sat, Feb 18, 2017 at 5:39 PM, Jun Wu  wrote:
> Looks good to me. Thanks for the clean-up!

Yep, looks good. Queued, thanks. And sorry about the delay.

>
> Excerpts from Yuya Nishihara's message of 2017-02-18 18:48:06 +0900:
>> # HG changeset patch
>> # User Yuya Nishihara 
>> # Date 1487407072 -32400
>> #  Sat Feb 18 17:37:52 2017 +0900
>> # Node ID 1ca3469fdd08c0d5d814a4bc359869bc157c7fc9
>> # Parent  3f4bdcfe63e9f1e357187fa728ae0da9d35b3973
>> smartset: reorder initialization of baseset in more intuitive way
>>
>> What we want to do is to assign either _set or _list per the given data
>> type.
>>
>> diff --git a/mercurial/smartset.py b/mercurial/smartset.py
>> --- a/mercurial/smartset.py
>> +++ b/mercurial/smartset.py
>> @@ -166,16 +166,14 @@ class baseset(abstractsmartset):
>>  """
>>  self._ascending = None
>>  self._istopo = istopo
>> -if not isinstance(data, list):
>> -if isinstance(data, set):
>> -self._set = data
>> -# set has no order we pick one for stability purpose
>> -self._ascending = True
>> -# converting set to list has a cost, do it lazily
>> -data = None
>> -else:
>> +if isinstance(data, set):
>> +# converting set to list has a cost, do it lazily
>> +self._set = data
>> +# set has no order we pick one for stability purpose
>> +self._ascending = True
>> +else:
>> +if not isinstance(data, list):
>>  data = list(data)
>> -if data is not None:
>>  self._list = data
>>  self._datarepr = datarepr
>>
> ___
> 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 4 of 5] localrepo: do not write dirstate if it's not in transaction scope

2017-02-28 Thread Jun Wu
Excerpts from Martin von Zweigbergk's message of 2017-02-28 13:15:17 -0800:
> On Mon, Feb 27, 2017 at 9:35 AM, Jun Wu  wrote:
> > # HG changeset patch
> > # User Jun Wu 
> > # Date 1488189479 28800
> > #  Mon Feb 27 01:57:59 2017 -0800
> > # Node ID f88c37484782ae7fede3c7a2a27a5f5d9b12bc9a
> > # Parent  89793c9bfdc93896fd308ad9f4c400710ff2bde2
> > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > #  hg pull https://bitbucket.org/quark-zju/hg-draft  -r 
> > f88c37484782
> > localrepo: do not write dirstate if it's not in transaction scope
> >
> > See the previous patch for why.
> >
> > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> > --- a/mercurial/localrepo.py
> > +++ b/mercurial/localrepo.py
> > @@ -1077,14 +1077,16 @@ class localrepository(object):
> >  repo = reporef()
> >  if success:
> > -# this should be explicitly invoked here, because
> > -# in-memory changes aren't written out at closing
> > -# transaction, if tr.addfilegenerator (via
> > -# dirstate.write or so) isn't invoked while
> > -# transaction running
> > -repo.dirstate.write(None)
> > +if 'dirstate' in tr.scope():
> > +# this should be explicitly invoked here, because
> > +# in-memory changes aren't written out at closing
> > +# transaction, if tr.addfilegenerator (via
> > +# dirstate.write or so) isn't invoked while
> > +# transaction running
> > +repo.dirstate.write(None)
> 
> Can we check that the dirstate has not been modified since the start
> of the transaction and fail if it has? Otherwise it seems like we may
> easily forgot to add e.g. "dirstate" to the scope one day when "hg
> bookmarks" starts modifying it. I suspect the answer is that that
> won't be easy, but how much work it be? The same thing of course
> applies to the journal files in the other patch.

That's not enough - in theory we also want to make sure dirstate becomes
immutable afterwards.

Originally I was thinking about making "backupdirstate" lazy - only backup
it when dirstate is being changed. That should be even better than what you
suggest. But aside from the implementation complexity, I don't feel very
comfortable with dirstate holding a reference to the transaction or repo
object. I'll try again, but if it turned out to be hairy, I'd still want
this simple approach for the perf win.

> 
> >  else:
> > -# discard all changes (including ones already written
> > -# out) in this transaction
> > -repo.dirstate.restorebackup(None, prefix='journal.')
> > +if 'dirstate' in tr.scope():
> > +# discard all changes (including ones already written
> > +# out) in this transaction
> > +repo.dirstate.restorebackup(None, prefix='journal.')
> >
> >  repo.invalidate(clearfilecache=True)
> > ___
> > 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 4 of 5] localrepo: do not write dirstate if it's not in transaction scope

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Mon, Feb 27, 2017 at 9:35 AM, Jun Wu  wrote:
> # HG changeset patch
> # User Jun Wu 
> # Date 1488189479 28800
> #  Mon Feb 27 01:57:59 2017 -0800
> # Node ID f88c37484782ae7fede3c7a2a27a5f5d9b12bc9a
> # Parent  89793c9bfdc93896fd308ad9f4c400710ff2bde2
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #  hg pull https://bitbucket.org/quark-zju/hg-draft -r 
> f88c37484782
> localrepo: do not write dirstate if it's not in transaction scope
>
> See the previous patch for why.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1077,14 +1077,16 @@ class localrepository(object):
>  repo = reporef()
>  if success:
> -# this should be explicitly invoked here, because
> -# in-memory changes aren't written out at closing
> -# transaction, if tr.addfilegenerator (via
> -# dirstate.write or so) isn't invoked while
> -# transaction running
> -repo.dirstate.write(None)
> +if 'dirstate' in tr.scope():
> +# this should be explicitly invoked here, because
> +# in-memory changes aren't written out at closing
> +# transaction, if tr.addfilegenerator (via
> +# dirstate.write or so) isn't invoked while
> +# transaction running
> +repo.dirstate.write(None)

Can we check that the dirstate has not been modified since the start
of the transaction and fail if it has? Otherwise it seems like we may
easily forgot to add e.g. "dirstate" to the scope one day when "hg
bookmarks" starts modifying it. I suspect the answer is that that
won't be easy, but how much work it be? The same thing of course
applies to the journal files in the other patch.

>  else:
> -# discard all changes (including ones already written
> -# out) in this transaction
> -repo.dirstate.restorebackup(None, prefix='journal.')
> +if 'dirstate' in tr.scope():
> +# discard all changes (including ones already written
> +# out) in this transaction
> +repo.dirstate.restorebackup(None, prefix='journal.')
>
>  repo.invalidate(clearfilecache=True)
> ___
> 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 7 of 7] config: update the Windows example config file

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Tue, Feb 28, 2017 at 11:25 AM, Pierre-Yves David
 wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1488309790 -3600
> #  Tue Feb 28 20:23:10 2017 +0100
> # Node ID b20bdc56362c3e4f676a47c71edf02107b01c507
> # Parent  9fffdf9b71de54fba36d3efd581aa660ab8076d1
> # EXP-Topic color
> config: update the Windows example config file

Queued with some minor copy editing done in flight. Thanks.

>
> We move from the color extensions to the 'ui.color' config.
>
> diff --git a/contrib/win32/mercurial.ini b/contrib/win32/mercurial.ini
> --- a/contrib/win32/mercurial.ini
> +++ b/contrib/win32/mercurial.ini
> @@ -19,6 +19,8 @@
>  editor = notepad
>  ; show changed files and be a bit more verbose if True
>  ; verbose = True
> +; colorize commands output
> +; color = auto
>
>  ; username data to appear in commits
>  ; it usually takes the form: Joe User 
> @@ -40,7 +42,6 @@ editor = notepad
>  ;bugzilla =
>  ;children =
>  ;churn =
> -;color =
>  ;convert =
>  ;eol =
>  ;extdiff =
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 V2] treemanifest: make node reuse match flat manifest behavior

2017-02-28 Thread Durham Goode
# HG changeset patch
# User Durham Goode 
# Date 1488067881 28800
#  Sat Feb 25 16:11:21 2017 -0800
# Node ID fb45d40719699efa3139e3509775fd5442c1c36a
# Parent  0a5e6ad0a25c348384bb6c14a51057b3587e2857
treemanifest: make node reuse match flat manifest behavior

In a flat manifest, a node with the same content but different parents is still
considered a new node. In the current tree manifests however, if the content is
the same, we ignore the parents entirely and just reuse the existing node.

In our external treemanifest extension, we want to allow having one treemanifest
for every flat manifests, as a way of easeing the migration to treemanifests. To
make this possible, let's change the root node treemanifest behavior to match
the behavior for flat manifests, so we can have a 1:1 relationship.

While this sounds like a BC breakage, it's not actually a state users can
normally get in because: A) you can't make empty commits, and B) even if you try
to make an empty commit (by making a commit then amending it's changes away),
the higher level commit logic in localrepo.commitctx() forces the commit to use
the original p1 manifest node if no files were changed. So this would only
affect extensions and automation that reached passed the normal
localrepo.commit() logic straight into the manifest logic.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1229,7 +1229,7 @@ class manifestrevlog(revlog.revlog):
 def _addtree(self, m, transaction, link, m1, m2, readtree):
 # If the manifest is unchanged compared to one parent,
 # don't write a new revision
-if m.unmodifiedsince(m1) or m.unmodifiedsince(m2):
+if self._dir != '' and (m.unmodifiedsince(m1) or 
m.unmodifiedsince(m2)):
 return m.node()
 def writesubtree(subm, subp1, subp2):
 sublog = self.dirlog(subm.dir())
@@ -1237,13 +1237,17 @@ class manifestrevlog(revlog.revlog):
readtree=readtree)
 m.writesubtrees(m1, m2, writesubtree)
 text = m.dirtext(self._usemanifestv2)
-# Double-check whether contents are unchanged to one parent
-if text == m1.dirtext(self._usemanifestv2):
-n = m1.node()
-elif text == m2.dirtext(self._usemanifestv2):
-n = m2.node()
-else:
+n = None
+if self._dir != '':
+# Double-check whether contents are unchanged to one parent
+if text == m1.dirtext(self._usemanifestv2):
+n = m1.node()
+elif text == m2.dirtext(self._usemanifestv2):
+n = m2.node()
+
+if not n:
 n = self.addrevision(text, transaction, link, m1.node(), m2.node())
+
 # Save nodeid so parent manifest can calculate its nodeid
 m.setnode(n)
 return n
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -825,3 +825,13 @@ other branch
   added 1 changesets with 1 changes to 1 files (+1 heads)
   (run 'hg heads' to see heads, 'hg merge' to merge)
 
+Committing a empty commit does not duplicate root treemanifest
+  $ echo z >> z
+  $ hg commit -Aqm 'pre-empty commit'
+  $ hg rm z
+  $ hg commit --amend -m 'empty commit'
+  saved backup bundle to 
$TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-de37743b-amend-backup.hg
 (glob)
+  $ hg log -r 'tip + tip^' -T '{manifest}\n'
+  1:678d3574b88c
+  1:678d3574b88c
+  $ hg --config extensions.strip= strip -r . -q
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 V2] manifest: allow specifying the revlog filename

2017-02-28 Thread Durham Goode
# HG changeset patch
# User Durham Goode 
# Date 1488304382 28800
#  Tue Feb 28 09:53:02 2017 -0800
# Node ID 0a5e6ad0a25c348384bb6c14a51057b3587e2857
# Parent  88203f26ea57627cabd7cf9c4f7843661d6c43ae
manifest: allow specifying the revlog filename

Previously we had hardcoded the manifest filename to be 00manifest.i. In our
external treemanifest extension, we want to allow writing a treemanifest side by
side with a flat manifest, so we need to be able to store the root revisions at
a different location (in our extension we use 00manifesttree.i).

This patches moves the revlog name to a parameter so we can adjust it.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1132,7 +1132,13 @@ class manifestrevlog(revlog.revlog):
 '''A revlog that stores manifest texts. This is responsible for caching the
 full-text manifest contents.
 '''
-def __init__(self, opener, dir='', dirlogcache=None):
+def __init__(self, opener, dir='', dirlogcache=None,
+ indexfile='00manifest.i'):
+"""Constructs a new manifest revlog
+
+`indexfile` - used by extensions to have two manifests at once, like
+when transitioning between flatmanifeset and treemanifests.
+"""
 # During normal operations, we expect to deal with not more than four
 # revs at a time (such as during commit --amend). When rebasing large
 # stacks of commits, the number can go up, hence the config knob below.
@@ -1150,12 +1156,11 @@ class manifestrevlog(revlog.revlog):
 
 self._fulltextcache = util.lrucachedict(cachesize)
 
-indexfile = "00manifest.i"
 if dir:
 assert self._treeondisk, 'opts is %r' % opts
 if not dir.endswith('/'):
 dir = dir + '/'
-indexfile = "meta/" + dir + "00manifest.i"
+indexfile = "meta/" + dir + indexfile
 self._dir = dir
 # The dirlogcache is kept on the root manifest log
 if dir:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] manifest: allow specifying the revlog filename

2017-02-28 Thread Durham Goode



On 2/28/17 9:53 AM, Martin von Zweigbergk wrote:

On Tue, Feb 28, 2017 at 9:49 AM, Durham Goode  wrote:



On 2/27/17 5:10 PM, Martin von Zweigbergk wrote:


+mercurial-devel again (I had initially thought my comment was not
about the patch, but it turns out it was)

On Sat, Feb 25, 2017 at 3:23 PM, Durham Goode  wrote:


On 2/24/17 10:00 PM, Martin von Zweigbergk wrote:



-list

On Fri, Feb 24, 2017, 14:44 Durham Goode > wrote:

# HG changeset patch
# User Durham Goode >
# Date 1487973639 28800
#  Fri Feb 24 14:00:39 2017 -0800
# Node ID ed987b24e755a4c61c006f7d98a4ff370229faad
# Parent  f01df5d2fe493376a67569756a9bc2ddffa5cd81
manifest: allow specifying the revlog filename

Previously we had hardcoded the manifest filename to be
00manifest.i. In our
external treemanifest extension, we want to allow writing a
treemanifest side by
side with a flat manifest, so we need to be able to store the root
revisions at
a different location (in our extension we use 00manifesttree.i).


Why not meta/00manifest.i? That would be more consistent. I let them
(flat and tree) share a revlog only to allow for transition between
them. But if you don't care about that, meta/00manifest.i sounds like
the obvious choice.




I'd be fine with that too, but I'm not sure how we'd go about that. I
guess
I could put an option on the opener that the manifest constructor checks
for, like 'separatetreeroot=True' and then the constructor would know to
put
it in meta/.  Seem reasonable?



Or you could keep your new indexfile argument to the constructor and
use that if it was set and otherwise use the current way of
calculating it. Your extension could then pass 'meta/00manifest.i' for
dir=='' and None for all others. That gives more flexibility if you
want to use some other scheme too. Also, I'd like a comment explaining
that the parameter is for extensions, so the next person doesn't
remove it.



I can add a comment.  I think putting directories in the indexfile string
might be a bit funky since I'm not sure if other parts of the code rely on
self.indexfile to be just a filename.


I don't follow. You patch touches a line that says

  indexfile = "meta/" + dir + "00manifest.i"

so it already (potentially) has a directory in it. Or do you mean
something else?


You're right, so that's not a big deal I guess.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 7] color: update main documentation

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1487703895 -3600
#  Tue Feb 21 20:04:55 2017 +0100
# Node ID 84cd9b720b92c6bab764bc172b8cf2795f8e8600
# Parent  c65f0cd7a22844c071c888cdd10c2cd625e766c5
# EXP-Topic color
color: update main documentation

Now that the feature no longer leaves in the extensions, we document it in the
help of the core config. This include the new 'ui.color' option introduced in
the previous changesets.

As a result the color extensions can now be deprecated.

This is a documentation patch only color is still disabled by default.

diff --git a/contrib/wix/help.wxs b/contrib/wix/help.wxs
--- a/contrib/wix/help.wxs
+++ b/contrib/wix/help.wxs
@@ -15,6 +15,7 @@
 
   
 
+  
   
   
   
diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -5,169 +5,20 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-'''colorize output from some commands
-
-The color extension colorizes output from several Mercurial commands.
-For example, the diff command shows additions in green and deletions
-in red, while the status command shows modified files in magenta. Many
-other commands have analogous colors. It is possible to customize
-these colors.
-
-Effects

-
-Other effects in addition to color, like bold and underlined text, are
-also available. By default, the terminfo database is used to find the
-terminal codes used to change color and effect.  If terminfo is not
-available, then effects are rendered with the ECMA-48 SGR control
-function (aka ANSI escape codes).
-
-The available effects in terminfo mode are 'blink', 'bold', 'dim',
-'inverse', 'invisible', 'italic', 'standout', and 'underline'; in
-ECMA-48 mode, the options are 'bold', 'inverse', 'italic', and
-'underline'.  How each is rendered depends on the terminal emulator.
-Some may not be available for a given terminal type, and will be
-silently ignored.
-
-If the terminfo entry for your terminal is missing codes for an effect
-or has the wrong codes, you can add or override those codes in your
-configuration::
-
-  [color]
-  terminfo.dim = \E[2m
-
-where '\E' is substituted with an escape character.
+'''enable Mercurial color mode (DEPRECATED)
 
-Labels
---
-
-Text receives color effects depending on the labels that it has. Many
-default Mercurial commands emit labelled text. You can also define
-your own labels in templates using the label function, see :hg:`help
-templates`. A single portion of text may have more than one label. In
-that case, effects given to the last label will override any other
-effects. This includes the special "none" effect, which nullifies
-other effects.
-
-Labels are normally invisible. In order to see these labels and their
-position in the text, use the global --color=debug option. The same
-anchor text may be associated to multiple labels, e.g.
-
-  [log.changeset changeset.secret|changeset:   22611:6f0a53c8f587]
-
-The following are the default effects for some default labels. Default
-effects may be overridden from your configuration file::
-
-  [color]
-  status.modified = blue bold underline red_background
-  status.added = green bold
-  status.removed = red bold blue_background
-  status.deleted = cyan bold underline
-  status.unknown = magenta bold underline
-  status.ignored = black bold
-
-  # 'none' turns off all effects
-  status.clean = none
-  status.copied = none
-
-  qseries.applied = blue bold underline
-  qseries.unapplied = black bold
-  qseries.missing = red bold
+This extensions enable Mercurial color mode. The feature is now directly
+available in Mercurial core. You can access it using::
 
-  diff.diffline = bold
-  diff.extended = cyan bold
-  diff.file_a = red bold
-  diff.file_b = green bold
-  diff.hunk = magenta
-  diff.deleted = red
-  diff.inserted = green
-  diff.changed = white
-  diff.tab =
-  diff.trailingwhitespace = bold red_background
-
-  # Blank so it inherits the style of the surrounding label
-  changeset.public =
-  changeset.draft =
-  changeset.secret =
-
-  resolve.unresolved = red bold
-  resolve.resolved = green bold
-
-  bookmarks.active = green
-
-  branches.active = none
-  branches.closed = black bold
-  branches.current = green
-  branches.inactive = none
-
-  tags.normal = green
-  tags.local = black bold
-
-  rebase.rebased = blue
-  rebase.remaining = red bold
-
-  shelve.age = cyan
-  shelve.newest = green bold
-  shelve.name = blue bold
-
-  histedit.remaining = red bold
-
-Custom colors
--
+  [ui]
+  color = auto
 
-Because there are only eight standard colors, this module allows you
-to define color names for other color slots which might be available
-for your terminal type, assuming terminfo mode.  For instance::
-
-  color.brightblue = 12
-  color.pink = 207
-  color.orange = 202
-
-to set 'brightblue' to 

[PATCH 7 of 7] config: update the Windows example config file

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488309790 -3600
#  Tue Feb 28 20:23:10 2017 +0100
# Node ID b20bdc56362c3e4f676a47c71edf02107b01c507
# Parent  9fffdf9b71de54fba36d3efd581aa660ab8076d1
# EXP-Topic color
config: update the Windows example config file

We move from the color extensions to the 'ui.color' config.

diff --git a/contrib/win32/mercurial.ini b/contrib/win32/mercurial.ini
--- a/contrib/win32/mercurial.ini
+++ b/contrib/win32/mercurial.ini
@@ -19,6 +19,8 @@
 editor = notepad
 ; show changed files and be a bit more verbose if True
 ; verbose = True
+; colorize commands output
+; color = auto
  
 ; username data to appear in commits
 ; it usually takes the form: Joe User 
@@ -40,7 +42,6 @@ editor = notepad
 ;bugzilla =
 ;children =
 ;churn =
-;color =
 ;convert =
 ;eol =
 ;extdiff =
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 7] color: cleanup 'debugcolor' logic

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488048194 -3600
#  Sat Feb 25 19:43:14 2017 +0100
# Node ID a6afcb4e81ed425c633c206f121c5820ac91b0b0
# Parent  7e3d17f7acca8f1f1ff7d15864990201a528e1cd
# EXP-Topic color
color: cleanup 'debugcolor' logic

Now that style are carried by the 'ui' object, we no longer need complicated
logic to restore the original style. We just need to copy the 'ui' and work on
the copied version.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -357,26 +357,22 @@ def debugcolor(ui, repo, **opts):
 return _debugdisplaycolor(ui)
 
 def _debugdisplaycolor(ui):
-oldstyle = ui._styles.copy()
-try:
-ui._styles.clear()
-for effect in color._effects.keys():
-ui._styles[effect] = effect
-if ui._terminfoparams:
-for k, v in ui.configitems('color'):
-if k.startswith('color.'):
-ui._styles[k] = k[6:]
-elif k.startswith('terminfo.'):
-ui._styles[k] = k[9:]
-ui.write(_('available colors:\n'))
-# sort label with a '_' after the other to group '_background' entry.
-items = sorted(ui._styles.items(),
-   key=lambda i: ('_' in i[0], i[0], i[1]))
-for colorname, label in items:
-ui.write(('%s\n') % colorname, label=label)
-finally:
-ui._styles.clear()
-ui._styles.update(oldstyle)
+ui = ui.copy()
+ui._styles.clear()
+for effect in color._effects.keys():
+ui._styles[effect] = effect
+if ui._terminfoparams:
+for k, v in ui.configitems('color'):
+if k.startswith('color.'):
+ui._styles[k] = k[6:]
+elif k.startswith('terminfo.'):
+ui._styles[k] = k[9:]
+ui.write(_('available colors:\n'))
+# sort label with a '_' after the other to group '_background' entry.
+items = sorted(ui._styles.items(),
+   key=lambda i: ('_' in i[0], i[0], i[1]))
+for colorname, label in items:
+ui.write(('%s\n') % colorname, label=label)
 
 def _debugdisplaystyle(ui):
 ui.write(_('available style:\n'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 7] config: suggest the 'ui.color' instead of the 'color' extension

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1487711853 -3600
#  Tue Feb 21 22:17:33 2017 +0100
# Node ID 63ff941fd53a11b8e295db36f3787f60ef0c9ceb
# Parent  84cd9b720b92c6bab764bc172b8cf2795f8e8600
# EXP-Topic color
config: suggest the 'ui.color' instead of the 'color' extension

The extensions is deprecated now so we should offer the core way to handle color
instead.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -55,12 +55,14 @@ samplehgrcs = {
 # username = Jane Doe 
 username =
 
+# uncomment to colorize commands output
+# color = auto
+
 [extensions]
 # uncomment these lines to enable some popular extensions
 # (see 'hg help extensions' for more info)
 #
-# pager =
-# color =""",
+# pager =""",
 
 'cloned':
 """# example repository config (see 'hg help config' for more info)
@@ -98,12 +100,15 @@ default = %s
 'global':
 """# example system-wide hg config (see 'hg help config' for more info)
 
+[ui]
+# uncomment to colorize commands output
+# color = auto
+
 [extensions]
 # uncomment these lines to enable some popular extensions
 # (see 'hg help extensions' for more info)
 #
 # blackbox =
-# color =
 # pager =""",
 }
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 7] color: move 'debugcolor' into the 'debugcommands' modules

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1487698897 -3600
#  Tue Feb 21 18:41:37 2017 +0100
# Node ID 7e3d17f7acca8f1f1ff7d15864990201a528e1cd
# Parent  6483e49204ee7cb34727534c6dec334c14097d5f
# EXP-Topic color
color: move 'debugcolor' into the 'debugcommands' modules

This is the last bits we needed to move out of the extensions. 'hgext/color.py'
now only contains logic to changes the default color behavior to 'auto'.

However, more cleanups are on the way and we need to document the new config
directly in core.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -164,21 +164,11 @@ If ``pagermode`` is not defined, the ``m
 
 from __future__ import absolute_import
 
-try:
-import curses
-curses.COLOR_BLACK # force import
-except ImportError:
-curses = None
-
-from mercurial.i18n import _
 from mercurial import (
-cmdutil,
 color,
-commands,
+commands
 )
 
-cmdtable = {}
-command = cmdutil.command(cmdtable)
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
@@ -194,48 +184,3 @@ def extsetup(ui):
 new = entry[:3] + patch + entry[4:]
 commands.globalopts[idx] = new
 break
-
-@command('debugcolor',
-[('', 'style', None, _('show all configured styles'))],
-'hg debugcolor')
-def debugcolor(ui, repo, **opts):
-"""show available color, effects or style"""
-ui.write(('color mode: %s\n') % ui._colormode)
-if opts.get('style'):
-return _debugdisplaystyle(ui)
-else:
-return _debugdisplaycolor(ui)
-
-def _debugdisplaycolor(ui):
-oldstyle = ui._styles.copy()
-try:
-ui._styles.clear()
-for effect in color._effects.keys():
-ui._styles[effect] = effect
-if ui._terminfoparams:
-for k, v in ui.configitems('color'):
-if k.startswith('color.'):
-ui._styles[k] = k[6:]
-elif k.startswith('terminfo.'):
-ui._styles[k] = k[9:]
-ui.write(_('available colors:\n'))
-# sort label with a '_' after the other to group '_background' entry.
-items = sorted(ui._styles.items(),
-   key=lambda i: ('_' in i[0], i[0], i[1]))
-for colorname, label in items:
-ui.write(('%s\n') % colorname, label=label)
-finally:
-ui._styles.clear()
-ui._styles.update(oldstyle)
-
-def _debugdisplaystyle(ui):
-ui.write(_('available style:\n'))
-width = max(len(s) for s in ui._styles)
-for label, effects in sorted(ui._styles.items()):
-ui.write('%s' % label, label=label)
-if effects:
-# 50
-ui.write(': ')
-ui.write(' ' * (max(0, width - len(label
-ui.write(', '.join(ui.label(e, e) for e in effects.split()))
-ui.write('\n')
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -31,6 +31,7 @@ from . import (
 bundle2,
 changegroup,
 cmdutil,
+color,
 commands,
 context,
 dagparser,
@@ -344,6 +345,51 @@ def debugcheckstate(ui, repo):
 error = _(".hg/dirstate inconsistent with current parent's manifest")
 raise error.Abort(error)
 
+@command('debugcolor',
+[('', 'style', None, _('show all configured styles'))],
+'hg debugcolor')
+def debugcolor(ui, repo, **opts):
+"""show available color, effects or style"""
+ui.write(('color mode: %s\n') % ui._colormode)
+if opts.get('style'):
+return _debugdisplaystyle(ui)
+else:
+return _debugdisplaycolor(ui)
+
+def _debugdisplaycolor(ui):
+oldstyle = ui._styles.copy()
+try:
+ui._styles.clear()
+for effect in color._effects.keys():
+ui._styles[effect] = effect
+if ui._terminfoparams:
+for k, v in ui.configitems('color'):
+if k.startswith('color.'):
+ui._styles[k] = k[6:]
+elif k.startswith('terminfo.'):
+ui._styles[k] = k[9:]
+ui.write(_('available colors:\n'))
+# sort label with a '_' after the other to group '_background' entry.
+items = sorted(ui._styles.items(),
+   key=lambda i: ('_' in i[0], i[0], i[1]))
+for colorname, label in items:
+ui.write(('%s\n') % colorname, label=label)
+finally:
+ui._styles.clear()
+ui._styles.update(oldstyle)
+
+def _debugdisplaystyle(ui):
+ui.write(_('available style:\n'))
+width = max(len(s) for s in ui._styles)
+for label, effects in sorted(ui._styles.items()):
+ui.write('%s' % label, label=label)
+if effects:
+# 

[PATCH 3 of 7] pager: drop the 'color' dependant code

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488309128 -3600
#  Tue Feb 28 20:12:08 2017 +0100
# Node ID c65f0cd7a22844c071c888cdd10c2cd625e766c5
# Parent  a6afcb4e81ed425c633c206f121c5820ac91b0b0
# EXP-Topic color
pager: drop the 'color' dependant code

The 'color' implementation is in core and no longer wrap '_runcommand'. We drop
the extra complexity.

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -66,12 +66,7 @@ def uisetup(ui):
 ui.pager('extension-via-attend-' + cmd)
 return orig(ui, options, cmd, cmdfunc)
 
-# Wrap dispatch._runcommand after color is loaded so color can see
-# ui.pageractive. Otherwise, if we loaded first, color's wrapped
-# dispatch._runcommand would run without having access to ui.pageractive.
-def afterloaded(loaded):
-extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
-extensions.afterloaded('color', afterloaded)
+extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
 
 attended = [
 'the-default-attend-list-is-now-empty-but-that-breaks-the-extension',
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2 STABLE] worker: flush messages written by child processes before exit

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Feb 24, 2017 at 8:27 PM, Yuya Nishihara  wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1487994530 -32400
> #  Sat Feb 25 12:48:50 2017 +0900
> # Branch stable
> # Node ID 0a98fef7c72482b78ad384d74d25f78b4147b151
> # Parent  21b8ba399a3ba480f66b53d97842ff61d5ec0f28
> worker: flush messages written by child processes before exit

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


Re: [PATCH 1 of 5] transaction: introduce scope

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Mon, Feb 27, 2017 at 10:16 AM, Jun Wu  wrote:
> Excerpts from Gregory Szorc's message of 2017-02-27 10:05:52 -0800:
>>
>> > On Feb 27, 2017, at 09:35, Jun Wu  wrote:
>> >
>> > # HG changeset patch
>> > # User Jun Wu 
>> > # Date 1488185788 28800
>> > #  Mon Feb 27 00:56:28 2017 -0800
>> > # Node ID 5dac612ec9a87553fcd329100846bcb01bae9d80
>> > # Parent  b4cb86ab4c719eb615a4308eafd8b1386a511eeb
>> > # Available At https://bitbucket.org/quark-zju/hg-draft
>> > #  hg pull https://bitbucket.org/quark-zju/hg-draft  -r 
>> > 5dac612ec9a8
>> > transaction: introduce scope
>> >
>> > Previously, transaction tries to cover everything: bookmarks, dirstate,
>> > phaseroots, and branch. It backs them up unconditionally.
>> >
>> > That could be inefficient if we still back up the dirstate in a giant repo,
>> > where the transaction is only intended to change bookmarks.
>> >
>> > This patch introduces "scope" to transactions, which is a set of things 
>> > that
>> > the transaction should cover. For bookmark-only update, it could avoid
>> > specifying the "dirstate" scope to be more efficient.
>> >
>> > diff --git a/mercurial/transaction.py b/mercurial/transaction.py
>> > --- a/mercurial/transaction.py
>> > +++ b/mercurial/transaction.py
>> > @@ -102,5 +102,6 @@ def _playback(journal, report, opener, v
>> > class transaction(object):
>> > def __init__(self, report, opener, vfsmap, journalname, undoname=None,
>> > - after=None, createmode=None, validator=None, 
>> > releasefn=None):
>> > + after=None, createmode=None, validator=None, 
>> > releasefn=None,
>> > + scope=None):
>> > """Begin a new transaction
>> >
>> > @@ -111,4 +112,5 @@ class transaction(object):
>> > * `createmode`: the mode of the journal file that will be created
>> > * `releasefn`: called after releasing (with transaction and result)
>> > +* `scope`: a set-like, nested transaction's scope must be a subset
>> > """
>> > self.count = 1
>> > @@ -171,4 +173,7 @@ class transaction(object):
>> > self._abortcallback = {}
>> >
>> > +# a set indicating what's covered
>> > +self._scope = scope or frozenset()
>> > +
>> > def __del__(self):
>> > if self.journal:
>> > @@ -342,5 +347,10 @@ class transaction(object):
>> >
>> > @active
>> > -def nest(self):
>> > +def nest(self, scope=None):
>> > +scope = scope or frozenset()
>> > +if not scope.issubset(self._scope):
>> > +raise error.ProgrammingError(
>> > +'nested transaction has a superset scope (%s > %s)'
>> > +% (scope, self._scope))
>>
>> Sets are unordered, so this message isn't deterministic. If you think this 
>> could interfere with testing, you should throw some sorted() in here.
>
> Good advice!
>
>> > self.count += 1
>> > self.usages += 1
>> > @@ -555,4 +565,7 @@ class transaction(object):
>> > self.releasefn(self, False) # notify failure of transaction
>> >
>> > +def scope(self):
>> > +return self._scope
>> > +
>>
>> This seems like an anti-pattern. Can the attribute not be exposed directly?
>
> Maybe a "hasscope(scopename) -> bool" method.

I'm with Greg about exposing it directly.

>
> I'll wait for more comments before sending a V2 (with some tests).
> ___
> 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 8 of 8 V2] color: rename '_styles' to '_defaultstyles' for clarity

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Tue, Feb 28, 2017 at 2:54 AM, Pierre-Yves David
 wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1478459814 -3600
> #  Sun Nov 06 20:16:54 2016 +0100
> # Node ID a41cd9cef1827745345adbbc4e5db1bee828ddcf
> # Parent  9a08f902da2abeb6cadae6526874327e01943e61
> # EXP-Topic color
> color: rename '_styles' to '_defaultstyles' for clarity
>
> This should make it clear the dict is only used for new config. Extensions
> should not modify it directly anyway since we have 'extraloader' logic for
> loading '_styles' too.
>
> (as the indenting was touched, we fix it to be more standard).

Queued with the above line dropped. Thanks!

>
> diff --git a/mercurial/color.py b/mercurial/color.py
> --- a/mercurial/color.py
> +++ b/mercurial/color.py
> @@ -72,7 +72,7 @@ except ImportError:
>  'white_background': 47,
>  }
>
> -_styles = {
> +_defaultstyles = {
>  'grep.match': 'red bold',
>  'grep.linenumber': 'green',
>  'grep.rev': 'green',
> @@ -129,7 +129,7 @@ except ImportError:
>  }
>
>  def loadcolortable(ui, extname, colortable):
> -_styles.update(colortable)
> +_defaultstyles.update(colortable)
>
>  def _terminfosetup(ui, mode):
>  '''Initialize terminfo data and the terminal if we're in terminfo 
> mode.'''
> @@ -254,7 +254,7 @@ def _modesetup(ui):
>  return None
>
>  def configstyles(ui):
> -ui._styles.update(_styles)
> +ui._styles.update(_defaultstyles)
>  for status, cfgeffects in ui.configitems('color'):
>  if '.' not in status or status.startswith(('color.', 'terminfo.')):
>  continue
> ___
> 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


mercurial@31108: 2 new changesets

2017-02-28 Thread Mercurial Commits
2 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/fbce78c58f1e
changeset:   31107:fbce78c58f1e
user:Yuya Nishihara 
date:Sun Feb 19 01:00:10 2017 +0900
summary: chg: refactor ui.system() to be partly overridden

https://www.mercurial-scm.org/repo/hg/rev/3f8f53190d6a
changeset:   31108:3f8f53190d6a
bookmark:@
tag: tip
user:Yuya Nishihara 
date:Sun Feb 19 01:16:45 2017 +0900
summary: chg: deduplicate error handling of ui.system()

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


Re: [PATCH 1 of 2] manifest: allow specifying the revlog filename

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
On Tue, Feb 28, 2017 at 9:49 AM, Durham Goode  wrote:
>
>
> On 2/27/17 5:10 PM, Martin von Zweigbergk wrote:
>>
>> +mercurial-devel again (I had initially thought my comment was not
>> about the patch, but it turns out it was)
>>
>> On Sat, Feb 25, 2017 at 3:23 PM, Durham Goode  wrote:
>>>
>>> On 2/24/17 10:00 PM, Martin von Zweigbergk wrote:


 -list

 On Fri, Feb 24, 2017, 14:44 Durham Goode > wrote:

 # HG changeset patch
 # User Durham Goode >
 # Date 1487973639 28800
 #  Fri Feb 24 14:00:39 2017 -0800
 # Node ID ed987b24e755a4c61c006f7d98a4ff370229faad
 # Parent  f01df5d2fe493376a67569756a9bc2ddffa5cd81
 manifest: allow specifying the revlog filename

 Previously we had hardcoded the manifest filename to be
 00manifest.i. In our
 external treemanifest extension, we want to allow writing a
 treemanifest side by
 side with a flat manifest, so we need to be able to store the root
 revisions at
 a different location (in our extension we use 00manifesttree.i).


 Why not meta/00manifest.i? That would be more consistent. I let them
 (flat and tree) share a revlog only to allow for transition between
 them. But if you don't care about that, meta/00manifest.i sounds like
 the obvious choice.
>>>
>>>
>>>
>>> I'd be fine with that too, but I'm not sure how we'd go about that. I
>>> guess
>>> I could put an option on the opener that the manifest constructor checks
>>> for, like 'separatetreeroot=True' and then the constructor would know to
>>> put
>>> it in meta/.  Seem reasonable?
>>
>>
>> Or you could keep your new indexfile argument to the constructor and
>> use that if it was set and otherwise use the current way of
>> calculating it. Your extension could then pass 'meta/00manifest.i' for
>> dir=='' and None for all others. That gives more flexibility if you
>> want to use some other scheme too. Also, I'd like a comment explaining
>> that the parameter is for extensions, so the next person doesn't
>> remove it.
>
>
> I can add a comment.  I think putting directories in the indexfile string
> might be a bit funky since I'm not sure if other parts of the code rely on
> self.indexfile to be just a filename.

I don't follow. You patch touches a line that says

  indexfile = "meta/" + dir + "00manifest.i"

so it already (potentially) has a directory in it. Or do you mean
something else?

>  I guess I can play with that after it
> lands.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] manifest: allow specifying the revlog filename

2017-02-28 Thread Durham Goode



On 2/27/17 5:10 PM, Martin von Zweigbergk wrote:

+mercurial-devel again (I had initially thought my comment was not
about the patch, but it turns out it was)

On Sat, Feb 25, 2017 at 3:23 PM, Durham Goode  wrote:

On 2/24/17 10:00 PM, Martin von Zweigbergk wrote:


-list

On Fri, Feb 24, 2017, 14:44 Durham Goode > wrote:

# HG changeset patch
# User Durham Goode >
# Date 1487973639 28800
#  Fri Feb 24 14:00:39 2017 -0800
# Node ID ed987b24e755a4c61c006f7d98a4ff370229faad
# Parent  f01df5d2fe493376a67569756a9bc2ddffa5cd81
manifest: allow specifying the revlog filename

Previously we had hardcoded the manifest filename to be
00manifest.i. In our
external treemanifest extension, we want to allow writing a
treemanifest side by
side with a flat manifest, so we need to be able to store the root
revisions at
a different location (in our extension we use 00manifesttree.i).


Why not meta/00manifest.i? That would be more consistent. I let them
(flat and tree) share a revlog only to allow for transition between
them. But if you don't care about that, meta/00manifest.i sounds like
the obvious choice.



I'd be fine with that too, but I'm not sure how we'd go about that. I guess
I could put an option on the opener that the manifest constructor checks
for, like 'separatetreeroot=True' and then the constructor would know to put
it in meta/.  Seem reasonable?


Or you could keep your new indexfile argument to the constructor and
use that if it was set and otherwise use the current way of
calculating it. Your extension could then pass 'meta/00manifest.i' for
dir=='' and None for all others. That gives more flexibility if you
want to use some other scheme too. Also, I'd like a comment explaining
that the parameter is for extensions, so the next person doesn't
remove it.


I can add a comment.  I think putting directories in the indexfile 
string might be a bit funky since I'm not sure if other parts of the 
code rely on self.indexfile to be just a filename.  I guess I can play 
with that after it lands.

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


Re: [PATCH] merge: add resolve --prep, which outputs conflicted comparison files

2017-02-28 Thread Danek Duvall
Durham Goode wrote:

> On 2/27/17 11:09 AM, Danek Duvall wrote:
> >Durham Goode wrote:
> >
> >>On 2/24/17 4:10 PM, Danek Duvall wrote:
> >>
> >>>Is that the central issue?  That is, you want to run a tool once over all
> >>>unresolved files, rather than one at a time?
> >>>
> >>>It seems like perhaps a new config option for merge-tools could indicate
> >>>that it takes multiple files.  Then the question is whether the tool should
> >>>know how to generate the list of unresolved files and the various versions
> >>>of them that are involved in the resolution, or whether mercurial should
> >>>compute all that and pass it to the tool in some fashion.
> >>>
> >>>Likewise on the other end, the tool will need to communicate back to
> >>>mercurial which files are now considered resolved, and which ones aren't.
> >>>
> >>>Or am I misunderstanding what you're trying to do?
> >>>
> >>>Danek
> >>
> >>The high level goal is we want to provide an entire conflict experience via
> >>an IDE, so we need all data related to the merge conflicts (content of files
> >>at relevant revisions; type of conflict, like changed vs deleted, or
> >>directory vs file, or executable vs symlink) available at once, and not
> >>during a blocking Mercurial command.  The current merge tool logic doesn't
> >>handle any of those requirements.
> >
> >So why not consider this situation to be a new type of merge tool flag, and
> >then define the protocol for that kind of tool to be a commandline argument
> >of a json file with the necessary data?  It seems like both the original
> >proposal (emit json with a custom flag) and the updated one (emit json with
> >a custom merge tool) are less flexible, and involve more manual effort (you
> >still have to run your tool manually and pass it that json blob).
> 
> Do you mean something like, add a --merge-tool-json flag and mercurial
> executes the specified tool by passing a file path to a json file with the
> data we've been talking about?

By "flag", I meant a configuration variable, a la "gui" -- you would
effectively mark a particular tool as being one that took this json blob as
input and would mark conflicts as resolved independently from mercurial.
Add a new variable $json to "args", and then you can do

[merge-tools]
myIDE.executable = /path/to/wherever
myIDE.async = true
myIDE.args = --conflict-file $json

and whatever other things like gui, symlink, etc, that are true.

> In our scenario, where an IDE wants to receive all the conflict data and
> act on it asynchronously from mercurial's resolution logic, doing this
> using your proposal would mean we'd have to create a bash script or
> something that just copies the json file it's passed to some other
> location so the IDE can read that file after 'hg resolve
> --merge-tool-json simplecopytool.sh' exits (or otherwise communicates the
> information to the IDE somehow).

I don't really see the need for copying anything around.  Just stuff the
blob in a place that mercurial can tell the tool about, and don't remove it
until the tool says it's done.

> >Besides, you can run "hg resolve -l" and "hg cat -r ..." while in the
> >middle of the merge, so I'm not sure what you mean by the merge tool logic
> >doesn't allow you to do that.  Is it that "hg resolve -l" doesn't give you
> >enough data about what metadata is changing?
> 
> hg resolve doesn't give us information about the various versions of the
> file or information about the type of conflict, and even if it did give us
> the hashes of those versions, shelling out to hg cat for each one is
> excessively slow in large repos.

I see; sure.  Then either the tool can do it all with Python code calling
the mercurial bits (okay, probably not great), or the json blob just
includes paths to each version of each file, and mercurial lines them all
up ahead of time.  The tool can regenerate them if it comes to that.

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


Re: [PATCH 2 of 7] color: initialize color for local peer ui

2017-02-28 Thread Pierre-Yves David



On 02/28/2017 03:29 PM, Yuya Nishihara wrote:

On Tue, 28 Feb 2017 11:35:03 +0100, Pierre-Yves David wrote:

On 02/28/2017 11:24 AM, Pierre-Yves David wrote:

On 02/28/2017 07:57 AM, Martin von Zweigbergk wrote:

On Mon, Feb 27, 2017 at 6:59 AM, Pierre-Yves David
 wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1488044041 -3600
#  Sat Feb 25 18:34:01 2017 +0100
# Node ID c3224694bdae9cdb7530f952e2c767e419b7f280
# Parent  92526381242cd381375a465d5a800446916d2d7b
# EXP-Topic color
color: initialize color for local peer ui

The local peer


"local peer" or "localrepository"? The patch seems to be in "class
localrepository".


hum, good catch. Things seems clowner than I expected. It looks like we
don't use the "lui" (local ui, goes through uisetup) to create the
repository but the "baseui" (does not goes through uisetup).

Let me grab a shovel and go bad into that code.


Okay so in short "ui initialisation business is not simple". That
description should be:

color: initialize color for the localrepo ui

The 'ui' object dedicated to a 'localrepo' is independant from the one
available in dispatch (and 'uisetup'). In addition, it is created from
the 'baseui' (for good reason apparently). For this reason, we need to
run the color setup on it after the local repository config is read.


Maybe we can move color.setup() to ui.fixconfig(), where ui attributes are
updated reflecting to config changes.


I considered it but it did not seemed appropriate. Fixconfig is run 
quite often and the setup function is erasing most internal state 
related to color. I was not confident make that change. I'm not saying 
it is entirely impossible but that requires a careful review of the 
setup process and other fixconfig related thing. So I would rather not 
go this route for now. In particular, running during 'fixconfig' would 
mean running it 'too early' before the extensions are loaded (they might 
change the default style.


Cheers,

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


Re: [PATCH v2] Change the default:push to default:pushurl

2017-02-28 Thread Yuya Nishihara
On Tue, 28 Feb 2017 20:15:21 +0530, rishi shah wrote:
> # HG changeset patch
> # User rishi shah 
> # Date 1488292877 -19800
> #  Tue Feb 28 20:11:17 2017 +0530
> # Node ID e7c4a1d4462a6384d4651b85a8268c17d47f2d93
> # Parent  89dfe9ddd03a25d795201c1a6a975833b8281b3c
> Change the default:push to default:pushurl

Thanks, but it's just fixed by 4431add9aef9.

https://www.mercurial-scm.org/repo/hg/rev/4431add9aef9

Please see also the wiki for our coding/patch style.

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


[PATCH v2] Change the default:push to default:pushurl

2017-02-28 Thread rishi shah
# HG changeset patch
# User rishi shah 
# Date 1488292877 -19800
#  Tue Feb 28 20:11:17 2017 +0530
# Node ID e7c4a1d4462a6384d4651b85a8268c17d47f2d93
# Parent  89dfe9ddd03a25d795201c1a6a975833b8281b3c
Change the default:push to default:pushurl

diff -r 89dfe9ddd03a -r e7c4a1d4462a mercurial/ui.py
--- a/mercurial/ui.py   Tue Feb 28 19:27:34 2017 +0530
+++ b/mercurial/ui.py   Tue Feb 28 20:11:17 2017 +0530
@@ -61,7 +61,7 @@
 # path aliases to other clones of this repo in URLs or filesystem paths
 # (see 'hg help config.paths' for more info)
 #
-# default:push = ssh://j...@example.net/hg/jdoes-fork
+# default:pushurl = ssh://j...@example.net/hg/jdoes-fork
 # my-fork  = ssh://j...@example.net/hg/jdoes-fork
 # my-clone = /home/jdoe/jdoes-clone
 
@@ -77,7 +77,7 @@
 # (see 'hg help config.paths' for more info)
 #
 # default  = http://example.com/hg/example-repo
-# default:push = ssh://j...@example.net/hg/jdoes-fork
+# default:pushurl = ssh://j...@example.net/hg/jdoes-fork
 # my-fork  = ssh://j...@example.net/hg/jdoes-fork
 # my-clone = /home/jdoe/jdoes-clone
 
diff -r 89dfe9ddd03a -r e7c4a1d4462a tests/test-hgrc.t
--- a/tests/test-hgrc.t Tue Feb 28 19:27:34 2017 +0530
+++ b/tests/test-hgrc.t Tue Feb 28 20:11:17 2017 +0530
@@ -35,7 +35,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r 89dfe9ddd03a -r e7c4a1d4462a tests/test-pull-http.t
--- a/tests/test-pull-http.tTue Feb 28 19:27:34 2017 +0530
+++ b/tests/test-pull-http.tTue Feb 28 20:11:17 2017 +0530
@@ -33,7 +33,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r 89dfe9ddd03a -r e7c4a1d4462a tests/test-revset-outgoing.t
--- a/tests/test-revset-outgoing.t  Tue Feb 28 19:27:34 2017 +0530
+++ b/tests/test-revset-outgoing.t  Tue Feb 28 20:11:17 2017 +0530
@@ -43,7 +43,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
@@ -95,7 +95,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r 89dfe9ddd03a -r e7c4a1d4462a tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t   Tue Feb 28 19:27:34 2017 +0530
+++ b/tests/test-subrepo-deep-nested-change.t   Tue Feb 28 20:11:17 2017 +0530
@@ -134,7 +134,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
@@ -695,7 +695,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r 89dfe9ddd03a -r e7c4a1d4462a tests/test-url-rev.t
--- a/tests/test-url-rev.t  Tue Feb 28 19:27:34 2017 +0530
+++ b/tests/test-url-rev.t  Tue Feb 28 20:11:17 2017 +0530
@@ -48,7 +48,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default:push = ssh://j...@example.net/hg/jdoes-fork
+  # default:pushurl = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 7] color: initialize color for local peer ui

2017-02-28 Thread Yuya Nishihara
On Tue, 28 Feb 2017 11:35:03 +0100, Pierre-Yves David wrote:
> On 02/28/2017 11:24 AM, Pierre-Yves David wrote:
> > On 02/28/2017 07:57 AM, Martin von Zweigbergk wrote:
> >> On Mon, Feb 27, 2017 at 6:59 AM, Pierre-Yves David
> >>  wrote:
> >>> # HG changeset patch
> >>> # User Pierre-Yves David 
> >>> # Date 1488044041 -3600
> >>> #  Sat Feb 25 18:34:01 2017 +0100
> >>> # Node ID c3224694bdae9cdb7530f952e2c767e419b7f280
> >>> # Parent  92526381242cd381375a465d5a800446916d2d7b
> >>> # EXP-Topic color
> >>> color: initialize color for local peer ui
> >>>
> >>> The local peer
> >>
> >> "local peer" or "localrepository"? The patch seems to be in "class
> >> localrepository".
> >
> > hum, good catch. Things seems clowner than I expected. It looks like we
> > don't use the "lui" (local ui, goes through uisetup) to create the
> > repository but the "baseui" (does not goes through uisetup).
> >
> > Let me grab a shovel and go bad into that code.
> 
> Okay so in short "ui initialisation business is not simple". That 
> description should be:
> 
> color: initialize color for the localrepo ui
> 
> The 'ui' object dedicated to a 'localrepo' is independant from the one 
> available in dispatch (and 'uisetup'). In addition, it is created from 
> the 'baseui' (for good reason apparently). For this reason, we need to 
> run the color setup on it after the local repository config is read.

Maybe we can move color.setup() to ui.fixconfig(), where ui attributes are
updated reflecting to config changes.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 09 of 11 V5] update: accept --merge to allow merging across topo branches (issue5125)

2017-02-28 Thread Martin von Zweigbergk via Mercurial-devel
Sure, sounds good to me. I'd appreciate if that can be changed in flight.

On Tue, Feb 28, 2017, 01:37 Denis Laxalde  wrote:

> Martin von Zweigbergk via Mercurial-devel a écrit :
> > # HG changeset patch
> > # User Martin von Zweigbergk 
> > # Date 1487019517 28800
> > #  Mon Feb 13 12:58:37 2017 -0800
> > # Node ID d23e5a40f9c4c8d3459255c6c2cb633452b914d8
> > # Parent  b99e3df11bb16c8c1118f2bf29ea0d0816591259
> > update: accept --merge to allow merging across topo branches (issue5125)
> >
> > diff -r b99e3df11bb1 -r d23e5a40f9c4 mercurial/commands.py
> > --- a/mercurial/commands.py   Mon Feb 27 15:09:19 2017 -0800
> > +++ b/mercurial/commands.py   Mon Feb 13 12:58:37 2017 -0800
> > @@ -5279,12 +5279,13 @@
> >  @command('^update|up|checkout|co',
> >  [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
> >  ('c', 'check', None, _('require clean working directory')),
> > +('m', 'merge', None, _('merge local changes')),
>
> It's not obvious to me what "local changes" means, perhaps "uncommitted
> changes" would be better (more consistent with the docstring also).
>
> >  ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
> >  ('r', 'rev', '', _('revision'), _('REV'))
> >   ] + mergetoolopts,
> > -_('[-C|-c] [-d DATE] [[-r] REV]'))
> > +_('[-C|-c|-m] [-d DATE] [[-r] REV]'))
> >  def update(ui, repo, node=None, rev=None, clean=False, date=None,
> check=False,
> > -   tool=None):
> > +   merge=None, tool=None):
> >  """update working directory (or switch revisions)
> >
> >  Update the repository's working directory to the specified
> > @@ -5303,8 +5304,8 @@
> >
> >  .. container:: verbose
> >
> > -  The -C/--clean and -c/--check options control what happens if the
> > -  working directory contains uncommitted changes.
> > +  The -C/--clean, -c/--check, and -m/--merge options control what
> > +  happens if the working directory contains uncommitted changes.
> >At most of one of them can be specified.
> >
> >1. If no option is specified, and if
> > @@ -5316,10 +5317,14 @@
> >   branch), the update is aborted and the uncommitted changes
> >   are preserved.
> >
> > -  2. With the -c/--check option, the update is aborted and the
> > +  2. With the -m/--merge option, the update is allowed even if the
> > + requested changeset is not an ancestor or descendant of
> > + the working directory's parent.
> > +
> > +  3. With the -c/--check option, the update is aborted and the
> >   uncommitted changes are preserved.
> >
> > -  3. With the -C/--clean option, uncommitted changes are discarded
> and
> > +  4. With the -C/--clean option, uncommitted changes are discarded
> and
> >   the working directory is updated to the requested changeset.
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 3 of 4 V2] chgcache: implement the background preloading thread

2017-02-28 Thread Yuya Nishihara
On Mon, 27 Feb 2017 09:47:21 -0800, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2017-02-28 01:02:23 +0900:
> > On Wed, 22 Feb 2017 18:16:10 -0800, Jun Wu wrote:
> > > # HG changeset patch
> > > # User Jun Wu 
> > > # Date 1487813979 28800
> > > #  Wed Feb 22 17:39:39 2017 -0800
> > > # Node ID 28571825744fb4f4b424385f55afa9484532ef43
> > > # Parent  630457e88fa0485bce7822345ea640b5cdcb9b8e
> > > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > > #  hg pull https://bitbucket.org/quark-zju/hg-draft  -r 
> > > 28571825744f
> > > chgcache: implement the background preloading thread

> > > +def stop(self):
> > > +if self._thread is None:
> > > +return
> > > +self._shouldexit.set()
> > > +self._ipc.send('') # unblock (possibly blocking) recv()
> > 
> > Ok, that will work though I'm not a fan of it.
> > 
> > Perhaps a cleaner way is to move recv() to the main loop of the server,
> > and deliver received messages via thread-safe queue + event. But that will
> > need more codes.
> 
> That sounds over complicated. Maybe shm is a better approach (no atime
> needed, no blocking / close issues, need extra code to write "atomically"
> but that's not hard)

Yeah, not simple, but I think that is an old-school way of writing a network
application.

Anyway, I'm not saying we should do that. Let's starts with a simpler code
(e.g. not stopping the thread at exit), if we are not going to handle
resources carefully. And that should be okay here. It's just chg.

OTOH, we'll need to design localrepo stuff in a higher level since it's an
important module and will be touched by more people who don't know chg.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 4 V2] chgcache: report repo paths from worker to master

2017-02-28 Thread Yuya Nishihara
On Mon, 27 Feb 2017 10:11:50 -0800, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2017-02-28 00:46:14 +0900:
> > On Wed, 22 Feb 2017 18:16:09 -0800, Jun Wu wrote:
> > > # HG changeset patch
> > > # User Jun Wu 
> > > # Date 1487807803 28800
> > > #  Wed Feb 22 15:56:43 2017 -0800
> > > # Node ID 630457e88fa0485bce7822345ea640b5cdcb9b8e
> > > # Parent  aef9e96fb573b85f5731367a470f574dbe730839
> > > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > > #  hg pull https://bitbucket.org/quark-zju/hg-draft  -r 
> > > 630457e88fa0
> > > chgcache: report repo paths from worker to master
> > 
> > > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> > > --- a/mercurial/localrepo.py
> > > +++ b/mercurial/localrepo.py
> > > @@ -29,4 +29,5 @@ from . import (
> > >  changegroup,
> > >  changelog,
> > > +chgcache,
> > >  context,
> > >  dirstate,
> > > @@ -371,4 +372,7 @@ class localrepository(object):
> > >  self.names = namespaces.namespaces()
> > >  
> > > +# record the repo path so chg worker could tell master what to 
> > > preload
> > > +chgcache.recordrepopath(path)
> > 
> > I feel this a bit uncomfortable that the repo instance registers itself to
> > chgcache. Suppose preloading will be handled in upper layer (maybe in 
> > dispatch),
> > I think recordrepopath() should be called at the same layer. Or are we 
> > planning
> > to handle all chgcache things in localrepo?
> 
> I think the "stateful" state is mainly about repos - the cache key will
> likely include repo path and cache invalidation test requires repo.vfs and
> svfs.  So it will be coupled with repo one way or another.
> 
> The "chgcache" module is low-level imo - it does not depend on any other
> mercurial modules. So I feel it's okay to use it everywhere, where the
> object being loaded knows a repo object, ex. phasescache. Ideally I want to
> use chgcache for changelog index, dirstate, and obsstore directly, but they
> do not have a repo object (so cache invalidation is a problem).
> 
> Moving all of them to dispatch may be possible, by subclassing
> localrepository and let chgserver replaces the default one. The major
> concern is compatibility issues with other extensions wrapping
> localrepository.

Perhaps this is related to the baselocalrepostiroy-vs-repostorage story. Maybe
we'll have to settle it first?

My view is that there will be a repostorage object, which will be looked up
at dispatch layer and be injected into a localrepository object. So localrepo
can ideally go without knowing chgcache.

  dispatch (or hook carried by req object)
cached_storage = chgcache.lookup(root)
attach_storage_in_some_way(repo, cached_storage)

In this view, it makes sense to record the repo path here.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 4 V2] chgcache: implement socketpair-based IPC

2017-02-28 Thread Yuya Nishihara
On Mon, 27 Feb 2017 09:49:01 -0800, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2017-02-28 00:37:04 +0900:
> > On Wed, 22 Feb 2017 18:16:08 -0800, Jun Wu wrote:
> > > # HG changeset patch
> > > # User Jun Wu 
> > > # Date 1487802520 28800
> > > #  Wed Feb 22 14:28:40 2017 -0800
> > > # Node ID aef9e96fb573b85f5731367a470f574dbe730839
> > > # Parent  80f04ba7f4d1f439d726068f02172f9a52b981fe
> > > # Available At https://bitbucket.org/quark-zju/hg-draft 
> > > #  hg pull https://bitbucket.org/quark-zju/hg-draft  -r 
> > > aef9e96fb573
> > > chgcache: implement socketpair-based IPC

> > > +def recv(self):
> > > +"""receive a complete msg. will block."""
> > > +select.select([self._in], [], [])
> > > +# get message length, see "man tty_ioctl", not POSIX compliant
> > > +intbuf = array.array('i', [0])
> > > +fcntl.ioctl(self._in, termios.FIONREAD, intbuf)
> > > +msglen = intbuf[0]
> > > +# allocate one more byte, so we can detect bad msglen (bad OS)
> > > +msg = self._in.recv(msglen + 1)
> > > +assert len(msg) == msglen
> > > +return msg
> > 
> > Looks okay, but can't we simply call recv() with reasonably large buffer 
> > size
> > (e.g. 8k) ?
> 
> That's actually a good idea. I was not very comfortable with the non-POSIX
> API too.
> 
> > Nit: if all peer ends were closed appropriately, recv() would return '' and 
> > the
> > assertion would fail.
> 
> Currently, that's impossible - the master does not close the fds.

So the assertion looked incorrect in point of socketipc class design.

> > > +def __del__(self):
> > > +self._in.close()
> > > +self._out.close()
> > 
> > It's generally a bad idea to free resources by GC. Can't we have .close()
> > method?
> 
> Actually I had tried but it seems over complicated. "close" and "recv" may
> be called from different threads, thus thread lock may be necessary.

Maybe that's because the socketipc class manages channels that should actually
be separated. Producers only need the _out channel, and the consumer does _in.

(Strictly speaking, the _in channel should be closed in child processes after
fork(), but I don't care much about it since child processes are short-lived.)

> And it
> requires a way to interrupt a blocking "recv" from "close", which is quite
> painful to do "correctly" (see the reply to that patch).

Yep. If we aren't going to handle resources strictly, I would drop these
close() calls at all.

> It seems shm does
> not introduce these kinds of troubles.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] Bug 5485 - Default hgrc generated on clone references the obsolete "default-push" path

2017-02-28 Thread rishi shah
# HG changeset patch
# User rishi shah 
# Date 1488290254 -19800
#  Tue Feb 28 19:27:34 2017 +0530
# Node ID 89dfe9ddd03a25d795201c1a6a975833b8281b3c
# Parent  e02646d2c3e326efd1c030de135901cce1384f5e
Bug 5485 - Default hgrc generated on clone references the obsolete 
"default-push" path
The default push URL was formerly named default-push (still supported as an 
alias for backwards compatibility), but was changed to default:pushurl a while 
ago. So this patch is to update the default-push to default:push variable in 
the default HGRC file.

diff -r e02646d2c3e3 -r 89dfe9ddd03a mercurial/ui.py
--- a/mercurial/ui.py   Wed Feb 22 17:54:24 2017 +0530
+++ b/mercurial/ui.py   Tue Feb 28 19:27:34 2017 +0530
@@ -61,7 +61,7 @@
 # path aliases to other clones of this repo in URLs or filesystem paths
 # (see 'hg help config.paths' for more info)
 #
-# default-push = ssh://j...@example.net/hg/jdoes-fork
+# default:push = ssh://j...@example.net/hg/jdoes-fork
 # my-fork  = ssh://j...@example.net/hg/jdoes-fork
 # my-clone = /home/jdoe/jdoes-clone
 
@@ -77,7 +77,7 @@
 # (see 'hg help config.paths' for more info)
 #
 # default  = http://example.com/hg/example-repo
-# default-push = ssh://j...@example.net/hg/jdoes-fork
+# default:push = ssh://j...@example.net/hg/jdoes-fork
 # my-fork  = ssh://j...@example.net/hg/jdoes-fork
 # my-clone = /home/jdoe/jdoes-clone
 
diff -r e02646d2c3e3 -r 89dfe9ddd03a tests/test-hgrc.t
--- a/tests/test-hgrc.t Wed Feb 22 17:54:24 2017 +0530
+++ b/tests/test-hgrc.t Tue Feb 28 19:27:34 2017 +0530
@@ -35,7 +35,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r e02646d2c3e3 -r 89dfe9ddd03a tests/test-pull-http.t
--- a/tests/test-pull-http.tWed Feb 22 17:54:24 2017 +0530
+++ b/tests/test-pull-http.tTue Feb 28 19:27:34 2017 +0530
@@ -33,7 +33,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r e02646d2c3e3 -r 89dfe9ddd03a tests/test-revset-outgoing.t
--- a/tests/test-revset-outgoing.t  Wed Feb 22 17:54:24 2017 +0530
+++ b/tests/test-revset-outgoing.t  Tue Feb 28 19:27:34 2017 +0530
@@ -43,7 +43,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
@@ -95,7 +95,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r e02646d2c3e3 -r 89dfe9ddd03a tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t   Wed Feb 22 17:54:24 2017 +0530
+++ b/tests/test-subrepo-deep-nested-change.t   Tue Feb 28 19:27:34 2017 +0530
@@ -134,7 +134,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
@@ -695,7 +695,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
diff -r e02646d2c3e3 -r 89dfe9ddd03a tests/test-url-rev.t
--- a/tests/test-url-rev.t  Wed Feb 22 17:54:24 2017 +0530
+++ b/tests/test-url-rev.t  Tue Feb 28 19:27:34 2017 +0530
@@ -48,7 +48,7 @@
   # path aliases to other clones of this repo in URLs or filesystem paths
   # (see 'hg help config.paths' for more info)
   #
-  # default-push = ssh://j...@example.net/hg/jdoes-fork
+  # default:push = ssh://j...@example.net/hg/jdoes-fork
   # my-fork  = ssh://j...@example.net/hg/jdoes-fork
   # my-clone = /home/jdoe/jdoes-clone
   
___

[PATCH 8 of 8 V2] color: rename '_styles' to '_defaultstyles' for clarity

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1478459814 -3600
#  Sun Nov 06 20:16:54 2016 +0100
# Node ID a41cd9cef1827745345adbbc4e5db1bee828ddcf
# Parent  9a08f902da2abeb6cadae6526874327e01943e61
# EXP-Topic color
color: rename '_styles' to '_defaultstyles' for clarity

This should make it clear the dict is only used for new config. Extensions
should not modify it directly anyway since we have 'extraloader' logic for
loading '_styles' too.

(as the indenting was touched, we fix it to be more standard).

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -72,7 +72,7 @@ except ImportError:
 'white_background': 47,
 }
 
-_styles = {
+_defaultstyles = {
 'grep.match': 'red bold',
 'grep.linenumber': 'green',
 'grep.rev': 'green',
@@ -129,7 +129,7 @@ except ImportError:
 }
 
 def loadcolortable(ui, extname, colortable):
-_styles.update(colortable)
+_defaultstyles.update(colortable)
 
 def _terminfosetup(ui, mode):
 '''Initialize terminfo data and the terminal if we're in terminfo mode.'''
@@ -254,7 +254,7 @@ def _modesetup(ui):
 return None
 
 def configstyles(ui):
-ui._styles.update(_styles)
+ui._styles.update(_defaultstyles)
 for status, cfgeffects in ui.configitems('color'):
 if '.' not in status or status.startswith(('color.', 'terminfo.')):
 continue
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 8 V2] color: pass 'ui' to 'win32print'

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1478459453 -3600
#  Sun Nov 06 20:10:53 2016 +0100
# Node ID b29fb424dbc9e6fc13c369c34277e3fb36284cd4
# Parent  244883d4b3dcd860631dde2fb2610ad3d8b52139
# EXP-Topic color
color: pass 'ui' to 'win32print'

Same logic as before,'win32print' relies on some data we will move on the 'ui'
object soon, we update the API beforehand for clarity.

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -423,11 +423,11 @@ if pycompat.osname == 'nt':
 ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)',
 re.MULTILINE | re.DOTALL)
 
-def win32print(writefunc, *msgs, **opts):
+def win32print(ui, writefunc, *msgs, **opts):
 for text in msgs:
-_win32print(text, writefunc, **opts)
+_win32print(ui, text, writefunc, **opts)
 
-def _win32print(text, writefunc, **opts):
+def _win32print(ui, text, writefunc, **opts):
 label = opts.get('label', '')
 attr = origattr
 
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -805,7 +805,7 @@ class ui(object):
 elif self._colormode == 'win32':
 # windows color printing is its own can of crab, defer to
 # the color module and that is it.
-color.win32print(self._write, *args, **opts)
+color.win32print(self, self._write, *args, **opts)
 else:
 msgs = args
 if self._colormode is not None:
@@ -831,7 +831,7 @@ class ui(object):
 elif self._colormode == 'win32':
 # windows color printing is its own can of crab, defer to
 # the color module and that is it.
-color.win32print(self._write_err, *args, **opts)
+color.win32print(self, self._write_err, *args, **opts)
 else:
 msgs = args
 if self._colormode is not None:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 7 of 8 V2] color: move 'styles' definition on the 'ui' object

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1478459761 -3600
#  Sun Nov 06 20:16:01 2016 +0100
# Node ID 9a08f902da2abeb6cadae6526874327e01943e61
# Parent  b29fb424dbc9e6fc13c369c34277e3fb36284cd4
# EXP-Topic color
color: move 'styles' definition on the 'ui' object

Same logic as for '_terminfoparams'. The content depends on the config so it
should be specific to each 'ui instance.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -207,31 +207,31 @@ def debugcolor(ui, repo, **opts):
 return _debugdisplaycolor(ui)
 
 def _debugdisplaycolor(ui):
-oldstyle = color._styles.copy()
+oldstyle = ui._styles.copy()
 try:
-color._styles.clear()
+ui._styles.clear()
 for effect in color._effects.keys():
-color._styles[effect] = effect
+ui._styles[effect] = effect
 if ui._terminfoparams:
 for k, v in ui.configitems('color'):
 if k.startswith('color.'):
-color._styles[k] = k[6:]
+ui._styles[k] = k[6:]
 elif k.startswith('terminfo.'):
-color._styles[k] = k[9:]
+ui._styles[k] = k[9:]
 ui.write(_('available colors:\n'))
 # sort label with a '_' after the other to group '_background' entry.
-items = sorted(color._styles.items(),
+items = sorted(ui._styles.items(),
key=lambda i: ('_' in i[0], i[0], i[1]))
 for colorname, label in items:
 ui.write(('%s\n') % colorname, label=label)
 finally:
-color._styles.clear()
-color._styles.update(oldstyle)
+ui._styles.clear()
+ui._styles.update(oldstyle)
 
 def _debugdisplaystyle(ui):
 ui.write(_('available style:\n'))
-width = max(len(s) for s in color._styles)
-for label, effects in sorted(color._styles.items()):
+width = max(len(s) for s in ui._styles)
+for label, effects in sorted(ui._styles.items()):
 ui.write('%s' % label, label=label)
 if effects:
 # 50
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -254,6 +254,7 @@ def _modesetup(ui):
 return None
 
 def configstyles(ui):
+ui._styles.update(_styles)
 for status, cfgeffects in ui.configitems('color'):
 if '.' not in status or status.startswith(('color.', 'terminfo.')):
 continue
@@ -267,7 +268,7 @@ def configstyles(ui):
 ui.warn(_("ignoring unknown color/effect %r "
   "(configured in color.%s)\n")
 % (e, status))
-_styles[status] = ' '.join(good)
+ui._styles[status] = ' '.join(good)
 
 def valideffect(ui, effect):
 'Determine if the effect is valid or not.'
@@ -321,7 +322,7 @@ def colorlabel(ui, msg, label):
 elif ui._colormode is not None:
 effects = []
 for l in label.split():
-s = _styles.get(l, '')
+s = ui._styles.get(l, '')
 if s:
 effects.append(s)
 elif valideffect(ui, l):
@@ -443,7 +444,7 @@ if pycompat.osname == 'nt':
 
 # determine console attributes based on labels
 for l in label.split():
-style = _styles.get(l, '')
+style = ui._styles.get(l, '')
 for effect in style.split():
 try:
 attr = mapcolor(w32effects[effect], attr)
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -158,6 +158,7 @@ class ui(object):
 # color mode: see mercurial/color.py for possible value
 self._colormode = None
 self._terminfoparams = {}
+self._styles = {}
 
 if src:
 self.fout = src.fout
@@ -176,6 +177,7 @@ class ui(object):
 self.insecureconnections = src.insecureconnections
 self._colormode = src._colormode
 self._terminfoparams = src._terminfoparams.copy()
+self._styles = src._styles.copy()
 
 self.fixconfig()
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 8 V2] color: reinvent dictionary

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488278527 -3600
#  Tue Feb 28 11:42:07 2017 +0100
# Node ID 50ee9136a49a79ea381e3530eed8b114c76cdf7a
# Parent  a185b903bda3c64678d1f9399bfa0be8d326dbff
# EXP-Topic color
color: reinvent dictionary

move the module lever dictionary declaration to a more standard (and practical
indentation)

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -19,105 +19,111 @@ try:
 import curses
 # Mapping from effect name to terminfo attribute name (or raw code) or
 # color number.  This will also force-load the curses module.
-_terminfo_params = {'none': (True, 'sgr0', ''),
-'standout': (True, 'smso', ''),
-'underline': (True, 'smul', ''),
-'reverse': (True, 'rev', ''),
-'inverse': (True, 'rev', ''),
-'blink': (True, 'blink', ''),
-'dim': (True, 'dim', ''),
-'bold': (True, 'bold', ''),
-'invisible': (True, 'invis', ''),
-'italic': (True, 'sitm', ''),
-'black': (False, curses.COLOR_BLACK, ''),
-'red': (False, curses.COLOR_RED, ''),
-'green': (False, curses.COLOR_GREEN, ''),
-'yellow': (False, curses.COLOR_YELLOW, ''),
-'blue': (False, curses.COLOR_BLUE, ''),
-'magenta': (False, curses.COLOR_MAGENTA, ''),
-'cyan': (False, curses.COLOR_CYAN, ''),
-'white': (False, curses.COLOR_WHITE, '')}
+_terminfo_params = {
+'none': (True, 'sgr0', ''),
+'standout': (True, 'smso', ''),
+'underline': (True, 'smul', ''),
+'reverse': (True, 'rev', ''),
+'inverse': (True, 'rev', ''),
+'blink': (True, 'blink', ''),
+'dim': (True, 'dim', ''),
+'bold': (True, 'bold', ''),
+'invisible': (True, 'invis', ''),
+'italic': (True, 'sitm', ''),
+'black': (False, curses.COLOR_BLACK, ''),
+'red': (False, curses.COLOR_RED, ''),
+'green': (False, curses.COLOR_GREEN, ''),
+'yellow': (False, curses.COLOR_YELLOW, ''),
+'blue': (False, curses.COLOR_BLUE, ''),
+'magenta': (False, curses.COLOR_MAGENTA, ''),
+'cyan': (False, curses.COLOR_CYAN, ''),
+'white': (False, curses.COLOR_WHITE, ''),
+}
 except ImportError:
 curses = None
 _terminfo_params = {}
 
 # start and stop parameters for effects
-_effects = {'none': 0,
-'black': 30,
-'red': 31,
-'green': 32,
-'yellow': 33,
-'blue': 34,
-'magenta': 35,
-'cyan': 36,
-'white': 37,
-'bold': 1,
-'italic': 3,
-'underline': 4,
-'inverse': 7,
-'dim': 2,
-'black_background': 40,
-'red_background': 41,
-'green_background': 42,
-'yellow_background': 43,
-'blue_background': 44,
-'purple_background': 45,
-'cyan_background': 46,
-'white_background': 47}
+_effects = {
+'none': 0,
+'black': 30,
+'red': 31,
+'green': 32,
+'yellow': 33,
+'blue': 34,
+'magenta': 35,
+'cyan': 36,
+'white': 37,
+'bold': 1,
+'italic': 3,
+'underline': 4,
+'inverse': 7,
+'dim': 2,
+'black_background': 40,
+'red_background': 41,
+'green_background': 42,
+'yellow_background': 43,
+'blue_background': 44,
+'purple_background': 45,
+'cyan_background': 46,
+'white_background': 47,
+}
 
-_styles = {'grep.match': 'red bold',
-   'grep.linenumber': 'green',
-   'grep.rev': 'green',
-   'grep.change': 'green',
-   'grep.sep': 'cyan',
-   'grep.filename': 'magenta',
-   'grep.user': 'magenta',
-   'grep.date': 'magenta',
-   'bookmarks.active': 'green',
-   'branches.active': 'none',
-   'branches.closed': 'black bold',
-   'branches.current': 'green',
-   'branches.inactive': 'none',
-   'diff.changed': 'white',
-   'diff.deleted': 'red',
-   'diff.diffline': 'bold',
-   'diff.extended': 'cyan bold',
-   'diff.file_a': 'red bold',
-   'diff.file_b': 'green bold',
-   'diff.hunk': 'magenta',
-   'diff.inserted': 'green',
-   'diff.tab': '',
-   'diff.trailingwhitespace': 'bold red_background',
-   'changeset.public' : '',
-   'changeset.draft' : '',
-   'changeset.secret' : '',
-   'diffstat.deleted': 'red',
-   'diffstat.inserted': 'green',
-   'histedit.remaining': 'red bold',
-   

[PATCH 4 of 8 V2] color: add ui to effect rendering

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488031244 -3600
#  Sat Feb 25 15:00:44 2017 +0100
# Node ID 39d07e7ccfaef5f4596ce919846fcccb207ec60f
# Parent  ed4cc3fba316882cda44f80bb143ebd32dd11bb1
# EXP-Topic color
color: add ui to effect rendering

We'll carry more and more color specific data on the ui object. This will help
isolating different color configuration from each other. For example repository
config might configure special style that should not affect other ui object.

The first step is to make sure the ui object is available were we will needs it.

diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -260,7 +260,7 @@ def configstyles(ui):
 if cfgeffects:
 good = []
 for e in cfgeffects:
-if valideffect(e):
+if valideffect(ui, e):
 good.append(e)
 else:
 ui.warn(_("ignoring unknown color/effect %r "
@@ -268,13 +268,13 @@ def configstyles(ui):
 % (e, status))
 _styles[status] = ' '.join(good)
 
-def valideffect(effect):
+def valideffect(ui, effect):
 'Determine if the effect is valid or not.'
 return ((not _terminfo_params and effect in _effects)
  or (effect in _terminfo_params
  or effect[:-11] in _terminfo_params))
 
-def _effect_str(effect):
+def _effect_str(ui, effect):
 '''Helper function for render_effects().'''
 
 bg = False
@@ -295,14 +295,14 @@ def _effect_str(effect):
 else:
 return curses.tparm(curses.tigetstr('setaf'), val)
 
-def _render_effects(text, effects):
+def _render_effects(ui, text, effects):
 'Wrap text in commands to turn on each effect.'
 if not text:
 return text
 if _terminfo_params:
-start = ''.join(_effect_str(effect)
+start = ''.join(_effect_str(ui, effect)
 for effect in ['none'] + effects.split())
-stop = _effect_str('none')
+stop = _effect_str(ui, 'none')
 else:
 start = [str(_effects[e]) for e in ['none'] + effects.split()]
 start = '\033[' + ';'.join(start) + 'm'
@@ -323,11 +323,11 @@ def colorlabel(ui, msg, label):
 s = _styles.get(l, '')
 if s:
 effects.append(s)
-elif valideffect(l):
+elif valideffect(ui, l):
 effects.append(l)
 effects = ' '.join(effects)
 if effects:
-msg = '\n'.join([_render_effects(line, effects)
+msg = '\n'.join([_render_effects(ui, line, effects)
  for line in msg.split('\n')])
 return msg
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 8 V2] color: move the dict with terminfo parameters on the ui object

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488031251 -3600
#  Sat Feb 25 15:00:51 2017 +0100
# Node ID 244883d4b3dcd860631dde2fb2610ad3d8b52139
# Parent  39d07e7ccfaef5f4596ce919846fcccb207ec60f
# EXP-Topic color
color: move the dict with terminfo parameters on the ui object

This dictionnary is affected by the content of the config, so we should have
one for each ui config.

We rename the global dict to '_baseterminfoparams' to make the situation
clearer.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -212,7 +212,7 @@ def _debugdisplaycolor(ui):
 color._styles.clear()
 for effect in color._effects.keys():
 color._styles[effect] = effect
-if color._terminfo_params:
+if ui._terminfoparams:
 for k, v in ui.configitems('color'):
 if k.startswith('color.'):
 color._styles[k] = k[6:]
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -19,7 +19,7 @@ try:
 import curses
 # Mapping from effect name to terminfo attribute name (or raw code) or
 # color number.  This will also force-load the curses module.
-_terminfo_params = {
+_baseterminfoparams = {
 'none': (True, 'sgr0', ''),
 'standout': (True, 'smso', ''),
 'underline': (True, 'smul', ''),
@@ -41,7 +41,7 @@ try:
 }
 except ImportError:
 curses = None
-_terminfo_params = {}
+_baseterminfoparams = {}
 
 # allow the extensions to change the default
 _enabledbydefault = False
@@ -140,35 +140,36 @@ def _terminfosetup(ui, mode):
 # Otherwise, see what the config file says.
 if mode not in ('auto', 'terminfo'):
 return
+ui._terminfoparams.update(_baseterminfoparams)
 
 for key, val in ui.configitems('color'):
 if key.startswith('color.'):
 newval = (False, int(val), '')
-_terminfo_params[key[6:]] = newval
+ui._terminfoparams[key[6:]] = newval
 elif key.startswith('terminfo.'):
 newval = (True, '', val.replace('\\E', '\x1b'))
-_terminfo_params[key[9:]] = newval
+ui._terminfoparams[key[9:]] = newval
 try:
 curses.setupterm()
 except curses.error as e:
-_terminfo_params.clear()
+ui._terminfoparams.clear()
 return
 
-for key, (b, e, c) in _terminfo_params.items():
+for key, (b, e, c) in ui._terminfoparams.items():
 if not b:
 continue
 if not c and not curses.tigetstr(e):
 # Most terminals don't support dim, invis, etc, so don't be
 # noisy and use ui.debug().
 ui.debug("no terminfo entry for %s\n" % e)
-del _terminfo_params[key]
+del ui._terminfoparams[key]
 if not curses.tigetstr('setaf') or not curses.tigetstr('setab'):
 # Only warn about missing terminfo entries if we explicitly asked for
 # terminfo mode.
 if mode == "terminfo":
 ui.warn(_("no terminfo entry for setab/setaf: reverting to "
   "ECMA-48 color\n"))
-_terminfo_params.clear()
+ui._terminfoparams.clear()
 
 def setup(ui):
 """configure color on a ui
@@ -232,16 +233,16 @@ def _modesetup(ui):
 ui.warn(_('warning: failed to set color mode to %s\n') % mode)
 
 if realmode == 'win32':
-_terminfo_params.clear()
+ui._terminfoparams.clear()
 if not w32effects:
 modewarn()
 return None
 _effects.update(w32effects)
 elif realmode == 'ansi':
-_terminfo_params.clear()
+ui._terminfoparams.clear()
 elif realmode == 'terminfo':
 _terminfosetup(ui, mode)
-if not _terminfo_params:
+if not ui._terminfoparams:
 ## FIXME Shouldn't we return None in this case too?
 modewarn()
 realmode = 'ansi'
@@ -270,9 +271,9 @@ def configstyles(ui):
 
 def valideffect(ui, effect):
 'Determine if the effect is valid or not.'
-return ((not _terminfo_params and effect in _effects)
- or (effect in _terminfo_params
- or effect[:-11] in _terminfo_params))
+return ((not ui._terminfoparams and effect in _effects)
+ or (effect in ui._terminfoparams
+ or effect[:-11] in ui._terminfoparams))
 
 def _effect_str(ui, effect):
 '''Helper function for render_effects().'''
@@ -282,7 +283,7 @@ def _effect_str(ui, effect):
 bg = True
 effect = effect[:-11]
 try:
-attr, val, termcode = _terminfo_params[effect]
+attr, val, termcode = ui._terminfoparams[effect]
 except KeyError:
 return ''
 if attr:
@@ -299,7 +300,7 @@ def _render_effects(ui, text, effects):
 'Wrap text in commands to turn on each effect.'
 if not text:
 return text
-if _terminfo_params:
+

[PATCH 3 of 8 V2] color: initialize color for the localrepo ui

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488044041 -3600
#  Sat Feb 25 18:34:01 2017 +0100
# Node ID ed4cc3fba316882cda44f80bb143ebd32dd11bb1
# Parent  8c0c36267c3db987aa9a62df618380d087599ddb
# EXP-Topic color
color: initialize color for the localrepo ui

The 'ui' object dedicated to a 'localrepo' is independent from the one available
in dispatch (and 'uisetup'). In addition, it is created from the 'baseui'
(apparently for good reason). As a result, we need to run the color setup on
it after the local repository config is read.

This was overlooked when the rest of the initialization changed but did not
had impact yet because all setup is still global. We fix it before it is too
late.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -28,6 +28,7 @@ from . import (
 bundle2,
 changegroup,
 changelog,
+color,
 context,
 dirstate,
 dirstateguard,
@@ -285,6 +286,7 @@ class localrepository(object):
 setupfunc(self.ui, self.supported)
 else:
 self.supported = self._basesupported
+color.setup(self.ui)
 
 # Add compression engines.
 for name in util.compengines:
diff --git a/tests/test-status-color.t b/tests/test-status-color.t
--- a/tests/test-status-color.t
+++ b/tests/test-status-color.t
@@ -296,6 +296,7 @@ test unknown color
   $ hg --config color.status.modified=periwinkle status
   ignoring unknown color/effect 'periwinkle' (configured in 
color.status.modified)
   ignoring unknown color/effect 'periwinkle' (configured in 
color.status.modified)
+  ignoring unknown color/effect 'periwinkle' (configured in 
color.status.modified)
   M modified
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 8 V2] color: add a 'ui.color' option to control color behavior

2017-02-28 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1488048263 -3600
#  Sat Feb 25 19:44:23 2017 +0100
# Node ID 8c0c36267c3db987aa9a62df618380d087599ddb
# Parent  50ee9136a49a79ea381e3530eed8b114c76cdf7a
# EXP-Topic color
color: add a 'ui.color' option to control color behavior

This new option control whether or not color will be used. It mirror the 
behavior
of '--color'. I usually avoid adding new option to '[ui]' as the section is
already filled with many option. However, I feel like 'color' is central enough
to deserves a spot in this '[ui]' section.

For now the option is not documented so it is still marked as experimental. Once
it get documented and official, we should be able to deprecate the color
extensions.

There is more cleanup to do before that documentation is written, but we need
this option early to made them. Having that option will allow for more cleanup
of the initialisation process and proper separation between color
configuration.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -187,10 +187,11 @@ testedwith = 'ships-with-hg-core'
 
 def extsetup(ui):
 # change default color config
+color._enabledbydefault = True
 for idx, entry in enumerate(commands.globalopts):
 if entry[1] == 'color':
-patch = ('auto', entry[3].replace(' (EXPERIMENTAL)', ''))
-new = entry[:2] + patch + entry[4:]
+patch = (entry[3].replace(' (EXPERIMENTAL)', ''),)
+new = entry[:3] + patch + entry[4:]
 commands.globalopts[idx] = new
 break
 
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -43,6 +43,9 @@ except ImportError:
 curses = None
 _terminfo_params = {}
 
+# allow the extensions to change the default
+_enabledbydefault = False
+
 # start and stop parameters for effects
 _effects = {
 'none': 0,
@@ -167,25 +170,29 @@ def _terminfosetup(ui, mode):
   "ECMA-48 color\n"))
 _terminfo_params.clear()
 
-def setup(ui, coloropts):
+def setup(ui):
 """configure color on a ui
 
-The 'coloropts' argument is the value of the '--color' command line
-argument. That function both set the colormode for the ui object and read
+That function both set the colormode for the ui object and read
 the configuration looking for custom colors and effect definitions."""
-mode = _modesetup(ui, coloropts)
+mode = _modesetup(ui)
 ui._colormode = mode
 if mode and mode != 'debug':
 configstyles(ui)
 
-def _modesetup(ui, coloropt):
+def _modesetup(ui):
 if ui.plain():
 return None
-if coloropt == 'debug':
+default = 'never'
+if _enabledbydefault:
+default = 'auto'
+# experimental config: ui.color
+config = ui.config('ui', 'color', default)
+if config == 'debug':
 return 'debug'
 
-auto = (coloropt == 'auto')
-always = not auto and util.parsebool(coloropt)
+auto = (config == 'auto')
+always = not auto and util.parsebool(config)
 if not always and not auto:
 return None
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -77,7 +77,7 @@ globalopts = [
  _('do not prompt, automatically pick the first choice for all prompts')),
 ('q', 'quiet', None, _('suppress output')),
 ('v', 'verbose', None, _('enable additional output')),
-('', 'color', 'never',
+('', 'color', '',
  # i18n: 'always', 'auto', 'never', and 'debug' are keywords
  # and should not be translated
  _("when to colorize (boolean, always, auto, never, or debug)"
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -765,8 +765,11 @@ def _dispatch(req):
 ui_.insecureconnections = True
 
 # setup color handling
+coloropt = options['color']
 for ui_ in uis:
-color.setup(ui_, options['color'])
+if coloropt:
+ui_.setconfig('ui', 'color', coloropt, '--color')
+color.setup(ui_)
 
 if options['version']:
 return commands.version_(ui)
diff --git a/tests/test-diff-color.t b/tests/test-diff-color.t
--- a/tests/test-diff-color.t
+++ b/tests/test-diff-color.t
@@ -1,10 +1,10 @@
 Setup
 
   $ cat <> $HGRCPATH
+  > [ui]
+  > color = always
   > [color]
   > mode = ansi
-  > [extensions]
-  > color =
   > EOF
   $ hg init repo
   $ cd repo
@@ -35,7 +35,7 @@ Setup
 
 default context
 
-  $ hg diff --nodates --color=always
+  $ hg diff --nodates
   \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
   \x1b[0;31;1m--- a/a\x1b[0m (esc)
   \x1b[0;32;1m+++ b/a\x1b[0m (esc)
@@ -51,7 +51,7 @@ default context
 
 --unified=2
 
-  $ hg diff --nodates -U 2  --color=always
+  $ hg diff --nodates -U 2
   \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc)
   \x1b[0;31;1m--- 

Re: [PATCH 2 of 7] color: initialize color for local peer ui

2017-02-28 Thread Pierre-Yves David



On 02/28/2017 11:24 AM, Pierre-Yves David wrote:



On 02/28/2017 07:57 AM, Martin von Zweigbergk wrote:

On Mon, Feb 27, 2017 at 6:59 AM, Pierre-Yves David
 wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1488044041 -3600
#  Sat Feb 25 18:34:01 2017 +0100
# Node ID c3224694bdae9cdb7530f952e2c767e419b7f280
# Parent  92526381242cd381375a465d5a800446916d2d7b
# EXP-Topic color
color: initialize color for local peer ui

The local peer


"local peer" or "localrepository"? The patch seems to be in "class
localrepository".


hum, good catch. Things seems clowner than I expected. It looks like we
don't use the "lui" (local ui, goes through uisetup) to create the
repository but the "baseui" (does not goes through uisetup).

Let me grab a shovel and go bad into that code.


Okay so in short "ui initialisation business is not simple". That 
description should be:


color: initialize color for the localrepo ui

The 'ui' object dedicated to a 'localrepo' is independant from the one 
available in dispatch (and 'uisetup'). In addition, it is created from 
the 'baseui' (for good reason apparently). For this reason, we need to 
run the color setup on it after the local repository config is read.


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


Re: [PATCH 2 of 7] color: initialize color for local peer ui

2017-02-28 Thread Pierre-Yves David



On 02/28/2017 07:57 AM, Martin von Zweigbergk wrote:

On Mon, Feb 27, 2017 at 6:59 AM, Pierre-Yves David
 wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1488044041 -3600
#  Sat Feb 25 18:34:01 2017 +0100
# Node ID c3224694bdae9cdb7530f952e2c767e419b7f280
# Parent  92526381242cd381375a465d5a800446916d2d7b
# EXP-Topic color
color: initialize color for local peer ui

The local peer


"local peer" or "localrepository"? The patch seems to be in "class
localrepository".


hum, good catch. Things seems clowner than I expected. It looks like we 
don't use the "lui" (local ui, goes through uisetup) to create the 
repository but the "baseui" (does not goes through uisetup).


Let me grab a shovel and go bad into that code.


is creating its own local ui and goes through full
initialization (reading config, setting up extensions, etc). We must setup the
color for this one too.

This was overlooked when the rest of the initialization changed but did not
had impact yet because all setup is still global. We fix it before it is too
late.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -28,6 +28,7 @@ from . import (
 bundle2,
 changegroup,
 changelog,
+color,
 context,
 dirstate,
 dirstateguard,
@@ -285,6 +286,7 @@ class localrepository(object):
 setupfunc(self.ui, self.supported)
 else:
 self.supported = self._basesupported
+color.setup(self.ui)

 # Add compression engines.
 for name in util.compengines:
diff --git a/tests/test-status-color.t b/tests/test-status-color.t
--- a/tests/test-status-color.t
+++ b/tests/test-status-color.t
@@ -296,6 +296,7 @@ test unknown color
   $ hg --config color.status.modified=periwinkle status
   ignoring unknown color/effect 'periwinkle' (configured in 
color.status.modified)
   ignoring unknown color/effect 'periwinkle' (configured in 
color.status.modified)
+  ignoring unknown color/effect 'periwinkle' (configured in 
color.status.modified)
   M modified
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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


Re: [PATCH 6 of 7] color: move 'styles' definition on the 'ui' object

2017-02-28 Thread Pierre-Yves David



On 02/28/2017 08:23 AM, Martin von Zweigbergk wrote:

On Mon, Feb 27, 2017 at 7:00 AM, Pierre-Yves David
 wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1478459761 -3600
#  Sun Nov 06 20:16:01 2016 +0100
# Node ID d520bd43c7b26c3017329a2f9563701e5641d62d
# Parent  8e725873d8e1bec5dbdd0c69cbfc12af54af6a6a
# EXP-Topic color
color: move 'styles' definition on the 'ui' object

Same logic as for '_terminfoparams'. The content depends on the config so it
should be specific to each 'ui instance.


Shouldn't '_styles' be renamed '_basestyles' for consistency with
'_terminfoparams'? Please fix indentation too when you do that.


Patch 7 is doing exactly that. It is in a different patch because the 
odd for external code using it is higher (eg: thg) so making the rename 
easy to bisect seemed like a good idea.




Probably send a formatting patch early in the series in V2.



diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -207,31 +207,31 @@ def debugcolor(ui, repo, **opts):
 return _debugdisplaycolor(ui)

 def _debugdisplaycolor(ui):
-oldstyle = color._styles.copy()
+oldstyle = ui._styles.copy()
 try:
-color._styles.clear()
+ui._styles.clear()
 for effect in color._effects.keys():
-color._styles[effect] = effect
+ui._styles[effect] = effect
 if ui._terminfoparams:
 for k, v in ui.configitems('color'):
 if k.startswith('color.'):
-color._styles[k] = k[6:]
+ui._styles[k] = k[6:]
 elif k.startswith('terminfo.'):
-color._styles[k] = k[9:]
+ui._styles[k] = k[9:]
 ui.write(_('available colors:\n'))
 # sort label with a '_' after the other to group '_background' entry.
-items = sorted(color._styles.items(),
+items = sorted(ui._styles.items(),
key=lambda i: ('_' in i[0], i[0], i[1]))
 for colorname, label in items:
 ui.write(('%s\n') % colorname, label=label)
 finally:
-color._styles.clear()
-color._styles.update(oldstyle)
+ui._styles.clear()
+ui._styles.update(oldstyle)

 def _debugdisplaystyle(ui):
 ui.write(_('available style:\n'))
-width = max(len(s) for s in color._styles)
-for label, effects in sorted(color._styles.items()):
+width = max(len(s) for s in ui._styles)
+for label, effects in sorted(ui._styles.items()):
 ui.write('%s' % label, label=label)
 if effects:
 # 50
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -248,6 +248,7 @@ def _modesetup(ui):
 return None

 def configstyles(ui):
+ui._styles.update(_styles)
 for status, cfgeffects in ui.configitems('color'):
 if '.' not in status or status.startswith(('color.', 'terminfo.')):
 continue
@@ -261,7 +262,7 @@ def configstyles(ui):
 ui.warn(_("ignoring unknown color/effect %r "
   "(configured in color.%s)\n")
 % (e, status))
-_styles[status] = ' '.join(good)
+ui._styles[status] = ' '.join(good)

 def valideffect(ui, effect):
 'Determine if the effect is valid or not.'
@@ -315,7 +316,7 @@ def colorlabel(ui, msg, label):
 elif ui._colormode is not None:
 effects = []
 for l in label.split():
-s = _styles.get(l, '')
+s = ui._styles.get(l, '')
 if s:
 effects.append(s)
 elif valideffect(ui, l):
@@ -437,7 +438,7 @@ if pycompat.osname == 'nt':

 # determine console attributes based on labels
 for l in label.split():
-style = _styles.get(l, '')
+style = ui._styles.get(l, '')
 for effect in style.split():
 try:
 attr = mapcolor(w32effects[effect], attr)
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -158,6 +158,7 @@ class ui(object):
 # color mode: see mercurial/color.py for possible value
 self._colormode = None
 self._terminfoparams = {}
+self._styles = {}

 if src:
 self.fout = src.fout
@@ -176,6 +177,7 @@ class ui(object):
 self.insecureconnections = src.insecureconnections
 self._colormode = src._colormode
 self._terminfoparams = src._terminfoparams.copy()
+self._styles = src._styles.copy()

 self.fixconfig()

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


--
Pierre-Yves David
___
Mercurial-devel 

Re: [PATCH 09 of 11 V5] update: accept --merge to allow merging across topo branches (issue5125)

2017-02-28 Thread Denis Laxalde

Martin von Zweigbergk via Mercurial-devel a écrit :

# HG changeset patch
# User Martin von Zweigbergk 
# Date 1487019517 28800
#  Mon Feb 13 12:58:37 2017 -0800
# Node ID d23e5a40f9c4c8d3459255c6c2cb633452b914d8
# Parent  b99e3df11bb16c8c1118f2bf29ea0d0816591259
update: accept --merge to allow merging across topo branches (issue5125)

diff -r b99e3df11bb1 -r d23e5a40f9c4 mercurial/commands.py
--- a/mercurial/commands.py Mon Feb 27 15:09:19 2017 -0800
+++ b/mercurial/commands.py Mon Feb 13 12:58:37 2017 -0800
@@ -5279,12 +5279,13 @@
 @command('^update|up|checkout|co',
 [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
 ('c', 'check', None, _('require clean working directory')),
+('m', 'merge', None, _('merge local changes')),


It's not obvious to me what "local changes" means, perhaps "uncommitted
changes" would be better (more consistent with the docstring also).


 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
 ('r', 'rev', '', _('revision'), _('REV'))
  ] + mergetoolopts,
-_('[-C|-c] [-d DATE] [[-r] REV]'))
+_('[-C|-c|-m] [-d DATE] [[-r] REV]'))
 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
-   tool=None):
+   merge=None, tool=None):
 """update working directory (or switch revisions)

 Update the repository's working directory to the specified
@@ -5303,8 +5304,8 @@

 .. container:: verbose

-  The -C/--clean and -c/--check options control what happens if the
-  working directory contains uncommitted changes.
+  The -C/--clean, -c/--check, and -m/--merge options control what
+  happens if the working directory contains uncommitted changes.
   At most of one of them can be specified.

   1. If no option is specified, and if
@@ -5316,10 +5317,14 @@
  branch), the update is aborted and the uncommitted changes
  are preserved.

-  2. With the -c/--check option, the update is aborted and the
+  2. With the -m/--merge option, the update is allowed even if the
+ requested changeset is not an ancestor or descendant of
+ the working directory's parent.
+
+  3. With the -c/--check option, the update is aborted and the
  uncommitted changes are preserved.

-  3. With the -C/--clean option, uncommitted changes are discarded and
+  4. With the -C/--clean option, uncommitted changes are discarded and
  the working directory is updated to the requested changeset.

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