[PATCH STABLE V3] convert: avoid wrong lfconvert defaults by moving configitems to core

2017-11-28 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1511929208 18000
#  Tue Nov 28 23:20:08 2017 -0500
# Branch stable
# Node ID 17c4806300527a9b637e0d37c0d080680b5b2a7e
# Parent  96dcc78468e3adc8170500ec351c6524f759f132
convert: avoid wrong lfconvert defaults by moving configitems to core

The `hg lfconvert --to-normal` command uses the convert extension internally to
work its magic, but that produced devel-warn messages if the convert extension
wasn't loaded by the user.  The test in fcd2f9b06629 (modified here) wasn't
showing the warnings because the convert extension was loaded via $HGRCPATH.
Most of the config options default to None/False, but 'hg.usebranchnames' and
'hg.tagsbranch' are supposed to default to True and 'default' respectively.

The first iteration of this was to ui.setconfig() inside lfconvert, to force the
convert extension to load.  But there really is no precedent for doing this, and
check-config complained that 'extensions.convert' isn't documented.  Yuya
suggested this alternative.

This partially backs out 0d5a1175d0f9.

diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -28,103 +28,6 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
-configtable = {}
-configitem = registrar.configitem(configtable)
-
-configitem('convert', 'cvsps.cache',
-default=True,
-)
-configitem('convert', 'cvsps.fuzz',
-default=60,
-)
-configitem('convert', 'cvsps.logencoding',
-default=None,
-)
-configitem('convert', 'cvsps.mergefrom',
-default=None,
-)
-configitem('convert', 'cvsps.mergeto',
-default=None,
-)
-configitem('convert', 'git.committeractions',
-default=lambda: ['messagedifferent'],
-)
-configitem('convert', 'git.extrakeys',
-default=list,
-)
-configitem('convert', 'git.findcopiesharder',
-default=False,
-)
-configitem('convert', 'git.remoteprefix',
-default='remote',
-)
-configitem('convert', 'git.renamelimit',
-default=400,
-)
-configitem('convert', 'git.saverev',
-default=True,
-)
-configitem('convert', 'git.similarity',
-default=50,
-)
-configitem('convert', 'git.skipsubmodules',
-default=False,
-)
-configitem('convert', 'hg.clonebranches',
-default=False,
-)
-configitem('convert', 'hg.ignoreerrors',
-default=False,
-)
-configitem('convert', 'hg.revs',
-default=None,
-)
-configitem('convert', 'hg.saverev',
-default=False,
-)
-configitem('convert', 'hg.sourcename',
-default=None,
-)
-configitem('convert', 'hg.startrev',
-default=None,
-)
-configitem('convert', 'hg.tagsbranch',
-default='default',
-)
-configitem('convert', 'hg.usebranchnames',
-default=True,
-)
-configitem('convert', 'ignoreancestorcheck',
-default=False,
-)
-configitem('convert', 'localtimezone',
-default=False,
-)
-configitem('convert', 'p4.encoding',
-default=lambda: convcmd.orig_encoding,
-)
-configitem('convert', 'p4.startrev',
-default=0,
-)
-configitem('convert', 'skiptags',
-default=False,
-)
-configitem('convert', 'svn.debugsvnlog',
-default=True,
-)
-configitem('convert', 'svn.trunk',
-default=None,
-)
-configitem('convert', 'svn.tags',
-default=None,
-)
-configitem('convert', 'svn.branches',
-default=None,
-)
-configitem('convert', 'svn.startrev',
-default=0,
-)
-
 # Commands definition was moved elsewhere to ease demandload job.
 
 @command('convert',
diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
--- a/hgext/convert/p4.py
+++ b/hgext/convert/p4.py
@@ -44,6 +44,9 @@
 
 class p4_source(common.converter_source):
 def __init__(self, ui, path, revs=None):
+# avoid import cycle
+from . import convcmd
+
 super(p4_source, self).__init__(ui, path, revs=revs)
 
 if "/" in path and not path.startswith('//'):
@@ -53,7 +56,8 @@
 common.checktool('p4', abort=False)
 
 self.revmap = {}
-self.encoding = self.ui.config('convert', 'p4.encoding')
+self.encoding = self.ui.config('convert', 'p4.encoding',
+   convcmd.orig_encoding)
 self.re_type = re.compile(
 "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
 "(\+\w+)?$")
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -208,6 +208,99 @@
 default=None,
 generic=True,
 )
+coreconfigitem('convert', 'cvsps.cache',
+default=True,
+)
+coreconfigitem('convert', 'cvsps.fuzz',
+default=60,
+)
+coreconfigitem('convert', 'cvsps.logencoding',
+default=None,
+)
+coreconfigitem('convert', 'cvsps.mergefrom',
+default=None,
+)
+coreconfigitem('convert', 'cvsps.mergeto',
+default=None,
+)
+coreconfigitem('convert', 'git.committeractions',
+default=lambda: ['messagedifferent'],
+)
+coreconfigitem('convert', 'git.extrakeys',
+default=list,
+)
+coreconfigitem('convert', 

mercurial@35035: 12 new changesets (12 on stable)

2017-11-28 Thread Mercurial Commits
12 new changesets (12 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/3f909147a2c3
changeset:   35024:3f909147a2c3
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 04 18:54:57 2017 +0900
summary: tests: demonstrate that .hgsubstate isn't updated on amend

https://www.mercurial-scm.org/repo/hg/rev/5c6b96b832c2
changeset:   35025:5c6b96b832c2
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 04 19:21:39 2017 +0900
summary: subrepo: extract preprocess of repo.commit() to free function

https://www.mercurial-scm.org/repo/hg/rev/691524f0bbf6
changeset:   35026:691524f0bbf6
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 04 20:07:40 2017 +0900
summary: amend: update .hgsubstate before committing a memctx (issue5677)

https://www.mercurial-scm.org/repo/hg/rev/7384250eabd9
changeset:   35027:7384250eabd9
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 11 12:09:19 2017 +0900
summary: dispatch: do not drop unpaired argument at _earlygetopt()

https://www.mercurial-scm.org/repo/hg/rev/7f8f9f0369ca
changeset:   35028:7f8f9f0369ca
branch:  stable
user:Yuya Nishihara 
date:Fri Nov 10 22:22:39 2017 +0900
summary: dispatch: extract stub function to peek boolean command option

https://www.mercurial-scm.org/repo/hg/rev/e16f68c4abe3
changeset:   35029:e16f68c4abe3
branch:  stable
user:Yuya Nishihara 
date:Fri Nov 10 22:27:26 2017 +0900
summary: dispatch: stop parsing of early boolean option at "--"

https://www.mercurial-scm.org/repo/hg/rev/d9aba3730d30
changeset:   35030:d9aba3730d30
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 11 14:02:41 2017 +0900
summary: dispatch: abort if early boolean options can't be parsed

https://www.mercurial-scm.org/repo/hg/rev/e273b6671827
changeset:   35031:e273b6671827
branch:  stable
user:Yuya Nishihara 
date:Tue Nov 14 00:25:59 2017 +0900
summary: dispatch: fix early parsing of short option with value like -R=foo

https://www.mercurial-scm.org/repo/hg/rev/cd235d6f851b
changeset:   35032:cd235d6f851b
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 11 16:46:41 2017 +0900
summary: dispatch: add option to not strip command args parsed by 
_earlygetopt()

https://www.mercurial-scm.org/repo/hg/rev/d3d35a55e03b
changeset:   35033:d3d35a55e03b
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 11 17:55:15 2017 +0900
summary: dispatch: convert non-list option parsed by _earlygetopt() to 
string

https://www.mercurial-scm.org/repo/hg/rev/02845f7441af
changeset:   35034:02845f7441af
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 11 12:40:13 2017 +0900
summary: dispatch: verify result of early command parsing

https://www.mercurial-scm.org/repo/hg/rev/96dcc78468e3
changeset:   35035:96dcc78468e3
branch:  stable
tag: tip
user:Boris Feld 
date:Fri Nov 24 21:51:41 2017 -0500
summary: tr-summary: keep a weakref to the unfiltered repository

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


mercurial@35023: 3 new changesets (3 on stable)

2017-11-28 Thread Mercurial Commits
3 new changesets (3 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/b69c700b6de6
changeset:   35021:b69c700b6de6
branch:  stable
parent:  35009:99ab7bc944d2
user:Yuya Nishihara 
date:Sat Nov 04 23:40:26 2017 +0900
summary: tests: add more complete test for status changes on amend

https://www.mercurial-scm.org/repo/hg/rev/0ba3b928f9a9
changeset:   35022:0ba3b928f9a9
branch:  stable
user:Yuya Nishihara 
date:Sat Nov 04 23:45:59 2017 +0900
summary: amend: do not take untracked files as modified or clean (issue5732)

https://www.mercurial-scm.org/repo/hg/rev/5f40efa472db
changeset:   35023:5f40efa472db
branch:  stable
tag: tip
user:Yuya Nishihara 
date:Sat Nov 04 23:48:19 2017 +0900
summary: amend: do not drop missing files (issue5732)

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


D1286: repoview: consider visibility exceptions in filterrevs()

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3957.
pulkit retitled this revision from "repoview: consider visibility exceptions in 
computehidden()" to "repoview: consider visibility exceptions in filterrevs()".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1286?vs=3785=3957

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

AFFECTED FILES
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -148,7 +148,7 @@
 if filtername not in repo.filteredrevcache:
 func = filtertable[filtername]
 repo.filteredrevcache[filtername] = func(repo.unfiltered())
-return repo.filteredrevcache[filtername]
+return repo.filteredrevcache[filtername] - repo.getvisibilityexceptions()
 
 class repoview(object):
 """Provide a read/write view of a repo through a filtered changelog



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


D1287: repoview: add two new filternames to be used for accessing hidden commits

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3958.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1287?vs=3787=3958

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

AFFECTED FILES
  mercurial/branchmap.py
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -139,6 +139,8 @@
 # Otherwise your filter will have to recompute all its branches cache
 # from scratch (very slow).
 filtertable = {'visible': computehidden,
+   'visible-warnhidden': computehidden,
+   'visible-allowhidden': computehidden,
'served': computeunserved,
'immutable':  computemutable,
'base':  computeimpactable}
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -86,7 +86,9 @@
 subsettable = {None: 'visible',
'visible': 'served',
'served': 'immutable',
-   'immutable': 'base'}
+   'immutable': 'base',
+   'visible-warnhidden': 'visible',
+   'visible-allowhidden': 'visible'}
 
 def updatecache(repo):
 cl = repo.changelog



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


D1285: repoview: add a new attribute _visibilityexceptions and related API

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3956.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1285?vs=3784=3956

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

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -190,6 +190,8 @@
 object.__setattr__(self, r'filtername', filtername)
 object.__setattr__(self, r'_clcachekey', None)
 object.__setattr__(self, r'_clcache', None)
+# hidden hashes which should be visible
+self._visibilityexceptions = set()
 
 # not a propertycache on purpose we shall implement a proper cache later
 @property
@@ -231,6 +233,14 @@
 return self
 return self.unfiltered().filtered(name)
 
+def addvisibilityexceptions(self, revs):
+"""adds hidden revs which should be visible to set of exceptions"""
+self._visibilityexceptions.update(revs)
+
+def getvisibilityexceptions(self):
+"""returns the set of hidden revs which should be visible"""
+return self._visibilityexceptions
+
 # everything access are forwarded to the proxied repo
 def __getattr__(self, attr):
 return getattr(self._unfilteredrepo, attr)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -567,6 +567,14 @@
 def close(self):
 self._writecaches()
 
+def addvisibilityexceptions(self, exceptions):
+# should be called on a filtered repository
+pass
+
+def getvisibilityexceptions(self):
+# should be called on a filtered repository
+return set()
+
 def _loadextensions(self):
 extensions.loadall(self.ui)
 



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


D1538: py3: add b'' to regular expressions which are raw strings

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3955.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1538?vs=3951=3955

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

AFFECTED FILES
  hgext/mq.py
  mercurial/dispatch.py
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2667,7 +2667,7 @@
 else:
 prefix_char = prefix
 mapping[prefix_char] = prefix_char
-r = remod.compile(r'%s(%s)' % (prefix, patterns))
+r = remod.compile(br'%s(%s)' % (prefix, patterns))
 return r.sub(lambda x: fn(mapping[x.group()[1:]]), s)
 
 def getport(port):
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -404,7 +404,7 @@
 # tokenize each argument into exactly one word.
 replacemap['"$@"'] = ' '.join(util.shellquote(arg) for arg in args)
 # escape '\$' for regex
-regex = '|'.join(replacemap.keys()).replace('$', r'\$')
+regex = '|'.join(replacemap.keys()).replace('$', br'\$')
 r = re.compile(regex)
 return r.sub(lambda x: replacemap[x.group()], cmd)
 
@@ -449,7 +449,7 @@
  "of %i variable in alias '%s' definition."
  % (int(m.groups()[0]), self.name))
 return ''
-cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:])
+cmd = re.sub(br'\$(\d+|\$)', _checkvar, self.definition[1:])
 cmd = aliasinterpolate(self.name, args, cmd)
 return ui.system(cmd, environ=env,
  blockedtag='alias_%s' % self.name)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -565,7 +565,7 @@
 return index
 return None
 
-guard_re = re.compile(r'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)')
+guard_re = re.compile(br'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)')
 
 def parseseries(self):
 self.series = []



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


D1540: py3: remove test-terse-status.t from python3 whitelist as it was renamed

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renamed file exists in the whitelist.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -68,7 +68,6 @@
 test-run-tests.py
 test-show-stack.t
 test-status-terse.t
-test-terse-status.t
 test-unified-test.t
 test-update-issue1456.t
 test-update-reverse.t



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


D1286: repoview: consider visibility exceptions in computehidden()

2017-11-28 Thread quark (Jun Wu)
quark requested changes to this revision.
quark added a comment.
This revision now requires changes to proceed.


  This does not work for other repoviews. Why not do it at `filterrevs`?

INLINE COMMENTS

> repoview.py:151
>  func = filtertable[filtername]
>  repo.filteredrevcache[filtername] = func(repo.unfiltered())
>  return repo.filteredrevcache[filtername]

Here, append `- repo.getvisibilityexceptions()`.

REPOSITORY
  rHG Mercurial

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

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


D1285: repoview: add a new attribute _visibilityexceptions and related API

2017-11-28 Thread quark (Jun Wu)
quark accepted this revision.
quark added inline comments.

INLINE COMMENTS

> repoview.py:236-238
> +def addvisibilityexceptions(self, exceptions):
> +"""adds hidden revs which should be visible to set of exceptions"""
> +self._visibilityexceptions.update(exceptions)

Maybe rename `exceptions` to `revs` so people can know its type from the 
signature.

REPOSITORY
  rHG Mercurial

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

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


D1538: py3: add b'' to regular expressions which are raw strings

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/mq.py
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2667,7 +2667,7 @@
 else:
 prefix_char = prefix
 mapping[prefix_char] = prefix_char
-r = remod.compile(r'%s(%s)' % (prefix, patterns))
+r = remod.compile(br'%s(%s)' % (prefix, patterns))
 return r.sub(lambda x: fn(mapping[x.group()[1:]]), s)
 
 def getport(port):
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -565,7 +565,7 @@
 return index
 return None
 
-guard_re = re.compile(r'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)')
+guard_re = re.compile(br'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)')
 
 def parseseries(self):
 self.series = []



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


D1537: py3: use '%d' for integers rather than '%s'

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  obsolete._readmarkers() returns an integer version number.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -296,7 +296,7 @@
 msg %= indent_string, exc.version, len(data)
 ui.write(msg)
 else:
-msg = "%sversion: %s (%d bytes)\n"
+msg = "%sversion: %d (%d bytes)\n"
 msg %= indent_string, version, len(data)
 ui.write(msg)
 fm = ui.formatter('debugobsolete', opts)



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


D1536: py3: fix args handling for obsfate template

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/templatekw.py

CHANGE DETAILS

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -608,6 +608,7 @@
 # the verbosity templatekw available.
 succsandmarkers = showsuccsandmarkers(**args)
 
+args = pycompat.byteskwargs(args)
 ui = args['ui']
 
 values = []



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


D1074: branch: add a --rev flag to change branch name of given revisions

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D1074#23972, @lothiraldan wrote:
  
  > Looking good, should we allow changing the branch if any changeset is 
unstable or obsolete?
  
  
  For unstable `yes`, for obsolete `no`. Will add a check and test for obsolete 
case.

INLINE COMMENTS

> lothiraldan wrote in cmdutil.py:774
> For safety, I would add a check that p1 and p2 are not obsolete here.

A user may want to change branch of an unstable changeset which I think is 
okay. I am not sure why you want that check?

REPOSITORY
  rHG Mercurial

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

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


D1534: logtoprocess: add an option to parse script command

2017-11-28 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  With `shell=False`, the logtoprocess script will not be parsed by a shell and
  we won't be able to pass arguments in logtoprocess configuration. Add a new
  option `logtoprocess.parsescript` that calls `shlex.split` on the script so we
  can pass arguments. As `shlex.split` is only designed for POSIX system, this
  option have no impact on Windows.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/logtoprocess.py
  mercurial/configitems.py

CHANGE DETAILS

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -566,6 +566,9 @@
 coreconfigitem('logtoprocess', 'develwarn',
 default=None,
 )
+coreconfigitem('logtoprocess', 'parsescript',
+default=False,
+)
 coreconfigitem('logtoprocess', 'shell',
 default=True,
 )
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -36,6 +36,7 @@
 
 import itertools
 import os
+import shlex
 import subprocess
 import sys
 
@@ -58,14 +59,14 @@
 DETACHED_PROCESS = 0x0008
 _creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP
 
-def runshellcommand(script, env, shell=True):
+def runshellcommand(script, env, shell=True, _=False):
 # we can't use close_fds *and* redirect stdin. I'm not sure that we
 # need to because the detached process has no console connection.
 subprocess.Popen(
 script, shell=shell, env=env, close_fds=True,
 creationflags=_creationflags)
 else:
-def runshellcommand(script, env, shell=True):
+def runshellcommand(script, env, shell=True, parse_script=False):
 # double-fork to completely detach from the parent process
 # based on http://code.activestate.com/recipes/278731
 pid = os.fork()
@@ -78,6 +79,11 @@
 newsession = {'preexec_fn': os.setsid}
 else:
 newsession = {'start_new_session': True}
+
+# Try to split the arguments when shell is False
+if not shell and parse_script:
+script = shlex.split(script)
+
 try:
 # connect stdin to devnull to make sure the subprocess can't
 # muck up that stream for mercurial.
@@ -125,7 +131,8 @@
msgpairs, optpairs),
EVENT=event, HGPID=str(os.getpid()))
 shell = self.configbool('logtoprocess', 'shell')
-runshellcommand(script, env, shell)
+parsescript = self.configbool('logtoprocess', 'parsescript')
+runshellcommand(script, env, shell, parsescript)
 return super(logtoprocessui, self).log(event, *msg, **opts)
 
 # Replace the class for this instance and all clones created from it:



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


D1426: logtoprocess: add the possibility to not start a shell

2017-11-28 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 3914.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1426?vs=3528=3914

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

AFFECTED FILES
  hgext/logtoprocess.py
  mercurial/configitems.py

CHANGE DETAILS

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -566,6 +566,9 @@
 coreconfigitem('logtoprocess', 'develwarn',
 default=None,
 )
+coreconfigitem('logtoprocess', 'shell',
+default=True,
+)
 coreconfigitem('logtoprocess', 'uiblocked',
 default=None,
 )
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -58,14 +58,14 @@
 DETACHED_PROCESS = 0x0008
 _creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP
 
-def runshellcommand(script, env):
+def runshellcommand(script, env, shell=True):
 # we can't use close_fds *and* redirect stdin. I'm not sure that we
 # need to because the detached process has no console connection.
 subprocess.Popen(
-script, shell=True, env=env, close_fds=True,
+script, shell=shell, env=env, close_fds=True,
 creationflags=_creationflags)
 else:
-def runshellcommand(script, env):
+def runshellcommand(script, env, shell=True):
 # double-fork to completely detach from the parent process
 # based on http://code.activestate.com/recipes/278731
 pid = os.fork()
@@ -82,7 +82,7 @@
 # connect stdin to devnull to make sure the subprocess can't
 # muck up that stream for mercurial.
 subprocess.Popen(
-script, shell=True, stdin=open(os.devnull, 'r'), env=env,
+script, shell=shell, stdin=open(os.devnull, 'r'), env=env,
 close_fds=True, **newsession)
 finally:
 # mission accomplished, this child needs to exit and not
@@ -124,7 +124,8 @@
 env = dict(itertools.chain(encoding.environ.items(),
msgpairs, optpairs),
EVENT=event, HGPID=str(os.getpid()))
-runshellcommand(script, env)
+shell = self.configbool('logtoprocess', 'shell')
+runshellcommand(script, env, shell)
 return super(logtoprocessui, self).log(event, *msg, **opts)
 
 # Replace the class for this instance and all clones created from it:



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


D1427: logtoprocess: add a test to show pager and ltp bad interaction

2017-11-28 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 3916.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1427?vs=3529=3916

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

AFFECTED FILES
  tests/test-logtoprocess.t

CHANGE DETAILS

diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -27,59 +27,99 @@
   > logtoprocess=
   > foocommand=$TESTTMP/foocommand.py
   > [logtoprocess]
-  > command=echo 'logtoprocess command output:';
+  > command=(echo 'logtoprocess command output:';
   > echo "\$EVENT";
   > echo "\$MSG1";
-  > echo "\$MSG2"
-  > commandfinish=echo 'logtoprocess commandfinish output:';
+  > echo "\$MSG2") > $TESTTMP/command.log
+  > commandfinish=(echo 'logtoprocess commandfinish output:';
   > echo "\$EVENT";
   > echo "\$MSG1";
   > echo "\$MSG2";
-  > echo "\$MSG3"
-  > foo=echo 'logtoprocess foo output:';
+  > echo "\$MSG3") > $TESTTMP/commandfinish.log
+  > foo=(echo 'logtoprocess foo output:';
   > echo "\$EVENT";
   > echo "\$MSG1";
-  > echo "\$OPT_BAR"
+  > echo "\$OPT_BAR") > $TESTTMP/foo.log
   > EOF
 
 Running a command triggers both a ui.log('command') and a
 ui.log('commandfinish') call. The foo command also uses ui.log.
 
 Use sort to avoid ordering issues between the various processes we spawn:
-  $ hg foo | cat | sort
-  
-  
+  $ hg foo
+  $ cat $TESTTMP/command.log | sort
   
-   (chg !)
+  command
+  foo (no-chg !)
+  foo (no-chg !)
+  logtoprocess command output:
+  serve --cmdserver chgunix * (glob) (chg !)
+  serve --cmdserver chgunix * (glob) (chg !)
+
+#if no-chg
+  $ cat $TESTTMP/commandfinish.log | sort
+  
   0
-  a message: spam
-  command
-  command (chg !)
   commandfinish
   foo
-  foo
-  foo
+  foo exited 0 after * seconds (glob)
+  logtoprocess commandfinish output:
+  $ cat $TESTTMP/foo.log | sort
+  
+  a message: spam
   foo
-  foo exited 0 after * seconds (glob)
-  logtoprocess command output:
-  logtoprocess command output: (chg !)
-  logtoprocess commandfinish output:
   logtoprocess foo output:
-  serve --cmdserver chgunix * (glob) (chg !)
-  serve --cmdserver chgunix * (glob) (chg !)
   spam
+#endif
 
 Confirm that logging blocked time catches stdio properly:
   $ cp $HGRCPATH.bak $HGRCPATH
   $ cat >> $HGRCPATH << EOF
   > [extensions]
   > logtoprocess=
   > pager=
   > [logtoprocess]
-  > uiblocked=echo "\$EVENT stdio \$OPT_STDIO_BLOCKED ms command 
\$OPT_COMMAND_DURATION ms"
+  > uiblocked=echo "\$EVENT stdio \$OPT_STDIO_BLOCKED ms command 
\$OPT_COMMAND_DURATION ms" > $TESTTMP/uiblocked.log
   > [ui]
   > logblockedtimes=True
   > EOF
 
-  $ hg log | cat
+  $ hg log
+  $ sleep 0.2
+  $ cat $TESTTMP/uiblocked.log
   uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)
+
+Try to confirm that pager wait on logtoprocess:
+
+Add a script that wait on a file to appears for 5 seconds, if it sees it touch
+another file or die after 5 seconds. If the scripts is awaited by hg, the
+script will die after the timeout before we could touch the file and the
+resulting file will not exists. If not, we will touch the file and see it.
+
+  $ cat > $TESTTMP/wait-output.sh << EOF
+  > #!/bin/sh
+  > for i in \`$TESTDIR/seq.py 50\`; do
+  >   if [ -f "$TESTTMP/wait-for-touched" ];
+  >   then
+  > touch "$TESTTMP/touched";
+  > break;
+  >   else
+  > sleep 0.1;
+  >   fi
+  > done
+  > EOF
+  $ chmod +x $TESTTMP/wait-output.sh
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > logtoprocess=
+  > pager=
+  > [logtoprocess]
+  > commandfinish=$TESTTMP/wait-output.sh
+  > EOF
+  $ hg version -q --pager=always
+  Mercurial Distributed SCM (version *) (glob)
+  $ touch $TESTTMP/wait-for-touched
+  $ sleep 0.2
+  $ test -f $TESTTMP/touched && echo "SUCCESS Pager is waiting on ltp" || echo 
"FAIL Pager is waiting on ltp"
+  FAIL Pager is waiting on ltp



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


D1428: logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager

2017-11-28 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 3917.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1428?vs=3589=3917

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

AFFECTED FILES
  hgext/logtoprocess.py
  tests/test-logtoprocess.t

CHANGE DETAILS

diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -122,4 +122,4 @@
   $ touch $TESTTMP/wait-for-touched
   $ sleep 0.2
   $ test -f $TESTTMP/touched && echo "SUCCESS Pager is waiting on ltp" || echo 
"FAIL Pager is waiting on ltp"
-  FAIL Pager is waiting on ltp
+  SUCCESS Pager is waiting on ltp
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -85,11 +85,16 @@
 script = shlex.split(script)
 
 try:
-# connect stdin to devnull to make sure the subprocess can't
-# muck up that stream for mercurial.
+# connect std* to devnull to make sure the subprocess can't
+# muck up these stream for mercurial.
+# Connect all the streams to be more close to Windows behavior
+# and pager will wait for scripts to end if we don't do that
+nullrfd = open(os.devnull, 'r')
+nullwfd = open(os.devnull, 'w')
 subprocess.Popen(
-script, shell=shell, stdin=open(os.devnull, 'r'), env=env,
-close_fds=True, **newsession)
+script, shell=shell, stdin=nullrfd,
+stdout=nullwfd, stderr=nullwfd,
+env=env, close_fds=True, **newsession)
 finally:
 # mission accomplished, this child needs to exit and not
 # continue the hg process here.



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


[PATCH] debuginstall: add a line about re2 availability

2017-11-28 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1511826516 18000
#  Mon Nov 27 18:48:36 2017 -0500
# Node ID dfade8ee7beafb4c6c8eecfdf54b301dba0ecaf1
# Parent  8287df8b7be545fdafa22b771012ac65f6264d12
# EXP-Topic debugpyre2
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
dfade8ee7bea
debuginstall: add a line about re2 availability

Using re2 engine can massively speed up regexp. We make it simpler to check if
it is available in a given install.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1120,6 +1120,10 @@ def debuginstall(ui, **opts):
  fm.formatlist([e.name() for e in wirecompengines
 if e.wireprotosupport()],
name='compengine', fmt='%s', sep=', '))
+re2 = 'missing'
+if util._re2:
+re2 = 'available'
+fm.write('regextre2', _('checking "re2" regexp engine (%s)\n'), re2)
 
 # templates
 p = templater.templatepaths()
diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -14,6 +14,7 @@ hg debuginstall
   checking registered compression engines (*zlib*) (glob)
   checking available compression engines (*zlib*) (glob)
   checking available compression engines for wire protocol (*zlib*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
   checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -44,6 +45,7 @@ hg debuginstall JSON
 "pythonlib": "*", (glob)
 "pythonsecurity": [*], (glob)
 "pythonver": "*.*.*", (glob)
+"regextre2": "(available|missing)", (re)
 "templatedirs": "*mercurial?templates", (glob)
 "username": "test",
 "usernameerror": null,
@@ -67,6 +69,7 @@ hg debuginstall with no username
   checking registered compression engines (*zlib*) (glob)
   checking available compression engines (*zlib*) (glob)
   checking available compression engines for wire protocol (*zlib*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
   checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -110,6 +113,7 @@ path variables are expanded (~ is the sa
   checking registered compression engines (*zlib*) (glob)
   checking available compression engines (*zlib*) (glob)
   checking available compression engines for wire protocol (*zlib*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates (*mercurial?templates)... (glob)
   checking default template (*mercurial?templates?map-cmdline.default) (glob)
   checking commit editor... (* -c "import sys; sys.exit(0)") (glob)
@@ -217,6 +221,7 @@ since it's bin on most platforms but Scr
   checking registered compression engines (*) (glob)
   checking available compression engines (*) (glob)
   checking available compression engines for wire protocol (*) (glob)
+  checking "re2" regexp engine \((available|missing)\) (re)
   checking templates 
($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob)
   checking default template 
($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) 
(glob)
   checking commit editor... (*) (glob)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] fsmonitor: issue debug messages when we fall back to core status

2017-11-28 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1511884854 18000
#  Tue Nov 28 11:00:54 2017 -0500
# Node ID 1c6858cefe1701c27b459c6b5647b7b023f229b5
# Parent  8287df8b7be545fdafa22b771012ac65f6264d12
# EXP-Topic fsmonitor-debug
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
1c6858cefe17
fsmonitor: issue debug messages when we fall back to core status

Having more information about when and why fsmonitor bails out help when
looking into status performance.

diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -224,16 +224,21 @@ def overridewalk(orig, self, match, subr
 Whenever full is False, ignored is False, and the Watchman client is
 available, use Watchman combined with saved state to possibly return only a
 subset of files.'''
-def bail():
+def bail(reason):
+self._ui.debug('fsmonitor: fallback to core status, %s\n' % reason)
 return orig(match, subrepos, unknown, ignored, full=True)
 
-if full or ignored or not self._watchmanclient.available():
-return bail()
+if full:
+return bail('full rewalk requested')
+if ignored:
+return bail('listing ignored files')
+if not self._watchmanclient.available():
+return bail('client unavailable')
 state = self._fsmonitorstate
 clock, ignorehash, notefiles = state.get()
 if not clock:
 if state.walk_on_invalidate:
-return bail()
+return bail('no clock')
 # Initial NULL clock value, see
 # https://facebook.github.io/watchman/docs/clockspec.html
 clock = 'c:0:0'
@@ -263,7 +268,7 @@ def overridewalk(orig, self, match, subr
 if _hashignore(ignore) != ignorehash and clock != 'c:0:0':
 # ignore list changed -- can't rely on Watchman state any more
 if state.walk_on_invalidate:
-return bail()
+return bail('ignore rules changed')
 notefiles = []
 clock = 'c:0:0'
 else:
@@ -338,7 +343,7 @@ def overridewalk(orig, self, match, subr
 except Exception as ex:
 _handleunavailable(self._ui, state, ex)
 self._watchmanclient.clearconnection()
-return bail()
+return bail('exception during run')
 else:
 # We need to propagate the last observed clock up so that we
 # can use it for our next query
@@ -346,7 +351,7 @@ def overridewalk(orig, self, match, subr
 if result['is_fresh_instance']:
 if state.walk_on_invalidate:
 state.invalidate()
-return bail()
+return bail('fresh instance')
 fresh_instance = True
 # Ignore any prior noteable files from the state info
 notefiles = []
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1427: logtoprocess: add a test to show pager and ltp bad interaction

2017-11-28 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  Could someone with chg experience give me a hand or a pointer why this test 
might be flaky with chg?

REPOSITORY
  rHG Mercurial

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

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


D1426: logtoprocess: add the possibility to not start a shell

2017-11-28 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  >>> `shell=False` also disables envar expansion, and I guess there would
  >>>  be lots of trivial behavior changes.
  >> 
  >> I'm not sure to understand what you mean, I tried this configuration:
  >> 
  >>   [logtoprocess]
  >>   commandfinish = %HOMEPATH%/script.pl
  >> 
  >> 
  >> And `%HOMEPATH` seemed to be expanded.
  > 
  > Maybe it's resolved while looking up the executable path. I suspect
  >  `script.pl %HOMEPATH%` wouldn't work.
  
  With further testing, I can confirm that `script.pl %HOMEPATH%` is not 
working on Windows with `shell=False`. I don't know an equivalent of 
`shlex.split` for Windows, so I guess that documenting it would be enough as we 
don't force `shell=False`.
  
  I will document it.

REPOSITORY
  rHG Mercurial

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

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


D1502: rewriteutil: add utility function to check if we can create new unstable cset

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3911.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1502?vs=3899=3911

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

AFFECTED FILES
  mercurial/rewriteutil.py

CHANGE DETAILS

diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
new file mode 100644
--- /dev/null
+++ b/mercurial/rewriteutil.py
@@ -0,0 +1,25 @@
+# rewriteutil.py - utility functions for rewriting changesets
+#
+# Copyright 2017 Octobus 
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+from . import (
+obsolete,
+revset,
+)
+
+def disallowednewunstable(repo, revs):
+"""Checks whether editing the revs will create new unstable changesets and
+are we allowed to create them.
+
+To allow new unstable changesets, set the config:
+`experimental.evolution.allowunstable=True`
+"""
+allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
+if allowunstable:
+return revset.baseset()
+return repo.revs("(%ld::) - %ld", revs, revs)



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


D1503: rewriteutil: add a precheck function to check if revs can be rewritten

2017-11-28 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3912.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1503?vs=3900=3912

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

AFFECTED FILES
  mercurial/rewriteutil.py

CHANGE DETAILS

diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
--- a/mercurial/rewriteutil.py
+++ b/mercurial/rewriteutil.py
@@ -7,11 +7,39 @@
 
 from __future__ import absolute_import
 
+from .i18n import _
+
 from . import (
+error,
+node,
 obsolete,
 revset,
 )
 
+def precheck(repo, revs, action='rewrite'):
+"""check if revs can be rewritten
+action is used to control the error message.
+
+Make sure this function is called after taking the lock.
+"""
+if node.nullrev in revs:
+msg = _("cannot %s null changeset") % (action)
+hint = _("no changeset checked out")
+raise error.Abort(msg, hint=hint)
+
+publicrevs = repo.revs('%ld and public()', revs)
+if len(repo[None].parents()) > 1:
+raise error.Abort(_("cannot %s while merging") % action)
+
+if publicrevs:
+msg = _("cannot %s public changesets") % (action)
+hint = _("see 'hg help phases' for details")
+raise error.Abort(msg, hint=hint)
+
+newunstable = disallowednewunstable(repo, revs)
+if newunstable:
+raise error.Abort(_("cannot %s changeset with children") % action)
+
 def disallowednewunstable(repo, revs):
 """Checks whether editing the revs will create new unstable changesets and
 are we allowed to create them.



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


D1386: bundle2: extract logic for seeking bundle2 part into own class

2017-11-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> bundle2.py:1210
>  self.mandatorykeys = ()
> -self._payloadstream = None
>  self._readheader()

This seems unrelated. The field is still assigned in this class e.g. on line 
1311.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 1 of 2] cat: record the current behavior of wildcard matches in subrepos

2017-11-28 Thread Augie Fackler
On Sun, Nov 26, 2017 at 07:55:29PM -0500, Matt Harbison wrote:
> On Sun, 26 Nov 2017 05:26:24 -0500, Yuya Nishihara  wrote:
>
> > On Sat, 25 Nov 2017 23:37:16 -0500, Matt Harbison wrote:
> > > On Sat, 25 Nov 2017 02:35:03 -0500, Yuya Nishihara 
> > > wrote:
> > >
> > > > # HG changeset patch
> > > > # User Yuya Nishihara 
> > > > # Date 1511591374 -32400
> > > > #  Sat Nov 25 15:29:34 2017 +0900
> > > > # Node ID 38e952030f0c4746257280d47f0f94b6cb9ddb41
> > > > # Parent  8287df8b7be545fdafa22b771012ac65f6264d12
> > > > cat: record the current behavior of wildcard matches in subrepos
> > > >
> > > > It appears that Mercurial subrepo supports any match patterns.
> > > >
> > > > diff --git a/mercurial/help/subrepos.txt b/mercurial/help/subrepos.txt
> > > > --- a/mercurial/help/subrepos.txt
> > > > +++ b/mercurial/help/subrepos.txt
> > > > @@ -90,7 +90,7 @@ Interaction with Mercurial Commands
> > > >  :archive: archive does not recurse in subrepositories unless
> > > >  -S/--subrepos is specified.
> > > > -:cat: cat currently only handles exact file matches in subrepos.
> > > > +:cat: cat currently only handles exact file matches in Git subrepos.
> > >
> > > Should this be "cat currently only handles pattern matches in Mercurial
> > > subrepos"?  The test above this new inexact match test is for an
> > > exact hg
> > > match.  Git bails early on m.anypats().
> >
> > Hmm, how about this?
> >
> >   Git subrepositories only support exact file matches. Subversion
> >   subrepositories are currently ignored.
> >
> > What I wanted to say is Git support is limited.
>
> That sounds good to me, thanks.

Should I be looking for a v2 of this, or is this ready to go?

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


D1532: color: respect HGPLAINEXCEPT=color to allow colors in otherwise-plain settings

2017-11-28 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'd also like --color=always on the command-line to override HGPLAIN=1
  et al, but that's more work, and this seems like a better fix. We've
  got a fair number of programs that actually want to automate hg and
  get colored output to users, so they should set HGPLAINEXCEPT=alias
  (what we usually recommend), but this has been breaking them because
  they then lose color.
  
  .. feature::
  
The ``HGPLAINEXCEPT`` environment variable can now include ``color``
to allow automatic output colorization in otherwise automated
environments.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/color.py
  tests/test-status-color.t

CHANGE DETAILS

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
@@ -29,6 +29,22 @@
   [status.unknown|? ][status.unknown|b/2/in_b_2]
   [status.unknown|? ][status.unknown|b/in_b]
   [status.unknown|? ][status.unknown|in_root]
+HGPLAIN disables color
+  $ HGPLAIN=1 hg status --color=debug
+  ? a/1/in_a_1
+  ? a/in_a
+  ? b/1/in_b_1
+  ? b/2/in_b_2
+  ? b/in_b
+  ? in_root
+HGPLAINEXCEPT=color does not disable color
+  $ HGPLAINEXCEPT=color hg status --color=debug
+  [status.unknown|? ][status.unknown|a/1/in_a_1]
+  [status.unknown|? ][status.unknown|a/in_a]
+  [status.unknown|? ][status.unknown|b/1/in_b_1]
+  [status.unknown|? ][status.unknown|b/2/in_b_2]
+  [status.unknown|? ][status.unknown|b/in_b]
+  [status.unknown|? ][status.unknown|in_root]
 
 hg status with template
   $ hg status -T "{label('red', path)}\n" --color=debug
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -181,7 +181,7 @@
 configstyles(ui)
 
 def _modesetup(ui):
-if ui.plain():
+if ui.plain('color'):
 return None
 config = ui.config('ui', 'color')
 if config == 'debug':



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


[Bug 5749] New: --color=always should override HGPLAIN{, EXCEPT}, but it doesn't

2017-11-28 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5749

Bug ID: 5749
   Summary: --color=always should override HGPLAIN{,EXCEPT}, but
it doesn't
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Mac OS
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: duri...@gmail.com
CC: mercurial-devel@mercurial-scm.org

If the user or automation explicitly asked for color with --color=always on the
coommand line, we should probably do what they wanted.

Also, we should probably have a "color" category for HGPLAINEXCEPT.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH v5] cmdutil: add within-line color diff capacity

2017-11-28 Thread Yuya Nishihara
On Mon, 27 Nov 2017 21:38:48 +0900, matthieu.laneuvi...@octobus.net wrote:
> # HG changeset patch
> # User Matthieu Laneuville 
> # Date 1508944418 -32400
> #  Thu Oct 26 00:13:38 2017 +0900
> # Node ID 9a6865e011743fa354dc1ae27d66600e022cddad
> # Parent  32bb27dd52825236ba1b6c06fe60e140d6b5ea45
> # EXP-Topic inline-diff
> cmdutil: add within-line color diff capacity

Sorry for late review. I played with this patch and I like the feature, but
the output seems not so well, e.g. highlighted parts are too broad and too few.

A couple of comments follow:

> --- a/mercurial/cmdutil.pyTue Nov 21 00:24:09 2017 -0500
> +++ b/mercurial/cmdutil.pyThu Oct 26 00:13:38 2017 +0900
> @@ -7,6 +7,7 @@
>  
>  from __future__ import absolute_import
>  
> +import difflib
>  import errno
>  import itertools
>  import os
> @@ -1513,6 +1514,11 @@ def diffordiffstat(ui, repo, diffopts, n
>  ui.warn(_('warning: %s not inside relative root %s\n') % (
>  match.uipath(matchroot), uirelroot))
>  
> +store = {
> +'diff.inserted': [],
> +'diff.deleted': []
> +}
> +status = False

Nit: 'status = None' is preferred as it isn't a boolean type.

>  if stat:
>  diffopts = diffopts.copy(context=0)
>  width = 80
> @@ -1529,7 +1535,31 @@ def diffordiffstat(ui, repo, diffopts, n
>   changes, diffopts, prefix=prefix,
>   relroot=relroot,
>   hunksfilterfn=hunksfilterfn):
> -write(chunk, label=label)
> +
> +if not ui.configbool("experimental", "inline-color-diff"):
> +write(chunk, label=label)
> +continue
> +
> +# Each deleted/inserted chunk is followed by an EOL chunk with ''
> +# label. The 'status' flag helps us grab that second line.
> +if label in ['diff.deleted', 'diff.inserted'] or status:
> +if status:
> +store[status].append(chunk)
> +status = False
> +else:
> +store[label].append(chunk)
> +status = label
> +continue
> +
> +if store['diff.inserted'] or store['diff.deleted']:
> +for line, l in _chunkdiff(store):
> +write(line, label=l)
> +
> +store['diff.inserted'] = []
> +store['diff.deleted'] = []
> +
> +if chunk:
> +write(chunk, label=label)

Can't we add a word-diff feature by hooking/replacing patch.difflabel()
function? I think this "store" hack is needed because we're post-processing
a labeled output instead of doing that at the right layer.

> +def _chunkdiff(store):
> +'''Returns a (line, label) iterator over a corresponding deletion and
> +   insertion set. The set has to be considered as a whole in order to 
> match
> +   lines and perform inline coloring.
> +'''
> +def chunkiterator(list1, list2, direction):
> +'''For each string in list1, finds matching string in list2 and 
> returns
> +   an iterator over their differences.
> +'''
> +used = []
> +for a in list1:
> +done = False
> +for i, b in enumerate(list2):
> +if done or i in used:
> +continue
> +if difflib.SequenceMatcher(None, a, b).ratio() > 0.7:
> +buff = _inlinediff(a, b, direction=direction)
> +for line in buff:
> +yield (line[1], line[0])
> +done = True
> +used.append(i) # insure lines in b can be matched only 
> once

It seems wrong to allow crossed matches between list1 and list2. For example,
if list1[0] matched list2[5], list1[1] shouldn't match list2[4].

> +if not done:
> +yield (a, 'diff.' + direction)
> +
> +insert = store['diff.inserted']
> +delete = store['diff.deleted']
> +return itertools.chain(chunkiterator(delete, insert, 'deleted'),
> +   chunkiterator(insert, delete, 'inserted'))
> +
> +def _inlinediff(from_string, to_string, direction):

Nit: name_with_underscore is banned.
https://www.mercurial-scm.org/wiki/CodingStyle#Naming_conventions

> +'''Perform string diff to highlight specific changes.'''
> +direction_skip = '+?' if direction == 'deleted' else '-?'
> +if direction == 'deleted':
> +to_string, from_string = from_string, to_string
> +
> +# buffer required to remove last space, there may be smarter ways to do 
> this
> +buff = []
> +
> +# we never want to higlight the leading +-
> +if direction == 'deleted' and to_string.startswith('-'):
> +buff.append(('diff.deleted', '-'))
> +to_string = to_string[1:]
> +from_string = 

D1502: rewriteutil: add utility function to check if we can create new unstable cset

2017-11-28 Thread dlax (Denis Laxalde)
dlax requested changes to this revision.
dlax added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> rewriteutil.py:20
> +To allow new unstable changesets, set the config:
> +`experimental.evolution.allounstable=True`
> +"""

typo: allounstable

REPOSITORY
  rHG Mercurial

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

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