test-convert-bzr-directories.t fails

2017-11-02 Thread timeless
Mercurial Distributed SCM (version 4.4+11-7ebf850d3166+20171103)
Bazaar 2.5.1 -- a free distributed version-control tool

--- /home/timeless/hg/crewplan/tests/test-convert-bzr-directories.t
+++ /home/timeless/hg/crewplan/tests/test-convert-bzr-directories.t.err
@@ -56,12 +56,56 @@
   converting...
   1 Added directory
   0 Oops, typo
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.5 (default, Aug  5 2017, 21:54:58) [GCC 4.8.5
20150623 (Red Hat 4.8.5-16)]
+  ** Mercurial Distributed SCM (version 4.4+11-7ebf850d3166+20171103)
+  ** Extensions loaded: convert
+  Traceback (most recent call last):
+File "/tmp/hgtests.wDzHcj/install/bin/hg", line 41, in 
+  dispatch.run()
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 85, in run
+  status = (dispatch(req) or 0) & 255
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 173, in dispatch
+  ret = _runcatch(req)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 313, in _runcatch
+  return _callcatch(ui, _runcatchfunc)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 321, in _callcatch
+  return scmutil.callcatch(ui, func)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/scmutil.py",
line 154, in callcatch
+  return func()
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 303, in _runcatchfunc
+  return _dispatch(req)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 940, in _dispatch
+  cmdpats, cmdoptions)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 701, in runcommand
+  ret = _runcommand(ui, options, cmd, d)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 948, in _runcommand
+  return cmdfunc()
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 937, in 
+  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/util.py",
line 1183, in check
+  return func(*args, **kwargs)
+File "/tmp/hgtests.wDzHcj/install/lib/python/hgext/convert/__init__.py",
line 539, in convert
+  return convcmd.convert(ui, src, dest, revmapfile, **opts)
+File "/tmp/hgtests.wDzHcj/install/lib/python/hgext/convert/convcmd.py",
line 611, in convert
+  c.convert(sortmode)
+File "/tmp/hgtests.wDzHcj/install/lib/python/hgext/convert/convcmd.py",
line 522, in convert
+  self.copy(c)
+File "/tmp/hgtests.wDzHcj/install/lib/python/hgext/convert/convcmd.py",
line 451, in copy
+  changes = self.source.getchanges(rev, full)
+File "/tmp/hgtests.wDzHcj/install/lib/python/hgext/convert/bzr.py",
line 157, in getchanges
+  files, changes = self._gettreechanges(self._revtree, prevtree)
+File "/tmp/hgtests.wDzHcj/install/lib/python/hgext/convert/bzr.py",
line 232, in _gettreechanges
+  subdir = origin.root_inventory.path2id(paths[0])
+  AttributeError: 'InventoryRevisionTree' object has no attribute
'root_inventory'
+  [1]
   $ manifest source-hg 0
   % manifest of 0
   644   tpyo/something
   $ manifest source-hg tip
   % manifest of tip
-  644   typo/something
+  644   tpyo/something
   $ cd ..

 nested directory renames
@@ -86,10 +130,54 @@
   converting...
   1 Added nested directories
   0 Moved secondlevel one level up
-  $ manifest source-hg tip
-  % manifest of tip
-  644   secondlevel/file
-  644   secondlevel/thirdlevel/stuff
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.5 (default, Aug  5 2017, 21:54:58) [GCC 4.8.5
20150623 (Red Hat 4.8.5-16)]
+  ** Mercurial Distributed SCM (version 4.4+11-7ebf850d3166+20171103)
+  ** Extensions loaded: convert
+  Traceback (most recent call last):
+File "/tmp/hgtests.wDzHcj/install/bin/hg", line 41, in 
+  dispatch.run()
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 85, in run
+  status = (dispatch(req) or 0) & 255
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 173, in dispatch
+  ret = _runcatch(req)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 313, in _runcatch
+  return _callcatch(ui, _runcatchfunc)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 321, in _callcatch
+  return scmutil.callcatch(ui, func)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/scmutil.py",
line 154, in callcatch
+  return func()
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 303, in _runcatchfunc
+  return _dispatch(req)
+File "/tmp/hgtests.wDzHcj/install/lib/python/mercurial/dispatch.py",
line 940, in _dispatch
+  cmdpats, cmdoptions)
+File 

Re: [PATCH] run-tests: $TESTDIR can be something else than $PWD

2017-11-02 Thread Yuya Nishihara
On Thu, 02 Nov 2017 22:37:45 +0900, matthieu.laneuvi...@octobus.net wrote:
> # HG changeset patch
> # User Matthieu Laneuville 
> # Date 1501648065 -32400
> #  Wed Aug 02 13:27:45 2017 +0900
> # Node ID c4cc170d65e2dbcb075d09c26f5884aa8c0ceb31
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> # EXP-Topic hg122
> run-tests: $TESTDIR can be something else than $PWD
> 
> $TESTDIR is expected to be the directory were the test lives, and is often 
> used
> to reference helper functions. However, it is now set to $PWD at test 
> invocation
> time, so if `run-tests.py` is called from another folder, the test will fail.
> 
> The solution is to force $TESTDIR to be the base directory of the test itself,
> irrespective of where the runner is called from.
> 
> diff -r 3ce0e4b51f78 -r c4cc170d65e2 tests/run-tests.py
> --- a/tests/run-tests.py  Wed Nov 01 17:19:45 2017 -0500
> +++ b/tests/run-tests.py  Wed Aug 02 13:27:45 2017 +0900
> @@ -2353,6 +2353,12 @@ class TestRunner(object):
>  
>  self._testdir = osenvironb[b'TESTDIR'] = getattr(
>  os, 'getcwdb', os.getcwd)()
> +# assume all tests in same folder for now
> +if testdescs:
> +pathname = os.path.dirname(testdescs[0]['path'])
> +if pathname and not osenvironb[b'TESTDIR'].endswith('/'):
> +osenvironb[b'TESTDIR'] += '/'

Not work on Python 3 because of u'/' vs b'/' issue. Can you send a follow up?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] pathutil: use util.pathto() to calculate relative cwd in canonpath()

2017-11-02 Thread Yuya Nishihara
On Thu, 02 Nov 2017 21:16:32 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1509669331 14400
> #  Thu Nov 02 20:35:31 2017 -0400
> # Branch stable
> # Node ID 7d799a9800793cb5f1c10ce7269c31e1c7b1285a
> # Parent  95f54cec00258ffa4caa8df38e4ecb265aa7a0a3
> pathutil: use util.pathto() to calculate relative cwd in canonpath()

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


[PATCH STABLE] pathutil: use util.pathto() to calculate relative cwd in canonpath()

2017-11-02 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1509669331 14400
#  Thu Nov 02 20:35:31 2017 -0400
# Branch stable
# Node ID 7d799a9800793cb5f1c10ce7269c31e1c7b1285a
# Parent  95f54cec00258ffa4caa8df38e4ecb265aa7a0a3
pathutil: use util.pathto() to calculate relative cwd in canonpath()

os.path.relpath() exploded if the 'root' and 'cwd' directories had different
drive letters.  I noticed this in TortoiseHg when typing a fileset into the
filter, and it kept complaining until the closing '()' was typed.  This was
reproducible on the command line with:

  $ cd /d
  $ hg -R /c/Users/Matt/Projects/hg files 'set:e'
  Traceback (most recent call last):
  ...
  File "mercurial\pathutil.pyc", line 182, in canonpath
  File "ntpath.pyc", line 529, in relpath
  ValueError: path is on drive c:, start on drive d:

diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
--- a/mercurial/pathutil.py
+++ b/mercurial/pathutil.py
@@ -184,8 +184,10 @@
 try:
 if cwd != root:
 canonpath(root, root, myname, auditor)
-hint = (_("consider using '--cwd %s'")
-% os.path.relpath(root, cwd))
+relpath = util.pathto(root, cwd, '')
+if relpath[-1] == pycompat.ossep:
+relpath = relpath[:-1]
+hint = (_("consider using '--cwd %s'") % relpath)
 except error.Abort:
 pass
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] run-tests: allow automatic test discovery when providing folder as argument

2017-11-02 Thread matthieu . laneuville
# HG changeset patch
# User Matthieu Laneuville 
# Date 1508422437 -32400
#  Thu Oct 19 23:13:57 2017 +0900
# Node ID 0e692e27fb01c6c0619054ac4f32ce756071bf5a
# Parent  7ebf850d3166a64ff33b4b85adb481b533ddbf86
# EXP-Topic hg122
run-tests: allow automatic test discovery when providing folder as argument

Currently `run-tests.py` automatically discovers test only in the current
directory if no argument is provided. This patch makes it possible to pass a
number of tests and folders as arguments.

diff -r 7ebf850d3166 -r 0e692e27fb01 tests/run-tests.py
--- a/tests/run-tests.pySat Oct 21 16:50:57 2017 +0900
+++ b/tests/run-tests.pyThu Oct 19 23:13:57 2017 +0900
@@ -2510,6 +2510,16 @@ class TestRunner(object):
 else:
 args = os.listdir(b'.')
 
+expanded_args = []
+for arg in args:
+if os.path.isdir(arg):
+if not arg.endswith('/'):
+arg += '/'
+expanded_args.extend([arg + a for a in os.listdir(arg)])
+else:
+expanded_args.append(arg)
+args = expanded_args
+
 tests = []
 for t in args:
 if not (os.path.basename(t).startswith(b'test-')
diff -r 7ebf850d3166 -r 0e692e27fb01 tests/test-run-tests.t
--- a/tests/test-run-tests.tSat Oct 21 16:50:57 2017 +0900
+++ b/tests/test-run-tests.tThu Oct 19 23:13:57 2017 +0900
@@ -1261,6 +1261,23 @@ support for running a test outside the c
   .
   # Ran 1 tests, 0 skipped, 0 failed.
 
+support for automatically discovering test if arg is a folder
+  $ mkdir tmp && cd tmp
+
+  $ cat > test-uno.t << EOF
+  >   $ echo line
+  >   line
+  > EOF
+
+  $ cp test-uno.t test-dos.t
+  $ cd ..
+  $ cp -R tmp tmpp
+  $ cp tmp/test-uno.t test-solo.t
+
+  $ $PYTHON $TESTDIR/run-tests.py tmp/ test-solo.t tmpp
+  .
+  # Ran 5 tests, 0 skipped, 0 failed.
+
 support for running run-tests.py from another directory
   $ mkdir tmp && cd tmp
   $ cat > useful-file.sh << EOF
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1303: py3: handle keyword arguments in hgext/gpg.py

2017-11-02 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/D1303

AFFECTED FILES
  hgext/gpg.py

CHANGE DETAILS

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -106,7 +106,7 @@
 def newgpg(ui, **opts):
 """create a new gpg instance"""
 gpgpath = ui.config("gpg", "cmd")
-gpgkey = opts.get('key')
+gpgkey = opts.get(r'key')
 if not gpgkey:
 gpgkey = ui.config("gpg", "key")
 return gpg(gpgpath, gpgkey)
@@ -253,6 +253,7 @@
 
 def _dosign(ui, repo, *revs, **opts):
 mygpg = newgpg(ui, **opts)
+opts = pycompat.byteskwargs(opts)
 sigver = "0"
 sigmessage = ""
 
@@ -312,7 +313,8 @@
  % hgnode.short(n)
  for n in nodes])
 try:
-editor = cmdutil.getcommiteditor(editform='gpg.sign', **opts)
+editor = cmdutil.getcommiteditor(editform='gpg.sign',
+**pycompat.byteskwargs(opts))
 repo.commit(message, opts['user'], opts['date'], match=msigs,
 editor=editor)
 except ValueError as inst:



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


D1301: py3: handle keyword arguments in hgext/extdiff.py

2017-11-02 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/D1301

AFFECTED FILES
  hgext/extdiff.py

CHANGE DETAILS

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -338,6 +338,7 @@
 that revision is compared to the working directory, and, when no
 revisions are specified, the working directory files are compared
 to its parent.'''
+opts = pycompat.byteskwargs(opts)
 program = opts.get('program')
 option = opts.get('option')
 if not program:
@@ -369,6 +370,7 @@
 self._cmdline = cmdline
 
 def __call__(self, ui, repo, *pats, **opts):
+opts = pycompat.byteskwargs(opts)
 options = ' '.join(map(util.shellquote, opts['option']))
 if options:
 options = ' ' + options



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


D1300: py3: handle keyword arguments in hgext/commitextras.py

2017-11-02 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/D1300

AFFECTED FILES
  hgext/commitextras.py

CHANGE DETAILS

diff --git a/hgext/commitextras.py b/hgext/commitextras.py
--- a/hgext/commitextras.py
+++ b/hgext/commitextras.py
@@ -46,7 +46,7 @@
 origcommit = repo.commit
 try:
 def _wrappedcommit(*innerpats, **inneropts):
-extras = opts.get('extra')
+extras = opts.get(r'extra')
 if extras:
 for raw in extras:
 if '=' not in raw:
@@ -65,7 +65,7 @@
 msg = _("key '%s' is used internally, can't be set "
 "manually")
 raise error.Abort(msg % k)
-inneropts['extra'][k] = v
+inneropts[r'extra'][k] = v
 return origcommit(*innerpats, **inneropts)
 
 # This __dict__ logic is needed because the normal



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


D1302: py3: handle keyword arguments in hgext/fetch.py

2017-11-02 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/D1302

AFFECTED FILES
  hgext/fetch.py

CHANGE DETAILS

diff --git a/hgext/fetch.py b/hgext/fetch.py
--- a/hgext/fetch.py
+++ b/hgext/fetch.py
@@ -19,6 +19,7 @@
 exchange,
 hg,
 lock,
+pycompat,
 registrar,
 util,
 )
@@ -60,6 +61,7 @@
 Returns 0 on success.
 '''
 
+opts = pycompat.byteskwargs(opts)
 date = opts.get('date')
 if date:
 opts['date'] = util.parsedate(date)



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


D1299: py3: handle keyword arguments in hgext/churn.py

2017-11-02 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/D1299

AFFECTED FILES
  hgext/churn.py

CHANGE DETAILS

diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -19,6 +19,7 @@
 cmdutil,
 encoding,
 patch,
+pycompat,
 registrar,
 scmutil,
 util,
@@ -45,6 +46,7 @@
 
 def countrate(ui, repo, amap, *pats, **opts):
 """Calculate stats"""
+opts = pycompat.byteskwargs(opts)
 if opts.get('dateformat'):
 def getkey(ctx):
 t, tz = ctx.date()
@@ -154,7 +156,7 @@
 return s + " " * (l - encoding.colwidth(s))
 
 amap = {}
-aliases = opts.get('aliases')
+aliases = opts.get(r'aliases')
 if not aliases and os.path.exists(repo.wjoin('.hgchurn')):
 aliases = repo.wjoin('.hgchurn')
 if aliases:
@@ -172,7 +174,7 @@
 if not rate:
 return
 
-if opts.get('sort'):
+if opts.get(r'sort'):
 rate.sort()
 else:
 rate.sort(key=lambda x: (-sum(x[1]), x))
@@ -185,7 +187,7 @@
 ui.debug("assuming %i character terminal\n" % ttywidth)
 width = ttywidth - maxname - 2 - 2 - 2
 
-if opts.get('diffstat'):
+if opts.get(r'diffstat'):
 width -= 15
 def format(name, diffstat):
 added, removed = diffstat



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


D1296: py3: handle keyword arguments in hgext/automv.py

2017-11-02 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/D1296

AFFECTED FILES
  hgext/automv.py

CHANGE DETAILS

diff --git a/hgext/automv.py b/hgext/automv.py
--- a/hgext/automv.py
+++ b/hgext/automv.py
@@ -32,6 +32,7 @@
 copies,
 error,
 extensions,
+pycompat,
 registrar,
 scmutil,
 similar
@@ -53,6 +54,7 @@
 
 def mvcheck(orig, ui, repo, *pats, **opts):
 """Hook to check for moves at commit time"""
+opts = pycompat.byteskwargs(opts)
 renames = None
 disabled = opts.pop('no_automv', False)
 if not disabled:
@@ -68,7 +70,7 @@
 with repo.wlock():
 if renames is not None:
 scmutil._markchanges(repo, (), (), renames)
-return orig(ui, repo, *pats, **opts)
+return orig(ui, repo, *pats, **pycompat.strkwargs(opts))
 
 def _interestingfiles(repo, matcher):
 """Find what files were added or removed in this commit.



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


D1297: py3: handle keyword arguments in hgext/blackbox.py

2017-11-02 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/D1297

AFFECTED FILES
  hgext/blackbox.py

CHANGE DETAILS

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -226,7 +226,7 @@
 if not repo.vfs.exists('blackbox.log'):
 return
 
-limit = opts.get('limit')
+limit = opts.get(r'limit')
 fp = repo.vfs('blackbox.log', 'r')
 lines = fp.read().split('\n')
 



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


D974: py3: handle keyword arguments correctly in hgext/patchbomb.py

2017-11-02 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3231.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D974?vs=2497=3231

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

AFFECTED FILES
  hgext/patchbomb.py

CHANGE DETAILS

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -89,6 +89,7 @@
 mail,
 node as nodemod,
 patch,
+pycompat,
 registrar,
 repair,
 scmutil,
@@ -318,7 +319,7 @@
 tmpfn = os.path.join(tmpdir, 'bundle')
 btype = ui.config('patchbomb', 'bundletype')
 if btype:
-opts['type'] = btype
+opts[r'type'] = btype
 try:
 commands.bundle(ui, repo, tmpfn, dest, **opts)
 return util.readfile(tmpfn)
@@ -338,8 +339,8 @@
 the user through the editor.
 """
 ui = repo.ui
-if opts.get('desc'):
-body = open(opts.get('desc')).read()
+if opts.get(r'desc'):
+body = open(opts.get(r'desc')).read()
 else:
 ui.write(_('\nWrite the introductory message for the '
'patch series.\n\n'))
@@ -359,21 +360,21 @@
 """
 ui = repo.ui
 _charsets = mail._charsets(ui)
-subj = (opts.get('subject')
+subj = (opts.get(r'subject')
 or prompt(ui, 'Subject:', 'A bundle for your repository'))
 
 body = _getdescription(repo, '', sender, **opts)
 msg = emailmod.MIMEMultipart.MIMEMultipart()
 if body:
-msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test')))
+msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test')))
 datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle')
 datapart.set_payload(bundle)
-bundlename = '%s.hg' % opts.get('bundlename', 'bundle')
+bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle')
 datapart.add_header('Content-Disposition', 'attachment',
 filename=bundlename)
 emailmod.Encoders.encode_base64(datapart)
 msg.attach(datapart)
-msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
+msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get(r'test'))
 return [(msg, subj, None)]
 
 def _makeintro(repo, sender, revs, patches, **opts):
@@ -384,27 +385,27 @@
 _charsets = mail._charsets(ui)
 
 # use the last revision which is likely to be a bookmarked head
-prefix = _formatprefix(ui, repo, revs.last(), opts.get('flag'),
+prefix = _formatprefix(ui, repo, revs.last(), opts.get(r'flag'),
0, len(patches), numbered=True)
-subj = (opts.get('subject') or
+subj = (opts.get(r'subject') or
 prompt(ui, '(optional) Subject: ', rest=prefix, default=''))
 if not subj:
 return None # skip intro if the user doesn't bother
 
 subj = prefix + ' ' + subj
 
 body = ''
-if opts.get('diffstat'):
+if opts.get(r'diffstat'):
 # generate a cumulative diffstat of the whole patch series
 diffstat = patch.diffstat(sum(patches, []))
 body = '\n' + diffstat
 else:
 diffstat = None
 
 body = _getdescription(repo, body, sender, **opts)
-msg = mail.mimeencode(ui, body, _charsets, opts.get('test'))
+msg = mail.mimeencode(ui, body, _charsets, opts.get(r'test'))
 msg['Subject'] = mail.headencode(ui, subj, _charsets,
- opts.get('test'))
+ opts.get(r'test'))
 return (msg, subj, diffstat)
 
 def _getpatchmsgs(repo, sender, revs, patchnames=None, **opts):
@@ -414,6 +415,7 @@
 
 This function returns a list of "email" tuples (subject, content, None).
 """
+bytesopts = pycompat.byteskwargs(opts)
 ui = repo.ui
 _charsets = mail._charsets(ui)
 patches = list(_getpatches(repo, revs, **opts))
@@ -423,7 +425,7 @@
  % len(patches))
 
 # build the intro message, or skip it if the user declines
-if introwanted(ui, opts, len(patches)):
+if introwanted(ui, bytesopts, len(patches)):
 msg = _makeintro(repo, sender, revs, patches, **opts)
 if msg:
 msgs.append(msg)
@@ -437,8 +439,8 @@
 for i, (r, p) in enumerate(zip(revs, patches)):
 if patchnames:
 name = patchnames[i]
-msg = makepatch(ui, repo, r, p, opts, _charsets, i + 1,
-len(patches), numbered, name)
+msg = makepatch(ui, repo, r, p, bytesopts, _charsets,
+i + 1, len(patches), numbered, name)
 msgs.append(msg)
 
 return msgs
@@ -579,6 +581,8 @@
 Before using this command, you will need to enable email in your
 hgrc. See the [email] section in hgrc(5) for details.
 '''
+stropts = opts
+opts = pycompat.byteskwargs(opts)
 
 _charsets = mail._charsets(ui)
 
@@ -625,6 +629,7 @@
 revs = _getoutgoing(repo, dest, revs)
 if bundle:
 opts['revs'] = [str(r) for r in revs]
+ 

D1298: py3: handle keyword arguments in hgext/children.py

2017-11-02 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/D1298

AFFECTED FILES
  hgext/children.py

CHANGE DETAILS

diff --git a/hgext/children.py b/hgext/children.py
--- a/hgext/children.py
+++ b/hgext/children.py
@@ -19,6 +19,7 @@
 from mercurial.i18n import _
 from mercurial import (
 cmdutil,
+pycompat,
 registrar,
 )
 
@@ -55,6 +56,7 @@
 See :hg:`help log` and :hg:`help revsets.children`.
 
 """
+opts = pycompat.byteskwargs(opts)
 rev = opts.get('rev')
 if file_:
 fctx = repo.filectx(file_, changeid=rev)



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


D1295: py3: handle keyword arguments in hgext/amend.py

2017-11-02 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/D1295

AFFECTED FILES
  hgext/amend.py

CHANGE DETAILS

diff --git a/hgext/amend.py b/hgext/amend.py
--- a/hgext/amend.py
+++ b/hgext/amend.py
@@ -17,6 +17,7 @@
 cmdutil,
 commands,
 error,
+pycompat,
 registrar,
 )
 
@@ -46,10 +47,11 @@
 
 See :hg:`help commit` for more details.
 """
+opts = pycompat.byteskwargs(opts)
 if len(opts['note']) > 255:
 raise error.Abort(_("cannot store a note of more than 255 bytes"))
 with repo.wlock(), repo.lock():
 if not opts.get('logfile'):
 opts['message'] = opts.get('message') or repo['.'].description()
 opts['amend'] = True
-return commands._docommit(ui, repo, *pats, **opts)
+return commands._docommit(ui, repo, *pats, **pycompat.strkwargs(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


Re: [PATCH] obsfate: makes successorsetverb takes the markers as argument

2017-11-02 Thread Pulkit Goyal
Is there any difference between this one and the one you send before
the freeze on Phabricator?

On Thu, Nov 2, 2017 at 6:28 PM, Boris Feld  wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1508409347 -7200
> #  Thu Oct 19 12:35:47 2017 +0200
> # Node ID b5b9f31a676701ca272c10fc2630e4587413e4e7
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> # EXP-Topic fix-obsfate
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> b5b9f31a6767
> obsfate: makes successorsetverb takes the markers as argument
>
> Right now, successorsetverb only needs successors to compute the verb. But we
> will want use additional information (effect-flags and operation) in the near
> future to compute a better verb.
>
> Add the markers parameter now so extensions (like Evolve) could wrap the
> function and start experimenting around better obsfate verbs.
>
> As successorsetverb now takes both successorset and markers parameters, rename
> it to obsfateverb, successorsetandmarkersverb was too long.
>
> Differential Revision: https://phab.mercurial-scm.org/D1191
>
> diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
> --- a/mercurial/obsutil.py
> +++ b/mercurial/obsutil.py
> @@ -751,8 +751,9 @@ def successorsandmarkers(repo, ctx):
>
>  return values
>
> -def successorsetverb(successorset):
> -""" Return the verb summarizing the successorset
> +def obsfateverb(successorset, markers):
> +""" Return the verb summarizing the successorset and potentially using
> +information from the markers
>  """
>  if not successorset:
>  verb = 'pruned'
> @@ -795,7 +796,7 @@ def obsfateprinter(successors, markers,
>  line = []
>
>  # Verb
> -line.append(successorsetverb(successors))
> +line.append(obsfateverb(successors, markers))
>
>  # Operations
>  operations = markersoperations(markers)
> diff --git a/mercurial/templater.py b/mercurial/templater.py
> --- a/mercurial/templater.py
> +++ b/mercurial/templater.py
> @@ -1005,17 +1005,18 @@ def obsfateusers(context, mapping, args)
>  "obsmakers")
>  raise error.ParseError(msg)
>
> -@templatefunc('obsfateverb(successors)')
> +@templatefunc('obsfateverb(successors, markers)')
>  def obsfateverb(context, mapping, args):
>  """Compute obsfate related information based on successors 
> (EXPERIMENTAL)"""
> -if len(args) != 1:
> +if len(args) != 2:
>  # i18n: "obsfateverb" is a keyword
> -raise error.ParseError(_("obsfateverb expects one arguments"))
> +raise error.ParseError(_("obsfateverb expects two arguments"))
>
>  successors = evalfuncarg(context, mapping, args[0])
> +markers = evalfuncarg(context, mapping, args[1])
>
>  try:
> -return obsutil.successorsetverb(successors)
> +return obsutil.obsfateverb(successors, markers)
>  except TypeError:
>  # i18n: "obsfateverb" is a keyword
>  errmsg = _("obsfateverb first argument should be countable")
> diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
> --- a/tests/test-obsmarker-template.t
> +++ b/tests/test-obsmarker-template.t
> @@ -13,7 +13,7 @@ Global setup
>> evolution=true
>> [templates]
>> obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
> -  > obsfateverb = "{obsfateverb(successors)}"
> +  > obsfateverb = "{obsfateverb(successors, markers)}"
>> obsfateoperations = "{if(obsfateoperations(markers), " using 
> {join(obsfateoperations(markers), ", ")}")}"
>> obsfateusers = "{if(obsfateusers(markers), " by 
> {join(obsfateusers(markers), ", ")}")}"
>> obsfatedate = "{if(obsfatedate(markers), 
> "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at 
> {min(obsfatedate(markers))|isodate})", " (between 
> {min(obsfatedate(markers))|isodate} and 
> {max(obsfatedate(markers))|isodate})")}")}"
> ___
> 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


D1293: rebase: use fm.formatlist() and fm.formatdict() to support user template

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

REVISION SUMMARY
  Thanks to Yuya for suggesting this in https://phab.mercurial-scm.org/D1173.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -21,7 +21,6 @@
 
 from mercurial.i18n import _
 from mercurial.node import (
-hex,
 nullid,
 nullrev,
 short,
@@ -1545,8 +1544,11 @@
 replacements[oldnode] = succs
 scmutil.cleanupnodes(repo, replacements, 'rebase', moves)
 if fm:
-nodechanges = {hex(oldn): [hex(n) for n in newn]
-   for oldn, newn in replacements.iteritems()}
+hf = fm.hexfunc
+fl = fm.formatlist
+fd = fm.formatdict
+nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], 'succs')
+  for oldn, newn in replacements.iteritems()})
 fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **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


[Bug 5729] New: Subrep paths can overwrite existing paths

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

Bug ID: 5729
   Summary: Subrep paths can overwrite existing paths
   Product: Mercurial
   Version: 4.4
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: s...@farley.io
CC: mercurial-devel@mercurial-scm.org

It can be misleading that Mercurial will allow a subrepo path to be the same as
a path already checked in (and vice versa). This is bad because it hides the
fact that a subdirectory on disk has content that is *not* the same as the
subrepo itself.

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


D821: unamend: move fb extension unamend to core

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


  This is lying here from a long time. It will be good some feedback is given. 
:)

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, durham
Cc: ryanmce, singhsrb, durham, 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-02 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Re-requesting review since the freeze is over.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, dlax, ryanmce
Cc: ryanmce, dlax, 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-02 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds two new filternames 'visible-hidden' and 'visible-warnhidden'
  which will be used to access hidden commits.
  'visible-hidden' will allow access of hidden commits with any warning. This 
will
  be for read only commands.
  'visible-warnhidden' will allow acces of hidden commits but will warn for 
that.
  This will be for recoverable write commands.
  For unrecoverable write commands, we don't need to have anything new as that's
  the current behaviour.
  
  We are using the same computehidden() function as we will be adding the hidden
  revisions to pinnedrevs.
  
  The idea to add new filternames is taken from directaccess extension from
  fb-hgext.

REPOSITORY
  rHG Mercurial

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
@@ -142,6 +142,8 @@
 # Otherwise your filter will have to recompute all its branches cache
 # from scratch (very slow).
 filtertable = {'visible': computehidden,
+   'visible-warnhidden': computehidden,
+   'visible-hidden': 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-hidden': '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


D1288: dispatch: filter the repository depending on func.cmdtype

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

REVISION SUMMARY
  This patch adds support for filtering the repository on the basis of
  func.cmdtype. After this patch, repo.filtername will be used to decide what
  level of access the running command can has on hidden commits.
  
  All this logic is behind a config flag `experimental.directacess` which 
defaults
  to False.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -42,6 +42,8 @@
 )
 
 unrecoverablewrite = registrar.command.unrecoverablewrite
+recoverablewrite = registrar.command.recoverablewrite
+readonly = registrar.command.readonly
 
 class request(object):
 def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
@@ -927,6 +929,14 @@
 ui = repo.ui
 if options['hidden']:
 repo = repo.unfiltered()
+
+# Accessing hidden commits based on func.cmdtype
+if lui.configbool('experimental', 'directaccess'):
+if func.cmdtype == readonly:
+repo = repo.filtered('visible-hidden')
+elif func.cmdtype == recoverablewrite:
+repo = repo.filtered('visible-warnhidden')
+
 args.insert(0, repo)
 elif rpath:
 ui.warn(_("warning: --repository ignored\n"))
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -359,6 +359,9 @@
 coreconfigitem('experimental', 'crecordtest',
 default=None,
 )
+coreconfigitem('experimental', 'directaccess',
+default=False,
+)
 coreconfigitem('experimental', 'editortmpinhg',
 default=False,
 )



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


D1144: directaccess: add support to export and tests to demonstrate things

2017-11-02 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3206.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1144?vs=2907=3206

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-directaccess.t

CHANGE DETAILS

diff --git a/tests/test-directaccess.t b/tests/test-directaccess.t
new file mode 100644
--- /dev/null
+++ b/tests/test-directaccess.t
@@ -0,0 +1,68 @@
+Tests for access level on hidden commits by various commands on based of their
+type.
+
+Setting the required config to start this
+
+  $ cat >> $HGRCPATH < [experimental]
+  > evolution=createmarkers, allowunstable
+  > directaccess=True
+  > [extensions]
+  > amend =
+  > EOF
+
+  $ hg init repo
+  $ cd repo
+  $ for ch in {a..c}; do touch $ch; echo "foo" >> $ch; hg ci -Aqm "Added "$ch; 
done
+
+  $ hg log -G -T '{rev}:{node} {desc}' --hidden
+  @  2:28ad74487de9599d00d81085be739c61fc340652 Added c
+  |
+  o  1:29becc82797a4bc11ec8880b58eaecd2ab3e7760 Added b
+  |
+  o  0:18d04c59bb5d2d4090ad9a5b59bd6274adb63add Added a
+  
+  $ echo "bar" >> c
+  $ hg amend
+
+  $ hg log -G -T '{rev}:{node} {desc}' --hidden
+  @  3:2443a0e664694756d8b435d06b6ad84f941b6fc0 Added c
+  |
+  | x  2:28ad74487de9599d00d81085be739c61fc340652 Added c
+  |/
+  o  1:29becc82797a4bc11ec8880b58eaecd2ab3e7760 Added b
+  |
+  o  0:18d04c59bb5d2d4090ad9a5b59bd6274adb63add Added a
+  
+Testing read only commands on the hidden revision
+
+Testing with rev number
+
+  $ hg exp 2
+  abort: hidden revision '2'!
+  (use --hidden to access hidden revisions)
+  [255]
+
+Testing with hash
+
+  $ hg exp 28ad74
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #  Thu Jan 01 00:00:00 1970 +
+  # Node ID 28ad74487de9599d00d81085be739c61fc340652
+  # Parent  29becc82797a4bc11ec8880b58eaecd2ab3e7760
+  Added c
+  
+  diff -r 29becc82797a -r 28ad74487de9 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +foo
+
+Make sure things with cmdtype undefined dont work with hidden commits
+
+  $ hg log -r 28ad74
+  abort: hidden revision '28ad74'!
+  (use --hidden to access hidden revisions)
+  [255]
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -61,6 +61,8 @@
 
 release = lockmod.release
 
+readonly = registrar.command.readonly
+
 table = {}
 table.update(debugcommandsmod.command._table)
 
@@ -1863,7 +1865,8 @@
 ('', 'switch-parent', None, _('diff against the second parent')),
 ('r', 'rev', [], _('revisions to export'), _('REV')),
 ] + diffopts,
-_('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'))
+_('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'),
+cmdtype=readonly)
 def export(ui, repo, *changesets, **opts):
 """dump the header and diffs for one or more changesets
 



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


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

2017-11-02 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3203.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1141?vs=2991=3203

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

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
@@ -142,6 +142,8 @@
 # Otherwise your filter will have to recompute all its branches cache
 # from scratch (very slow).
 filtertable = {'visible': computehidden,
+   'visible-warnhidden': computehidden,
+   'visible-hidden': 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-hidden': 'visible'}
 
 def updatecache(repo):
 cl = repo.changelog



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


D1143: revset: update visibility exceptions with hidden commits from the tree

2017-11-02 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3205.
pulkit edited the summary of this revision.
pulkit retitled this revision from "revset: update repo.pinnedrevs with hidden 
commits from the tree" to "revset: update visibility exceptions with hidden 
commits from the tree".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1143?vs=2905=3205

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

AFFECTED FILES
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -22,6 +22,7 @@
 obsutil,
 pathutil,
 phases,
+pycompat,
 registrar,
 repoview,
 revsetlang,
@@ -2195,6 +2196,10 @@
 tree = revsetlang.analyze(tree)
 tree = revsetlang.optimize(tree)
 posttreebuilthook(tree, repo)
+# add revs to visibility exceptions if hashes of hidden revs is passed and
+# accessing hidden commmits is allowed
+if repo and repo.filtername in ('visible-hidden', 'visible-warnhidden'):
+_updateexceptions(tree, repo)
 return makematcher(tree)
 
 def makematcher(tree):
@@ -2223,3 +2228,71 @@
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = symbols.values()
+
+hashre = util.re.compile('[0-9a-fA-F]{1,40}')
+_listtuple = ('symbol', '_list')
+
+def _ishashsymbol(symbol, maxrev):
+""" returns true if symbol looks like a hash """
+
+try:
+n = int(symbol)
+if n <= maxrev:
+# It's a rev number
+return False
+except ValueError:
+pass
+return hashre.match(symbol)
+
+def gethashsymbols(tree, maxrev):
+"""
+returns the list of symbols of the tree that look like hashes
+for example for the revset 3::abe3ff it will return ('abe3ff')
+"""
+
+if not tree:
+return []
+
+results = []
+if len(tree) in (2, 3) and tree[0] == "symbol":
+results.append(tree[1])
+elif tree[0] == "func" and tree[1] == _listtuple:
+# the optimiser will group sequence of hash request
+results += tree[2][1].split('\0')
+elif len(tree) >= 2:
+for subtree in tree[1:]:
+results += gethashsymbols(subtree, maxrev)
+# return directly, we don't need to filter symbols again
+return results
+return [s for s in results if _ishashsymbol(s, maxrev)]
+
+def _updateexceptions(tree, repo):
+"""
+extracts the symbols that looks like hashes and add them to
+visibility exceptions set for accessing hidden hashes
+"""
+
+hiddenset = set()
+unfi = repo.unfiltered()
+unficl = unfi.changelog
+cl = repo.changelog
+symbols = gethashsymbols(tree, len(unficl))
+pmatch = unficl._partialmatch
+for revnode in symbols:
+try:
+revnode = pmatch(revnode)
+except error.LookupError:
+revnode = None
+if revnode is not None:
+rev = unficl.rev(revnode)
+if rev not in cl:
+hiddenset.add(rev)
+
+if hiddenset:
+if repo.filtername == 'visible-warnhidden':
+hsets = _(",").join([pycompat.bytestr(unfi[l]) for l in hiddenset])
+repo.ui.warn(_("warning: accessing hidden changesets for write "
+   "operation: %s\n") % hsets)
+
+repo.addvisibilityexceptions(hiddenset)
+repo.invalidatevolatilesets()



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


D1142: dispatch: filter the repository depending on func.cmdtype

2017-11-02 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 3204.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1142?vs=2992=3204

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -42,6 +42,8 @@
 )
 
 unrecoverablewrite = registrar.command.unrecoverablewrite
+recoverablewrite = registrar.command.recoverablewrite
+readonly = registrar.command.readonly
 
 class request(object):
 def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
@@ -927,6 +929,14 @@
 ui = repo.ui
 if options['hidden']:
 repo = repo.unfiltered()
+
+# Accessing hidden commits based on func.cmdtype
+if lui.configbool('experimental', 'directaccess'):
+if func.cmdtype == readonly:
+repo = repo.filtered('visible-hidden')
+elif func.cmdtype == recoverablewrite:
+repo = repo.filtered('visible-warnhidden')
+
 args.insert(0, repo)
 elif rpath:
 ui.warn(_("warning: --repository ignored\n"))
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -359,6 +359,9 @@
 coreconfigitem('experimental', 'crecordtest',
 default=None,
 )
+coreconfigitem('experimental', 'directaccess',
+default=False,
+)
 coreconfigitem('experimental', 'editortmpinhg',
 default=False,
 )



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


D1286: repoview: also consider visibility exceptions in pinnedrevs

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

REVISION SUMMARY
  This patch make repoview.pinnedrevs() also add visibility exceptions added in
  previous patch.

REPOSITORY
  rHG Mercurial

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
@@ -37,6 +37,9 @@
 pinned.update([par.rev() for par in repo[None].parents()])
 pinned.update([cl.rev(bm) for bm in repo._bookmarks.values()])
 
+# add the visibility exceptions
+pinned.update(repo.getvisibilityexceptions())
+
 tags = {}
 tagsmod.readlocaltags(repo.ui, repo, tags, {})
 if tags:



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: localrepo: add a new attribute _visibilityexceptions and related API

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

REVISION SUMMARY
  Currently we don't have a defined way in core to make some hidden revisions
  visible in filtered repo. Extensions to achieve the purpose of unhiding some
  hidden commits, wrap repoview.pinnedrevs() function.
  
  To make the above task simple and have well defined API, this patch adds a new
  attribute '_visibilityexceptions' to localrepository class which will contains
  the hidden revs which should be exception.
  
  This patch also adds API to add revs to the attribute set and get them.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -509,6 +509,16 @@
 self._sparsesignaturecache = {}
 # Signature to cached matcher instance.
 self._sparsematchercache = {}
+# hidden hashed which should be visible
+self._visibilityexceptions = set()
+
+def addvisibilityexceptions(self, exceptions):
+""" adds hidden revs which should be visible to set of exceptions """
+self._visibilityexceptions.update(exceptions)
+
+def getvisibilityexceptions(self):
+""" returns the set of hidden revs which should be visible """
+return self._visibilityexceptions
 
 def _getvfsward(self, origfunc):
 """build a ward for self.vfs"""



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


[Bug 5728] New: Performance regression on update between 4.3.3 and 4.4

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

Bug ID: 5728
   Summary: Performance regression on update between 4.3.3 and 4.4
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Keywords: perfregression
  Severity: bug
  Priority: urgent
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: lothiral...@gmail.com
CC: mercurial-devel@mercurial-scm.org

Created attachment 1983
  --> https://bz.mercurial-scm.org/attachment.cgi?id=1983=edit
Screenshot of ASV dashboard

There is a +35% "hg update" performance regression between 4.3.3 and 4.4, TLDR
here are the timings:

Here are the timings for updating Mozilla-central from c20235d9b540 to
8418e104829f using a single worker (1 changesets, 46941 files updated, 9194
files removed):

Version Update  Diff %
4.3.3   18.039  
a52e560430.533  69.26%
4.4 24.548  36.08%

I see similar rations on pypy and in a smaller order of magnitude on mercurial.

The full command used is "hg up --quiet --config worker.numcpus=1 8418e104829f"

Here is where you can access the result:
http://perf.octobus.net/#basic_commands.UpdateTimeTestSuite.time_up_tip?branch=stable.
As I can't put all the needed parameters in the URL, I also attach a screenshot
of the page.

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


mercurial@34964: 8 new changesets

2017-11-02 Thread Mercurial Commits
8 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/58e7791e243b
changeset:   34957:58e7791e243b
user:Augie Fackler 
date:Wed Oct 25 23:01:54 2017 -0400
summary: ui: add configlist doctest to document a bit more of the 
whitespace behavior

https://www.mercurial-scm.org/repo/hg/rev/5910db5d1913
changeset:   34958:5910db5d1913
user:Augie Fackler 
date:Mon Oct 30 17:46:07 2017 -0400
summary: revert: no longer mark --interactive as experimental

https://www.mercurial-scm.org/repo/hg/rev/7ee2d859f720
changeset:   34959:7ee2d859f720
user:Boris Feld 
date:Mon Oct 30 17:08:16 2017 +0100
summary: debug: add a debugcapabilities commands

https://www.mercurial-scm.org/repo/hg/rev/762ea8a1f5e7
changeset:   34960:762ea8a1f5e7
user:Boris Feld 
date:Mon Oct 30 17:09:29 2017 +0100
summary: debug: print parsed bundle2 capabilities with debugcapabilities

https://www.mercurial-scm.org/repo/hg/rev/a7e49a5b3e6f
changeset:   34961:a7e49a5b3e6f
user:Boris Feld 
date:Wed Nov 01 17:08:33 2017 +0100
summary: obsolete: activate effect-flag by default

https://www.mercurial-scm.org/repo/hg/rev/a18eef03d879
changeset:   34962:a18eef03d879
user:Matthieu Laneuville 
date:Wed Aug 02 13:27:45 2017 +0900
summary: run-tests: $TESTDIR can be something else than $PWD

https://www.mercurial-scm.org/repo/hg/rev/ddf37b6b8c3d
changeset:   34963:ddf37b6b8c3d
user:Yuya Nishihara 
date:Sat Oct 21 17:01:20 2017 +0900
summary: rebase: drop --style option

https://www.mercurial-scm.org/repo/hg/rev/7ebf850d3166
changeset:   34964:7ebf850d3166
bookmark:@
tag: tip
user:Yuya Nishihara 
date:Sat Oct 21 16:50:57 2017 +0900
summary: patch: improve heuristics to not take the word "diff" as header 
(issue1879)

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


Desired use case for obsmarkers / visibility

2017-11-02 Thread Gregory Szorc
I have a potential use case for obsmarkers / visibility that I want to run
by people to see if it can be supported.

Changesets are pushed to the Firefox repo via a landing service. This
service essentially imports changesets [submitted by the author] and
rebases them onto the repo head.

Today, when your changesets are landed, you need to perform "garbage
collection" on your local repo to remove the old versions of changesets. We
want landed changesets to disappear after `hg pull` picks up the rebased
versions.

This is a pretty straightforward scenario and is supported by obsmarkers
today. If we enabled the writing of obsolescence markers in the landing
service, things would essentially "just work."

Here's where things get a little more complicated.

When changesets are landed to the Firefox repo today, they are first pushed
to an "integration" repository. Logically, this can be modeled as a single
repo divided into public and draft parts. e.g.

o D (draft) (head)
o C (draft)
o B (public)
o A (public) (root)

When our CI says a changeset is "good," it is promoted to public. e.g.

o D (draft)
o C (public) (formerly draft)
o B (public)
o A (public) (root)

Today, when we encounter a "bad" changeset, we perform a backout. e.g.

o D' (draft) (backout of D)
o D (draft)
o C (public)
o B (public)
o A (public) (root)

Given our push velocity, it is common to have intermediary changesets land
before a changeset is identified as "bad." This means there are changesets
between the initial landings and its backout. e.g.

o D' (draft) (backout of D)
o E (draft)
o D (draft)
o C (public)
o B (public)
o A (public) (root)

The repo with the backouts is eventually published and the final history of
the repo is littered with "bad" changesets and backouts. This causes all
kinds of problems for bisection, annotate, file history, etc.

Instead of performing backouts and leaving the final repo history in a
sub-optimal state, we want to instead "drop" "bad" changesets before they
are published. e.g.

o E' (draft) (rebased from discarded D to C)
| x D (draft) (discarded)
o C (public)
o B (public)
o A (public) (root)

Since we can identify "bad" changesets relatively quickly, this would
enable us to remove the vast majority of backouts and "bad" changesets from
the final, published repo history.

Again, obsolescence as it exists today facilitates this. We can perform
these drops via `hg histedit` (or similar) and the appropriate "prune"
obsmarkers are written so the canonical repo has the appropriate final
history.

However, the way it works today isn't friendly to end-user workflows.

If we were to deploy this, the following would happen:

1) User creates changeset X and submits for landing.
2) Landing service rebases to X' and writes X->X' marker.
3) X' turns out to be bad and is dropped. X'->null marker is written to
convey the prune.
4) User pulls and sees X->X'->null and hides X because its most recent
successor is pruned.
5) User is left wondering what happened to X. They possibly forget they
need to fix and reland X.

This is bad UX. What we want to happen instead is:

a) User pulls after X' drop and X is still visible.
b) Something else happens and some form of X remains visible/accessible to
user

The server can't expose X' because everyone would see it. We have 1 head
per repo and don't want to be exposing random "bad" changesets to everyone.
This seems to rule out the traditional evolve solution of "touch" a
changeset to revive a prune because I'm not sure how we'd send X' to only
the user that cares about it. There's also no way in obsolescence today to
unhide X once it has been obsoleted.

In the obsmarker world of today, the best solution I can think of is
"delete obsmarkers on the server." If we discarded the X->X' marker (or
didn't write it until X' became public), the end-user's original changeset
X wouldn't be hidden on pull because there is no marker on the server
referencing X. But this approach feels hacky and is extra server-side
complexity, which I'd prefer to avoid.

I /think/ the new visibility work proposed by Jun, Durham, and others might
offer some solutions to this problem. Rather than speculate based on my
limited knowledge of that proposal, I am hoping someone with more knowledge
could weigh in more definitively.

It's worth noting that in our proposed workflow, the "integration"
changesets that are rewritten exist in a separate repository that most
people don't pull from. This means we could potentially break some "rules"
about how obsmarkers work since few would notice. But we do pull the
"integration" repo into the "stable" repo. So presumably obsmarkers would
propagate to the "stable" repo and be pulled by people, where they could
cause problems.

Is there a solution to this use case? FWIW, I think a solution would have
use beyond Mozilla's walls: I'm pretty sure a lot of people would love for
the final history of their repo to be cleaner. It's just that today's VCS
tools (including Git), 

D1224: merge: cache unknown dir checks (issue5716)

2017-11-02 Thread mbthomas (Mark Thomas)
mbthomas added a comment.


  Yes, fine to punt to after 4.4.  With https://phab.mercurial-scm.org/D1223 
the checks are disabled, so we're back to the old behaviour for path conflicts, 
but the perf is ok.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Martin von Zweigbergk via Mercurial-devel
On Thu, Nov 2, 2017 at 7:16 AM, Denis Laxalde  wrote:

> Augie Fackler a écrit :
>
>>
>> On Nov 2, 2017, at 09:39, Martin von Zweigbergk via Mercurial-devel <
>>> mercurial-devel@mercurial-scm.org> wrote:
>>>
>>> Can we still change the behavior of "hg revert -i -r" to show a to-apply
>>> diff, not a to-revert diff? (There's a bug number I'm too lazy to look up
>>> from mobile.)
>>>
>>
>> I thought we had already done the patch-reversing that we felt was
>> required...
>>
>
> The last discussion ended with a status quo:
>
> https://www.mercurial-scm.org/pipermail/mercurial-devel/2016
> -November/090142.html
>
> Since then, I set "experimental.revertalternateinteractivemode=false" to
> have a behavior that I find meaningful in most situations.


So do I. The problem is that new users won't have that. If we're graduating
--interactive now, then this seems like a good time (at the latest) to
switch the default of that flag.


> The only case
> it does not work well is "hg revert -i -r .^" (which I think was a major
> motivation for the current behavior).


I prefer the forward direction even when reverting to a parent. We could
add --no-forward-patch flag or something, or we could add a "hg grab" that
grabs the file content from a revision and is equivalent to "hg revert"
except that the patch is always forward. But last time I suggested that, no
one seemed interested, so I'm not very optimistic. So probably just switch
the default of revertalternateinteractivemode to false?


> On the other hand, now "hg
> uncommit" in evolve extension has a --interactive flag that could be
> used instead.
>
>
>
>>
>>> On Thu, Nov 2, 2017, 05:47 Yuya Nishihara  wrote:
>>> On Thu, 2 Nov 2017 10:03:44 +0100, Denis Laxalde wrote:
>>>
 Augie Fackler a écrit :

> # HG changeset patch
> # User Augie Fackler 
> # Date 1509399967 14400
> #  Mon Oct 30 17:46:07 2017 -0400
> # Node ID a2fc2086ac3116c63ab890180697b2695c50d9f4
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> revert: no longer mark --interactive as experimental
>
> We seem to have settled down on behavior changes here (nothing
> matching revset `keyword(revert) and keyword(interactive)` since 4.2
> was released), so let's go ahead and advertise this excellent feature.
>

 +1

>>>
>>> +1, too. Queued, thanks.
>>> ___
>>> 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-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Denis Laxalde

Augie Fackler a écrit :



On Nov 2, 2017, at 09:39, Martin von Zweigbergk via Mercurial-devel 
 wrote:

Can we still change the behavior of "hg revert -i -r" to show a to-apply diff, 
not a to-revert diff? (There's a bug number I'm too lazy to look up from mobile.)


I thought we had already done the patch-reversing that we felt was required...


The last discussion ended with a status quo:

https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/090142.html

Since then, I set "experimental.revertalternateinteractivemode=false" to
have a behavior that I find meaningful in most situations. The only case
it does not work well is "hg revert -i -r .^" (which I think was a major
motivation for the current behavior). On the other hand, now "hg
uncommit" in evolve extension has a --interactive flag that could be
used instead.





On Thu, Nov 2, 2017, 05:47 Yuya Nishihara  wrote:
On Thu, 2 Nov 2017 10:03:44 +0100, Denis Laxalde wrote:

Augie Fackler a écrit :

# HG changeset patch
# User Augie Fackler 
# Date 1509399967 14400
#  Mon Oct 30 17:46:07 2017 -0400
# Node ID a2fc2086ac3116c63ab890180697b2695c50d9f4
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
revert: no longer mark --interactive as experimental

We seem to have settled down on behavior changes here (nothing
matching revset `keyword(revert) and keyword(interactive)` since 4.2
was released), so let's go ahead and advertise this excellent feature.


+1


+1, too. Queued, thanks.
___
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-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5727] New: interactive qrefresh aborts if files have been added

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

Bug ID: 5727
   Summary: interactive qrefresh aborts if files have been added
   Product: Mercurial
   Version: 4.4
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: mq
  Assignee: bugzi...@mercurial-scm.org
  Reporter: malcolm.pars...@gmail.com
CC: mercurial-devel@mercurial-scm.org

Reproduction steps:
$ mkdir foo
$ cd foo
$ hg init
$ hg qnew -m "BugId: 0 add foo.h" foo.diff
$ touch foo.h
$ hg add foo.h
$ hg qrefresh -i
starting interactive selection
c
abort: cannot create foo.h: destination already exists

-- 
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 7 of 7] strip: strip obsmarkers exclusive to the stripped changeset

2017-11-02 Thread Augie Fackler

> On Nov 2, 2017, at 04:49, Mathias De Maré  wrote:
> 
> 
> On 01-06-17 15:39, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David 
>> # Date 149528 -7200
>> #  Sat May 20 16:19:59 2017 +0200
>> # Node ID fb16a4d85cf46afbc12bb61f8d22784cef31d1dc
>> # Parent  2c44bd45fdeeb3a8bf1762af4a81af3914fadc29
>> # EXP-Topic obsstrip
>> # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
>> #  hg pull 
>> https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r fb16a4d85cf4
>> strip: strip obsmarkers exclusive to the stripped changeset
>> 
>> This is it, `hg strip --rev X` will now also remove obsolescence markers
>> exclusive to X. Since a previous changeset, the obsmarkers has been backed up
>> in the strip backup bundle, so it is possible to restore them.
>> 
>> Note: stripping obsmarkers means the precursors of the stripped changeset 
>> might no
>> longer be obsolete after the strip.
>> 
>> Stripping changeset without obsmarkers can be useful when building test 
>> case. So
>> It is possible to disable the stripping of obsmarkers using the
>> 'devel.strip-obsmarkers' config option.
>> 
>> Test change have been carefully validated.
> 
> We recently upgrade to 4.3.3, and received some user complaints about this 
> change.
> They used 'hg strip' to remove in-development changesets they no longer need. 
> This could be solved by having 'hg prune' in Mercurial itself (we don't have 
> evolve enabled for our users). Unless there is already an alternative present?

`hg obsolete -r $REVS`?

> 
> Greetings,
> Mathias
> ___
> 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] patch: improve heuristics to not take the word "diff" as header (issue1879)

2017-11-02 Thread Augie Fackler

> On Nov 2, 2017, at 09:32, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1508572257 -32400
> #  Sat Oct 21 16:50:57 2017 +0900
> # Node ID 6798568fe43dc1e28a0c66c54217b563e1f2d5de
> # Parent  a7e49a5b3e6f38338660c0d98f9c593f70064e95
> patch: improve heuristics to not take the word "diff" as header (issue1879)


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


Re: [PATCH] rebase: drop --style option

2017-11-02 Thread Augie Fackler

> On Nov 2, 2017, at 09:33, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1508572880 -32400
> #  Sat Oct 21 17:01:20 2017 +0900
> # Node ID 3fef2926f7dc84c8840b8d1d592f2e650ce0a7ee
> # Parent  946badd65a139cbb50150f23471db136a42d7814
> rebase: drop --style option

queued, thanks

> 
> It existed from the very start, but I don't think the rebase command does
> support log-like templates.
> 
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -53,7 +53,6 @@ from mercurial import (
> )
> 
> release = lock.release
> -templateopts = cmdutil.templateopts
> 
> # The following constants are used throughout the rebase module. The ordering 
> of
> # their values must be maintained.
> @@ -594,7 +593,7 @@ class rebaseruntime(object):
> ('t', 'tool', '', _('specify merge tool')),
> ('c', 'continue', False, _('continue an interrupted rebase')),
> ('a', 'abort', False, _('abort an interrupted rebase'))] +
> - templateopts,
> +cmdutil.formatteropts,
> _('[-s REV | -b REV] [-d REV] [OPTION]'))
> def rebase(ui, repo, **opts):
> """move changeset (and descendants) to a different branch
> ___
> 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] run-tests: $TESTDIR can be something else than $PWD

2017-11-02 Thread Augie Fackler
queued, sure

> On Nov 2, 2017, at 09:37, matthieu.laneuvi...@octobus.net wrote:
> 
> # HG changeset patch
> # User Matthieu Laneuville 
> # Date 1501648065 -32400
> #  Wed Aug 02 13:27:45 2017 +0900
> # Node ID c4cc170d65e2dbcb075d09c26f5884aa8c0ceb31
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> # EXP-Topic hg122
> run-tests: $TESTDIR can be something else than $PWD
> 
> $TESTDIR is expected to be the directory were the test lives, and is often 
> used
> to reference helper functions. However, it is now set to $PWD at test 
> invocation
> time, so if `run-tests.py` is called from another folder, the test will fail.
> 
> The solution is to force $TESTDIR to be the base directory of the test itself,
> irrespective of where the runner is called from.
> 
> diff -r 3ce0e4b51f78 -r c4cc170d65e2 tests/run-tests.py
> --- a/tests/run-tests.py  Wed Nov 01 17:19:45 2017 -0500
> +++ b/tests/run-tests.py  Wed Aug 02 13:27:45 2017 +0900
> @@ -2353,6 +2353,12 @@ class TestRunner(object):
> 
> self._testdir = osenvironb[b'TESTDIR'] = getattr(
> os, 'getcwdb', os.getcwd)()
> +# assume all tests in same folder for now
> +if testdescs:
> +pathname = os.path.dirname(testdescs[0]['path'])
> +if pathname and not osenvironb[b'TESTDIR'].endswith('/'):
> +osenvironb[b'TESTDIR'] += '/'
> +osenvironb[b'TESTDIR'] += pathname
> if self.options.outputdir:
> self._outputdir = canonpath(_bytespath(self.options.outputdir))
> else:
> diff -r 3ce0e4b51f78 -r c4cc170d65e2 tests/test-run-tests.t
> --- a/tests/test-run-tests.t  Wed Nov 01 17:19:45 2017 -0500
> +++ b/tests/test-run-tests.t  Wed Aug 02 13:27:45 2017 +0900
> @@ -1261,6 +1261,22 @@ support for running a test outside the c
>   .
>   # Ran 1 tests, 0 skipped, 0 failed.
> 
> +support for running run-tests.py from another directory
> +  $ mkdir tmp && cd tmp
> +  $ cat > useful-file.sh << EOF
> +  > important command
> +  > EOF
> +
> +  $ cat > test-folder.t << EOF
> +  >   $ cat \$TESTDIR/useful-file.sh
> +  >   important command
> +  > EOF
> +
> +  $ cd ..
> +  $ $PYTHON $TESTDIR/run-tests.py tmp/test-folder.t
> +  .
> +  # Ran 1 tests, 0 skipped, 0 failed.
> +
> support for bisecting failed tests automatically
>   $ hg init bisect
>   $ cd bisect
> ___
> 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 RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Augie Fackler

> On Nov 2, 2017, at 09:39, Martin von Zweigbergk via Mercurial-devel 
>  wrote:
> 
> Can we still change the behavior of "hg revert -i -r" to show a to-apply 
> diff, not a to-revert diff? (There's a bug number I'm too lazy to look up 
> from mobile.)

I thought we had already done the patch-reversing that we felt was required...

> 
> On Thu, Nov 2, 2017, 05:47 Yuya Nishihara  wrote:
> On Thu, 2 Nov 2017 10:03:44 +0100, Denis Laxalde wrote:
> > Augie Fackler a écrit :
> > > # HG changeset patch
> > > # User Augie Fackler 
> > > # Date 1509399967 14400
> > > #  Mon Oct 30 17:46:07 2017 -0400
> > > # Node ID a2fc2086ac3116c63ab890180697b2695c50d9f4
> > > # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> > > revert: no longer mark --interactive as experimental
> > >
> > > We seem to have settled down on behavior changes here (nothing
> > > matching revset `keyword(revert) and keyword(interactive)` since 4.2
> > > was released), so let's go ahead and advertise this excellent feature.
> >
> > +1
> 
> +1, too. Queued, thanks.
> ___
> 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-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Yuya Nishihara
On Thu, 02 Nov 2017 13:39:59 +, Martin von Zweigbergk wrote:
> Can we still change the behavior of "hg revert -i -r" to show a to-apply
> diff, not a to-revert diff? (There's a bug number I'm too lazy to look up
> from mobile.)

Oh, I thought "revert -i" would already work that way. I think BC of
interactive outputs is acceptable.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] run-tests: $TESTDIR can be something else than $PWD

2017-11-02 Thread matthieu . laneuville
# HG changeset patch
# User Matthieu Laneuville 
# Date 1501648065 -32400
#  Wed Aug 02 13:27:45 2017 +0900
# Node ID c4cc170d65e2dbcb075d09c26f5884aa8c0ceb31
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic hg122
run-tests: $TESTDIR can be something else than $PWD

$TESTDIR is expected to be the directory were the test lives, and is often used
to reference helper functions. However, it is now set to $PWD at test invocation
time, so if `run-tests.py` is called from another folder, the test will fail.

The solution is to force $TESTDIR to be the base directory of the test itself,
irrespective of where the runner is called from.

diff -r 3ce0e4b51f78 -r c4cc170d65e2 tests/run-tests.py
--- a/tests/run-tests.pyWed Nov 01 17:19:45 2017 -0500
+++ b/tests/run-tests.pyWed Aug 02 13:27:45 2017 +0900
@@ -2353,6 +2353,12 @@ class TestRunner(object):
 
 self._testdir = osenvironb[b'TESTDIR'] = getattr(
 os, 'getcwdb', os.getcwd)()
+# assume all tests in same folder for now
+if testdescs:
+pathname = os.path.dirname(testdescs[0]['path'])
+if pathname and not osenvironb[b'TESTDIR'].endswith('/'):
+osenvironb[b'TESTDIR'] += '/'
+osenvironb[b'TESTDIR'] += pathname
 if self.options.outputdir:
 self._outputdir = canonpath(_bytespath(self.options.outputdir))
 else:
diff -r 3ce0e4b51f78 -r c4cc170d65e2 tests/test-run-tests.t
--- a/tests/test-run-tests.tWed Nov 01 17:19:45 2017 -0500
+++ b/tests/test-run-tests.tWed Aug 02 13:27:45 2017 +0900
@@ -1261,6 +1261,22 @@ support for running a test outside the c
   .
   # Ran 1 tests, 0 skipped, 0 failed.
 
+support for running run-tests.py from another directory
+  $ mkdir tmp && cd tmp
+  $ cat > useful-file.sh << EOF
+  > important command
+  > EOF
+
+  $ cat > test-folder.t << EOF
+  >   $ cat \$TESTDIR/useful-file.sh
+  >   important command
+  > EOF
+
+  $ cd ..
+  $ $PYTHON $TESTDIR/run-tests.py tmp/test-folder.t
+  .
+  # Ran 1 tests, 0 skipped, 0 failed.
+
 support for bisecting failed tests automatically
   $ hg init bisect
   $ cd bisect
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Martin von Zweigbergk via Mercurial-devel
Can we still change the behavior of "hg revert -i -r" to show a to-apply
diff, not a to-revert diff? (There's a bug number I'm too lazy to look up
from mobile.)

On Thu, Nov 2, 2017, 05:47 Yuya Nishihara  wrote:

> On Thu, 2 Nov 2017 10:03:44 +0100, Denis Laxalde wrote:
> > Augie Fackler a écrit :
> > > # HG changeset patch
> > > # User Augie Fackler 
> > > # Date 1509399967 14400
> > > #  Mon Oct 30 17:46:07 2017 -0400
> > > # Node ID a2fc2086ac3116c63ab890180697b2695c50d9f4
> > > # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> > > revert: no longer mark --interactive as experimental
> > >
> > > We seem to have settled down on behavior changes here (nothing
> > > matching revset `keyword(revert) and keyword(interactive)` since 4.2
> > > was released), so let's go ahead and advertise this excellent feature.
> >
> > +1
>
> +1, too. Queued, thanks.
> ___
> 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] rebase: drop --style option

2017-11-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1508572880 -32400
#  Sat Oct 21 17:01:20 2017 +0900
# Node ID 3fef2926f7dc84c8840b8d1d592f2e650ce0a7ee
# Parent  946badd65a139cbb50150f23471db136a42d7814
rebase: drop --style option

It existed from the very start, but I don't think the rebase command does
support log-like templates.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -53,7 +53,6 @@ from mercurial import (
 )
 
 release = lock.release
-templateopts = cmdutil.templateopts
 
 # The following constants are used throughout the rebase module. The ordering 
of
 # their values must be maintained.
@@ -594,7 +593,7 @@ class rebaseruntime(object):
 ('t', 'tool', '', _('specify merge tool')),
 ('c', 'continue', False, _('continue an interrupted rebase')),
 ('a', 'abort', False, _('abort an interrupted rebase'))] +
- templateopts,
+cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
 """move changeset (and descendants) to a different branch
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3] templatekw: move loadkeyword() to bottom

2017-11-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1508574673 -32400
#  Sat Oct 21 17:31:13 2017 +0900
# Node ID 369af8fed661bef2b0b061f2eac4c932d4f753ae
# Parent  a19232e55e7c0838299dbd1dfd93207b24a02f39
templatekw: move loadkeyword() to bottom

loadkeyword() isn't a template keyword function.

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -860,12 +860,6 @@ def showtags(**args):
 """List of strings. Any tags associated with the changeset."""
 return shownames('tags', **args)
 
-def loadkeyword(ui, extname, registrarobj):
-"""Load template keyword from specified registrarobj
-"""
-for name, func in registrarobj._table.iteritems():
-keywords[name] = func
-
 @templatekeyword('termwidth')
 def showtermwidth(repo, ctx, templ, **args):
 """Integer. The width of the current terminal."""
@@ -891,5 +885,11 @@ def showinstabilities(**args):
 return showlist('instability', args['ctx'].instabilities(), args,
 plural='instabilities')
 
+def loadkeyword(ui, extname, registrarobj):
+"""Load template keyword from specified registrarobj
+"""
+for name, func in registrarobj._table.iteritems():
+keywords[name] = func
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = keywords.values()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 3] templatekw: add verbosity keyword to select template by -q/-v/--debug flag

2017-11-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1508575601 -32400
#  Sat Oct 21 17:46:41 2017 +0900
# Node ID 946badd65a139cbb50150f23471db136a42d7814
# Parent  369af8fed661bef2b0b061f2eac4c932d4f753ae
templatekw: add verbosity keyword to select template by -q/-v/--debug flag

This can be used in conjunction with the ifeq() function.

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -885,6 +885,19 @@ def showinstabilities(**args):
 return showlist('instability', args['ctx'].instabilities(), args,
 plural='instabilities')
 
+@templatekeyword('verbosity')
+def showverbosity(ui, **args):
+"""String. The current output verbosity in 'debug', 'quiet', 'verbose',
+or ''."""
+# see cmdutil.changeset_templater for priority of these flags
+if ui.debugflag:
+return 'debug'
+elif ui.quiet:
+return 'quiet'
+elif ui.verbose:
+return 'verbose'
+return ''
+
 def loadkeyword(ui, extname, registrarobj):
 """Load template keyword from specified registrarobj
 """
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -2876,6 +2876,17 @@ Test diff function:
   @@ -0,0 +1,1 @@
   +second
 
+ui verbosity:
+
+  $ hg log -l1 -T '{verbosity}\n'
+  
+  $ hg log -l1 -T '{verbosity}\n' --debug
+  debug
+  $ hg log -l1 -T '{verbosity}\n' --quiet
+  quiet
+  $ hg log -l1 -T '{verbosity}\n' --verbose
+  verbose
+
   $ cd ..
 
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3] help: hide phaseidx template keyword

2017-11-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1508573104 -32400
#  Sat Oct 21 17:05:04 2017 +0900
# Node ID a19232e55e7c0838299dbd1dfd93207b24a02f39
# Parent  6798568fe43dc1e28a0c66c54217b563e1f2d5de
help: hide phaseidx template keyword

I don't think it's great idea to expose the internal representation of phases.
Let's discourage use of the phaseidx keyword.

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -816,7 +816,7 @@ def showphase(repo, ctx, templ, **args):
 
 @templatekeyword('phaseidx')
 def showphaseidx(repo, ctx, templ, **args):
-"""Integer. The changeset phase index."""
+"""Integer. The changeset phase index. (ADVANCED)"""
 return ctx.phase()
 
 @templatekeyword('rev')
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] patch: improve heuristics to not take the word "diff" as header (issue1879)

2017-11-02 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1508572257 -32400
#  Sat Oct 21 16:50:57 2017 +0900
# Node ID 6798568fe43dc1e28a0c66c54217b563e1f2d5de
# Parent  a7e49a5b3e6f38338660c0d98f9c593f70064e95
patch: improve heuristics to not take the word "diff" as header (issue1879)

The word "diff" is likely to appear in a commit message. Let's make it less
likely by requiring "diff -" for "diff -r" or "diff --git".

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -203,7 +203,7 @@ def extract(ui, fileobj):
 
 # attempt to detect the start of a patch
 # (this heuristic is borrowed from quilt)
-diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
+diffre = re.compile(br'^(?:Index:[ \t]|diff[ \t]-|RCS file: |'
 br'retrieving revision [0-9]+(\.[0-9]+)*$|'
 br'---[ \t].*?^\+\+\+[ \t]|'
 br'\*\*\*[ \t].*?^---[ \t])',
diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -1346,6 +1346,93 @@ import a unified diff with no lines of c
 
   $ cd ..
 
+commit message that looks like a diff header (issue1879)
+
+  $ hg init headerlikemsg
+  $ cd headerlikemsg
+  $ touch empty
+  $ echo nonempty >> nonempty
+  $ hg ci -qAl - < blah blah
+  > diff blah
+  > blah blah
+  > EOF
+  $ hg --config diff.git=1 log -pv
+  changeset:   0:c6ef204ef767
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  files:   empty nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/empty b/empty
+  new file mode 100644
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+ (without --git, empty file is lost, but commit message should be preserved)
+
+  $ hg init plain
+  $ hg export 0 | hg -R plain import -
+  applying patch from stdin
+  $ hg --config diff.git=1 -R plain log -pv
+  changeset:   0:60a2d231e71f
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  files:   nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+ (with --git, patch contents should be fully preserved)
+
+  $ hg init git
+  $ hg --config diff.git=1 export 0 | hg -R git import -
+  applying patch from stdin
+  $ hg --config diff.git=1 -R git log -pv
+  changeset:   0:c6ef204ef767
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:00 1970 +
+  files:   empty nonempty
+  description:
+  blah blah
+  diff blah
+  blah blah
+  
+  
+  diff --git a/empty b/empty
+  new file mode 100644
+  diff --git a/nonempty b/nonempty
+  new file mode 100644
+  --- /dev/null
+  +++ b/nonempty
+  @@ -0,0 +1,1 @@
+  +nonempty
+  
+
+  $ cd ..
+
 no segfault while importing a unified diff which start line is zero but chunk
 size is non-zero
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 15 of 15 V2] exchange: drop unused '_getbookmarks' function

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508248540 -7200
#  Tue Oct 17 15:55:40 2017 +0200
# Node ID cfaaca09ba21da03f44a253348bc5de968928da3
# Parent  018fdb537668a81bd1f949ae6fe987a58b281ebf
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
cfaaca09ba21
exchange: drop unused '_getbookmarks' function

The function was introduced in 8491845a75b2 in mid-November 2016 but is never
used anywhere in core. Binary support for bookmarks has now landed in core and
the getbundle API makes it easy to override it. So we just remove the dead
(unborn?) code.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1875,17 +1875,6 @@ def _getbundletagsfnodes(bundler, repo, 
 outgoing = _computeoutgoing(repo, heads, common)
 bundle2.addparttagsfnodescache(repo, bundler, outgoing)
 
-def _getbookmarks(repo, **kwargs):
-"""Returns bookmark to node mapping.
-
-This function is primarily used to generate `bookmarks` bundle2 part.
-It is a separate function in order to make it easy to wrap it
-in extensions. Passing `kwargs` to the function makes it easy to
-add new parameters in extensions.
-"""
-
-return dict(bookmod.listbinbookmarks(repo))
-
 def check_heads(repo, their_heads, context):
 """check if the heads of a repo have been modified
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 13 of 15 V2] getbundle: add support for 'bookmarks' boolean argument

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508246837 -7200
#  Tue Oct 17 15:27:17 2017 +0200
# Node ID 17674b225838b4b5081330bd07649a931471e800
# Parent  68bbec307c142b6b41893512b1c76320c87c2fa1
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
17674b225838
getbundle: add support for 'bookmarks' boolean argument

This new argument requests a 'bookmarks' part from the server. It is meant to
be used instead of the "listkeys" request.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1750,6 +1750,19 @@ def _getbundlechangegrouppart(bundler, r
 if 'treemanifest' in repo.requirements:
 part.addparam('treemanifest', '1')
 
+@getbundle2partsgenerator('bookmarks')
+def _getbundlebookmarkpart(bundler, repo, source, bundlecaps=None,
+  b2caps=None, **kwargs):
+"""add a bookmark part to the requested bundle"""
+if not kwargs.get('bookmarks', False):
+return
+if 'bookmarks' not in b2caps:
+raise ValueError(_('no common bookmarks exchange method'))
+books  = bookmod.listbinbookmarks(repo)
+data = bookmod.binaryencode(books)
+if data:
+bundler.newpart('bookmarks', data=data)
+
 @getbundle2partsgenerator('listkeys')
 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
 b2caps=None, **kwargs):
diff --git a/mercurial/help/internals/wireprotocol.txt 
b/mercurial/help/internals/wireprotocol.txt
--- a/mercurial/help/internals/wireprotocol.txt
+++ b/mercurial/help/internals/wireprotocol.txt
@@ -731,6 +731,8 @@ cg
 cbattempted
Boolean indicating whether the client attempted to use the *clone bundles*
feature before performing this request.
+bookmarks
+   Boolean indicating whether bookmark data is requested.
 phases
Boolean indicating whether phases data is requested.
 
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -205,6 +205,7 @@ def encodebatchcmds(req):
 # :scsv:  list of comma-separated values return as set
 # :plain: string with no transformation needed.
 gboptsmap = {'heads':  'nodes',
+ 'bookmarks': 'boolean',
  'common': 'nodes',
  'obsmarkers': 'boolean',
  'phases': 'boolean',
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 14 of 15 V2] pull: retrieve bookmarks through the binary part when possible

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508246842 -7200
#  Tue Oct 17 15:27:22 2017 +0200
# Node ID 018fdb537668a81bd1f949ae6fe987a58b281ebf
# Parent  17674b225838b4b5081330bd07649a931471e800
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
018fdb537668
pull: retrieve bookmarks through the binary part when possible

This makes pull consistent with the part used by push and provide us with a
more compact representation of bookmarks.

In addition, this opens the way for smarter bookmark exchanges (e.g. filtering
by names or only sending the bookmark relevant to the pulled set, etc).

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1464,12 +1464,26 @@ def _pullbundle2(pullop):
 kwargs['phases'] = True
 pullop.stepsdone.add('phases')
 
+bookmarksrequested = False
+legacybookmark = 'bookmarks' in ui.configlist('devel', 'legacy.exchange')
+hasbinarybook = 'bookmarks' in pullop.remotebundle2caps
+
+if pullop.remotebookmarks is not None:
+pullop.stepsdone.add('request-bookmarks')
+
+if ('request-bookmarks' not in pullop.stepsdone
+and pullop.remotebookmarks is None
+and not legacybookmark and hasbinarybook):
+kwargs['bookmarks'] = True
+bookmarksrequested = True
+
 if 'listkeys' in pullop.remotebundle2caps:
 if 'phases' not in pullop.stepsdone:
 kwargs['listkeys'] = ['phases']
-if pullop.remotebookmarks is None:
+if 'request-bookmarks' not in pullop.stepsdone:
 # make sure to always includes bookmark data when migrating
 # `hg incoming --bundle` to using this function.
+pullop.stepsdone.add('request-bookmarks')
 kwargs.setdefault('listkeys', []).append('bookmarks')
 
 # If this is a full pull / clone and the server supports the clone bundles
@@ -1497,7 +1511,9 @@ def _pullbundle2(pullop):
 _pullbundle2extraprepare(pullop, kwargs)
 bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs))
 try:
-op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
+op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction)
+op.modes['bookmarks'] = 'records'
+bundle2.processbundle(pullop.repo, bundle, op=op)
 except bundle2.AbortFromPart as exc:
 pullop.repo.ui.status(_('remote: abort: %s\n') % exc)
 raise error.Abort(_('pull failed on remote'), hint=exc.hint)
@@ -1513,9 +1529,15 @@ def _pullbundle2(pullop):
 _pullapplyphases(pullop, value)
 
 # processing bookmark update
-for namespace, value in op.records['listkeys']:
-if namespace == 'bookmarks':
-pullop.remotebookmarks = bookmod.unhexlifybookmarks(value)
+if bookmarksrequested:
+books = {}
+for record in op.records['bookmarks']:
+books[record['bookmark']] = record["node"]
+pullop.remotebookmarks = books
+else:
+for namespace, value in op.records['listkeys']:
+if namespace == 'bookmarks':
+pullop.remotebookmarks = bookmod.unhexlifybookmarks(value)
 
 # bookmark data were either already there or pulled in the bundle
 if pullop.remotebookmarks is not None:
diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -33,7 +33,7 @@ Missing manifest should not result in se
   $ cat server/access.log
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
   * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - 
x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 
comp=*zlib,none,bzip2 (glob)
-  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - 
x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps=1==aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2=bookmarks=1
 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
+  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - 
x-hgarg-1:bookmarks=1=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps=1==aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2=bookmarks=1
 x-hgproto-1:0.1 0.2 comp=*zlib,none,bzip2 (glob)
 
 Empty manifest file results in retrieval
 (the extension only checks if the manifest file exists)
diff --git 

[PATCH 10 of 15 V2] bookmark: use the 'bookmarks' bundle2 part to push bookmark update (issue5165)

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508236693 -7200
#  Tue Oct 17 12:38:13 2017 +0200
# Node ID 9a8c55d83b3601a41f0d406f80de2f245bbb6c83
# Parent  e634131ba39fa08d292675ca73a6c0cf8cb2588b
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9a8c55d83b36
bookmark: use the 'bookmarks' bundle2 part to push bookmark update (issue5165)

We use the new binary parts we introduced earlier to exchange bookmark. The
payload is a bit more compact since we use binary and the length of bookmarks
is no longer constrained to 255.

.. fix:: Issue 5165

   Bookmark, whose name is longer than 255, can again be exchanged again
   between 4.4+ client and servers.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -896,9 +896,45 @@ def _pushb2bookmarks(pushop, bundler):
 if 'bookmarks' in pushop.stepsdone:
 return
 b2caps = bundle2.bundle2caps(pushop.remote)
-if 'pushkey' in b2caps:
+
+legacy = pushop.repo.ui.configlist('devel', 'legacy.exchange')
+legacybooks = 'bookmarks' in legacy
+
+if not legacybooks and 'bookmarks' in b2caps:
+return _pushb2bookmarkspart(pushop, bundler)
+elif 'pushkey' in b2caps:
 return _pushb2bookmarkspushkey(pushop, bundler)
 
+def _bmaction(old, new):
+"""small utility for bookmark pushing"""
+if not old:
+return 'export'
+elif not new:
+return 'delete'
+return 'update'
+
+def _pushb2bookmarkspart(pushop, bundler):
+pushop.stepsdone.add('bookmarks')
+if not pushop.outbookmarks:
+return
+
+allactions = []
+data = []
+for book, old, new in pushop.outbookmarks:
+new = bin(new)
+data.append((book, new))
+allactions.append((book, _bmaction(old, new)))
+checkdata = bookmod.binaryencode(data)
+bundler.newpart('bookmarks', data=checkdata)
+
+def handlereply(op):
+ui = pushop.ui
+# if success
+for book, action in allactions:
+ui.status(bookmsgmap[action][0] % book)
+
+return handlereply
+
 def _pushb2bookmarkspushkey(pushop, bundler):
 pushop.stepsdone.add('bookmarks')
 part2book = []
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -1,4 +1,12 @@
 #testcases b2-pushkey b2-binary
+
+#if b2-pushkey
+  $ cat << EOF >> $HGRCPATH
+  > [devel]
+  > legacy.exchange=bookmarks
+  > EOF
+#endif
+
 #require serve
 
   $ cat << EOF >> $HGRCPATH
@@ -250,10 +258,11 @@ delete a remote bookmark
   bundle2-output: header chunk size: 19
   bundle2-output: payload chunk size: 48
   bundle2-output: closing payload chunk
-  bundle2-output: bundle part: "pushkey"
-  bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload
-  bundle2-output: part 3: "PUSHKEY"
-  bundle2-output: header chunk size: 90
+  bundle2-output: bundle part: "bookmarks"
+  bundle2-output-part: "bookmarks" 23 bytes payload
+  bundle2-output: part 3: "BOOKMARKS"
+  bundle2-output: header chunk size: 16
+  bundle2-output: payload chunk size: 23
   bundle2-output: closing payload chunk
   bundle2-output: end of bundle
   bundle2-input: start processing of HG20 stream
@@ -287,40 +296,29 @@ delete a remote bookmark
   bundle2-input: payload chunk size: 48
   bundle2-input: payload chunk size: 0
   bundle2-input-part: total payload size 48
-  bundle2-input: part header size: 90
-  bundle2-input: part type: "PUSHKEY"
+  bundle2-input: part header size: 16
+  bundle2-input: part type: "BOOKMARKS"
   bundle2-input: part id: "3"
-  bundle2-input: part parameters: 4
-  bundle2-input: found a handler for part pushkey
-  bundle2-input-part: "pushkey" (params: 4 mandatory) supported
-  pushing key for "bookmarks:W"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part bookmarks
+  bundle2-input-part: "bookmarks" supported
+  bundle2-input: payload chunk size: 23
   bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 23
   bundle2-input: part header size: 0
   bundle2-input: end of bundle2 stream
   bundle2-input-bundle: 3 parts total
   running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
   test-hook-bookmark: W:   -> 
-  bundle2-output-bundle: "HG20", 1 parts total
+  bundle2-output-bundle: "HG20", 0 parts total
   bundle2-output: start emission of HG20 stream
   bundle2-output: bundle parameter: 
   bundle2-output: start of parts
-  bundle2-output: bundle part: "reply:pushkey"
-  bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload
-  bundle2-output: part 0: "REPLY:PUSHKEY"
-  bundle2-output: header chunk size: 43
-  bundle2-output: closing payload chunk
   bundle2-output: end of bundle
   bundle2-input: start processing of HG20 

[PATCH 12 of 15 V2] bundle2: support a 'records' mode for the 'bookmarks' part

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508246776 -7200
#  Tue Oct 17 15:26:16 2017 +0200
# Node ID 68bbec307c142b6b41893512b1c76320c87c2fa1
# Parent  bd3927325fe48e104b1627e5681ccd09a9a49e44
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
68bbec307c14
bundle2: support a 'records' mode for the 'bookmarks' part

In this mode, the bookmarks changes are record in the 'bundleoperation' records
instead of inflicted to the repository. This is necessary to use the part when
pulling.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1897,40 +1897,55 @@ def handlepushkey(op, inpart):
 def handlebookmark(op, inpart):
 """transmit bookmark information
 
-The part contains binary encoded bookmark information. The bookmark
-information is applied as is to the unbundling repository. Make sure a
-'check:bookmarks' part is issued earlier to check for race condition in
-such update.
+The part contains binary encoded bookmark information.
+
+The exact behavior of this part can be controlled by the 'bookmarks' mode
+on the bundle operation.
 
-This behavior is suitable for pushing. Semantic adjustment will be needed
-for pull.
+When mode is 'apply' (the default) the bookmark information is applied as
+is to the unbundling repository. Make sure a 'check:bookmarks' part is
+issued earlier to check for push races in such update. This behavior is
+suitable for pushing.
+
+When mode is 'records', the information is recorded into the 'bookmarks'
+records of the bundle operation. This behavior is suitable for pulling.
 """
 changes = bookmarks.binarydecode(inpart)
 
-tr = op.gettransaction()
-bookstore = op.repo._bookmarks
+pushkeycompat = op.repo.ui.configbool('server', 'bookmarks-pushkey-compat')
+bookmarksmode = op.modes.get('bookmarks', 'apply')
 
-pushkeycompat = op.repo.ui.configbool('server', 'bookmarks-pushkey-compat')
-if pushkeycompat:
-allhooks = []
+if bookmarksmode == 'apply':
+tr = op.gettransaction()
+bookstore = op.repo._bookmarks
+if pushkeycompat:
+allhooks = []
+for book, node in changes:
+hookargs = tr.hookargs.copy()
+hookargs['pushkeycompat'] = '1'
+hookargs['namespace'] = 'bookmark'
+hookargs['key'] = book
+hookargs['old'] = nodemod.hex(bookstore.get(book, ''))
+hookargs['new'] = nodemod.hex(node if node is not None else '')
+allhooks.append(hookargs)
+
+for hookargs in allhooks:
+op.repo.hook('prepushkey', throw=True, **hookargs)
+
+bookstore.applychanges(op.repo, op.gettransaction(), changes)
+
+if pushkeycompat:
+def runhook():
+for hookargs in allhooks:
+op.repo.hook('prepushkey', **hookargs)
+op.repo._afterlock(runhook)
+
+elif bookmarksmode == 'records':
 for book, node in changes:
-hookargs = tr.hookargs.copy()
-hookargs['pushkeycompat'] = '1'
-hookargs['namespace'] = 'bookmark'
-hookargs['key'] = book
-hookargs['old'] = nodemod.hex(bookstore.get(book, ''))
-hookargs['new'] = nodemod.hex(node if node is not None else '')
-allhooks.append(hookargs)
-for hookargs in allhooks:
-op.repo.hook('prepushkey', throw=True, **hookargs)
-
-bookstore.applychanges(op.repo, tr, changes)
-
-if pushkeycompat:
-def runhook():
-for hookargs in allhooks:
-op.repo.hook('prepushkey', **hookargs)
-op.repo._afterlock(runhook)
+record = {'bookmark': book, 'node': node}
+op.records.add('bookmarks', record)
+else:
+raise error.ProgrammingError('unkown bookmark mode: %s' % 
bookmarksmode)
 
 @parthandler('phase-heads')
 def handlephases(op, inpart):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 09 of 15 V2] bookmark: introduce in advance a variant of the exchange test

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508236659 -7200
#  Tue Oct 17 12:37:39 2017 +0200
# Node ID e634131ba39fa08d292675ca73a6c0cf8cb2588b
# Parent  1d6e6f7bf4dd82ebb78e5c5934c8ddf370dfec86
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
e634131ba39f
bookmark: introduce in advance a variant of the exchange test

We are about to introduce a new way to push bookmark to server. We introduce
the test variant before actually updating the exchange to help the output
changes to stand out when it happens.

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -1,3 +1,4 @@
+#testcases b2-pushkey b2-binary
 #require serve
 
   $ cat << EOF >> $HGRCPATH
@@ -103,6 +104,9 @@ export bookmark by name
 delete a remote bookmark
 
   $ hg book -d W
+
+#if b2-pushkey
+
   $ hg push -B W ../a --config "$TESTHOOK" --debug --config 
devel.bundle2.debug=yes
   pushing to ../a
   query 1; heads
@@ -212,6 +216,120 @@ delete a remote bookmark
   listing keys for "phases"
   [1]
 
+#endif
+#if b2-binary
+
+  $ hg push -B W ../a --config "$TESTHOOK" --debug --config 
devel.bundle2.debug=yes
+  pushing to ../a
+  query 1; heads
+  searching for changes
+  all remote heads known locally
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
+  no changes found
+  bundle2-output-bundle: "HG20", 4 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "replycaps"
+  bundle2-output-part: "replycaps" 195 bytes payload
+  bundle2-output: part 0: "REPLYCAPS"
+  bundle2-output: header chunk size: 16
+  bundle2-output: payload chunk size: 195
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:bookmarks"
+  bundle2-output-part: "check:bookmarks" 23 bytes payload
+  bundle2-output: part 1: "CHECK:BOOKMARKS"
+  bundle2-output: header chunk size: 22
+  bundle2-output: payload chunk size: 23
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:phases"
+  bundle2-output-part: "check:phases" 48 bytes payload
+  bundle2-output: part 2: "CHECK:PHASES"
+  bundle2-output: header chunk size: 19
+  bundle2-output: payload chunk size: 48
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "pushkey"
+  bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload
+  bundle2-output: part 3: "PUSHKEY"
+  bundle2-output: header chunk size: 90
+  bundle2-output: closing payload chunk
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: with-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 16
+  bundle2-input: part type: "REPLYCAPS"
+  bundle2-input: part id: "0"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part replycaps
+  bundle2-input-part: "replycaps" supported
+  bundle2-input: payload chunk size: 195
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 195
+  bundle2-input: part header size: 22
+  bundle2-input: part type: "CHECK:BOOKMARKS"
+  bundle2-input: part id: "1"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:bookmarks
+  bundle2-input-part: "check:bookmarks" supported
+  bundle2-input: payload chunk size: 23
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 23
+  bundle2-input: part header size: 19
+  bundle2-input: part type: "CHECK:PHASES"
+  bundle2-input: part id: "2"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:phases
+  bundle2-input-part: "check:phases" supported
+  bundle2-input: payload chunk size: 48
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 48
+  bundle2-input: part header size: 90
+  bundle2-input: part type: "PUSHKEY"
+  bundle2-input: part id: "3"
+  bundle2-input: part parameters: 4
+  bundle2-input: found a handler for part pushkey
+  bundle2-input-part: "pushkey" (params: 4 mandatory) supported
+  pushing key for "bookmarks:W"
+  bundle2-input: payload chunk size: 0
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 3 parts total
+  running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
+  test-hook-bookmark: W:   -> 
+  bundle2-output-bundle: "HG20", 1 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "reply:pushkey"
+  bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty 

[PATCH 06 of 15 V2] bookmark: introduce a 'bookmarks' part

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508083331 -7200
#  Sun Oct 15 18:02:11 2017 +0200
# Node ID 8c03b055c85e73058e11df7f802860bd47c7d7df
# Parent  d8b0dccd1281582764e0dfd643f730fa35f38246
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
8c03b055c85e
bookmark: introduce a 'bookmarks' part

This part can carry and apply bookmarks information. We start with adding the
core behavior of the part. In its current form, the part is only suitable for
push since it plain update the bookmark without consideration for the local
state. Support of the behavior needed for pulling will be added in later
changesets.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1891,6 +1891,21 @@ def handlepushkey(op, inpart):
 kwargs[key] = inpart.params[key]
 raise error.PushkeyFailed(partid=str(inpart.id), **kwargs)
 
+@parthandler('bookmarks')
+def handlebookmark(op, inpart):
+"""transmit bookmark information
+
+The part contains binary encoded bookmark information. The bookmark
+information is applied as is to the unbundling repository. Make sure a
+'check:bookmarks' part is issued earlier to check for race condition in
+such update.
+
+This behavior is suitable for pushing. Semantic adjustment will be needed
+for pull.
+"""
+changes = bookmarks.binarydecode(inpart)
+op.repo._bookmarks.applychanges(op.repo, op.gettransaction(), changes)
+
 @parthandler('phase-heads')
 def handlephases(op, inpart):
 """apply phases from bundle part to repo"""
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 08 of 15 V2] push: move bundle2-pushkey based bookmarks exchange in its own function

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508088176 -7200
#  Sun Oct 15 19:22:56 2017 +0200
# Node ID 1d6e6f7bf4dd82ebb78e5c5934c8ddf370dfec86
# Parent  3ac21e61b800b660eaf2835eb44ef8d216a92025
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
1d6e6f7bf4dd
push: move bundle2-pushkey based bookmarks exchange in its own function

We are about to introduce an alternative way to push bookmark over bundle2.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -896,8 +896,10 @@ def _pushb2bookmarks(pushop, bundler):
 if 'bookmarks' in pushop.stepsdone:
 return
 b2caps = bundle2.bundle2caps(pushop.remote)
-if 'pushkey' not in b2caps:
-return
+if 'pushkey' in b2caps:
+return _pushb2bookmarkspushkey(pushop, bundler)
+
+def _pushb2bookmarkspushkey(pushop, bundler):
 pushop.stepsdone.add('bookmarks')
 part2book = []
 enc = pushkey.encode
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 01 of 15 V2] pull: store binary node in pullop.remotebookmarks

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508230905 -7200
#  Tue Oct 17 11:01:45 2017 +0200
# Node ID 8c9a9eecdcd61401a1604a08a5272f7dabd4b912
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
8c9a9eecdcd6
pull: store binary node in pullop.remotebookmarks

The internal representation of bookmark value is binary. The fact we stored
'hex' was an implementation detail from using pushkey.

We move the values in 'pullop.remotebookmarks' to binary before adding a way to
exchange bookmarks not based on pushkey.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3973,12 +3973,13 @@ def pull(ui, repo, source="default", **o
 # not ending up with the name of the bookmark because of a race
 # condition on the server. (See issue 4689 for details)
 remotebookmarks = other.listkeys('bookmarks')
+remotebookmarks = bookmarks.unhexlifybookmarks(remotebookmarks)
 pullopargs['remotebookmarks'] = remotebookmarks
 for b in opts['bookmark']:
 b = repo._bookmarks.expandname(b)
 if b not in remotebookmarks:
 raise error.Abort(_('remote bookmark %s not found!') % b)
-revs.append(remotebookmarks[b])
+revs.append(hex(remotebookmarks[b]))
 
 if revs:
 try:
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1348,7 +1348,8 @@ def _pullbookmarkbundle1(pullop):
 # all known bundle2 servers now support listkeys, but lets be nice with
 # new implementation.
 return
-pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
+books = pullop.remote.listkeys('bookmarks')
+pullop.remotebookmarks = bookmod.unhexlifybookmarks(books)
 
 
 @pulldiscovery('changegroup')
@@ -1459,7 +1460,7 @@ def _pullbundle2(pullop):
 # processing bookmark update
 for namespace, value in op.records['listkeys']:
 if namespace == 'bookmarks':
-pullop.remotebookmarks = value
+pullop.remotebookmarks = bookmod.unhexlifybookmarks(value)
 
 # bookmark data were either already there or pulled in the bundle
 if pullop.remotebookmarks is not None:
@@ -1552,7 +1553,6 @@ def _pullbookmarks(pullop):
 pullop.stepsdone.add('bookmarks')
 repo = pullop.repo
 remotebookmarks = pullop.remotebookmarks
-remotebookmarks = bookmod.unhexlifybookmarks(remotebookmarks)
 bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
  pullop.remote.url(),
  pullop.gettransaction,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 02 of 15 V2] bookmark: add methods to binary encode and decode bookmark values

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508072395 -7200
#  Sun Oct 15 14:59:55 2017 +0200
# Node ID 4d0c6772a81aa1e2b25f32f944563db1f33fd327
# Parent  8c9a9eecdcd61401a1604a08a5272f7dabd4b912
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
4d0c6772a81a
bookmark: add methods to binary encode and decode bookmark values

Coming new bundle2 parts related to bookmark will use a binary encoding. It
encodes a series of '(bookmark, node)' pairs. Bookmark name has a high enough
size limit to not be affected by issue5165. (64K length, we are well covered)

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -8,12 +8,14 @@
 from __future__ import absolute_import
 
 import errno
+import struct
 
 from .i18n import _
 from .node import (
 bin,
 hex,
 short,
+wdirid,
 )
 from . import (
 encoding,
@@ -550,6 +552,60 @@ def unhexlifybookmarks(marks):
 binremotemarks[name] = bin(node)
 return binremotemarks
 
+_binaryentry = struct.Struct('>20sH')
+
+def binaryencode(bookmarks):
+"""encode a '(bookmark, node)' iterable into a binary stream
+
+the binary format is:
+
+
+
+:node: is a 20 bytes binary node,
+:bookmark-length: an unsigned short,
+:bookmark-name: the name of the bookmark (of length )
+
+wdirid (all bits set) will be used as a special value for "missing"
+"""
+binarydata = []
+for book, node in bookmarks:
+if not node: # None or ''
+node = wdirid
+binarydata.append(_binaryentry.pack(node, len(book)))
+binarydata.append(book)
+return ''.join(binarydata)
+
+def binarydecode(stream):
+"""decode a binary stream into an '(bookmark, node)' iterable
+
+the binary format is:
+
+
+
+:node: is a 20 bytes binary node,
+:bookmark-length: an unsigned short,
+:bookmark-name: the name of the bookmark (of length ))
+
+wdirid (all bits set) will be used as a special value for "missing"
+"""
+entrysize = _binaryentry.size
+books = []
+while True:
+entry = stream.read(entrysize)
+if len(entry) < entrysize:
+if entry:
+raise error.Abort(_('bad bookmark stream'))
+break
+node, length = _binaryentry.unpack(entry)
+bookmark = stream.read(length)
+if len(bookmark) < length:
+if entry:
+raise error.Abort(_('bad bookmark stream'))
+if node == wdirid:
+node = None
+books.append((bookmark, node))
+return books
+
 def updatefromremote(ui, repo, remotemarks, path, trfunc, explicit=()):
 ui.debug("checking for updated bookmarks\n")
 localmarks = repo._bookmarks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 07 of 15 V2] bookmark: add pushkey hook compatiblity to the bundle2 part

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508234844 -7200
#  Tue Oct 17 12:07:24 2017 +0200
# Node ID 3ac21e61b800b660eaf2835eb44ef8d216a92025
# Parent  8c03b055c85e73058e11df7f802860bd47c7d7df
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
3ac21e61b800
bookmark: add pushkey hook compatiblity to the bundle2 part

Currently, pushing a bookmark update triggers a pushkey hooks. It is likely
that users in the wild use such hooks to control bookmark movement. Using a non
push-key mechanism to exchange bookmark means these hooks are no longer called,
possibly breaking existing users setup. So we add explicit call to the pushkey
hooks in the handling of the bundle2 part. This behavior can be disabled with a
new config knob: 'server.bookmarks-pushkey-compat'.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1904,7 +1904,31 @@ def handlebookmark(op, inpart):
 for pull.
 """
 changes = bookmarks.binarydecode(inpart)
-op.repo._bookmarks.applychanges(op.repo, op.gettransaction(), changes)
+
+tr = op.gettransaction()
+bookstore = op.repo._bookmarks
+
+pushkeycompat = op.repo.ui.configbool('server', 'bookmarks-pushkey-compat')
+if pushkeycompat:
+allhooks = []
+for book, node in changes:
+hookargs = tr.hookargs.copy()
+hookargs['pushkeycompat'] = '1'
+hookargs['namespace'] = 'bookmark'
+hookargs['key'] = book
+hookargs['old'] = nodemod.hex(bookstore.get(book, ''))
+hookargs['new'] = nodemod.hex(node if node is not None else '')
+allhooks.append(hookargs)
+for hookargs in allhooks:
+op.repo.hook('prepushkey', throw=True, **hookargs)
+
+bookstore.applychanges(op.repo, tr, changes)
+
+if pushkeycompat:
+def runhook():
+for hookargs in allhooks:
+op.repo.hook('prepushkey', **hookargs)
+op.repo._afterlock(runhook)
 
 @parthandler('phase-heads')
 def handlephases(op, inpart):
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -745,6 +745,9 @@ coreconfigitem('progress', 'width',
 coreconfigitem('push', 'pushvars.server',
 default=False,
 )
+coreconfigitem('server', 'bookmarks-pushkey-compat',
+default=True,
+)
 coreconfigitem('server', 'bundle1',
 default=True,
 )
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1723,6 +1723,14 @@ Alias definitions for revsets. See :hg:`
 
 Controls generic server settings.
 
+``bookmarks-pushkey-compat``
+Trigger pushkey hook when being pushed bookmark updates. This config exist
+for compatibility purpose (default to True)
+
+If you use ``pushkey`` and ``pre-pushkey`` hooks to control bookmark
+movement we recommend you migrate them to ``txnclose-bookmark`` and
+``pretxnclose-bookmark``.
+
 ``compressionengines``
 List of compression engines and their relative priority to advertise
 to clients.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 05 of 15 V2] push: include a 'check:bookmarks' part when possible

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508087407 -7200
#  Sun Oct 15 19:10:07 2017 +0200
# Node ID d8b0dccd1281582764e0dfd643f730fa35f38246
# Parent  71c59800667fd81b3e13d10f418ee8876a8ddf74
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
d8b0dccd1281
push: include a 'check:bookmarks' part when possible

Before updating the actual bookmark update, we can start with updating the way
we check for push race. Checking bookmarks state earlier is useful even if we
still use pushkey. Aborting before the changegroup is added can save a lot of
time.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1390,6 +1390,7 @@ class unbundlepart(unpackermixin):
 # These are only the static capabilities.
 # Check the 'getrepocaps' function for the rest.
 capabilities = {'HG20': (),
+'bookmarks': (),
 'error': ('abort', 'unsupportedcontent', 'pushraced',
   'pushkey'),
 'listkeys': (),
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -13,6 +13,7 @@ import hashlib
 
 from .i18n import _
 from .node import (
+bin,
 hex,
 nullid,
 )
@@ -742,6 +743,22 @@ def _pushing(pushop):
 or pushop.outobsmarkers
 or pushop.outbookmarks)
 
+@b2partsgenerator('check-bookmarks')
+def _pushb2checkbookmarks(pushop, bundler):
+"""insert bookmark move checking"""
+if not _pushing(pushop) or pushop.force:
+return
+b2caps = bundle2.bundle2caps(pushop.remote)
+hasbookmarkcheck = 'bookmarks' in b2caps
+if not (pushop.outbookmarks and hasbookmarkcheck):
+return
+data = []
+for book, old, new in pushop.outbookmarks:
+old = bin(old)
+data.append((book, old))
+checkdata = bookmod.binaryencode(data)
+bundler.newpart('check:bookmarks', data=checkdata)
+
 @b2partsgenerator('check-phases')
 def _pushb2checkphases(pushop, bundler):
 """insert phase move checking"""
diff --git a/tests/test-acl.t b/tests/test-acl.t
--- a/tests/test-acl.t
+++ b/tests/test-acl.t
@@ -93,14 +93,14 @@ Extension disabled for lack of a hook
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -156,14 +156,14 @@ Extension disabled for lack of acl.sourc
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -222,14 +222,14 @@ No [acl.allow]/[acl.deny]
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
   bundle2-output-bundle: "HG20", 5 parts total
-  bundle2-output-part: "replycaps" 168 bytes payload
+  bundle2-output-part: "replycaps" 178 bytes payload
   bundle2-output-part: "check:phases" 24 bytes payload
   bundle2-output-part: "check:heads" streamed payload
   bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
   bundle2-output-part: "phase-heads" 24 bytes payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
-  bundle2-input-part: total payload size 168
+  bundle2-input-part: total payload size 178
   bundle2-input-part: "check:phases" supported
   bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
@@ -298,14 +298,14 @@ Empty [acl.allow]
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   

[PATCH 04 of 15 V2] bookmark: use bundle2 debug output in one push tests

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508073707 -7200
#  Sun Oct 15 15:21:47 2017 +0200
# Node ID 71c59800667fd81b3e13d10f418ee8876a8ddf74
# Parent  d9c0b8c5d92f97ba3fb32cd6d819258a39a27e63
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
71c59800667f
bookmark: use bundle2 debug output in one push tests

Having more details about the push process will help to track changes made to
the actual exchange.

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -103,12 +103,98 @@ export bookmark by name
 delete a remote bookmark
 
   $ hg book -d W
-  $ hg push -B W ../a --config "$TESTHOOK"
+  $ hg push -B W ../a --config "$TESTHOOK" --debug --config 
devel.bundle2.debug=yes
   pushing to ../a
+  query 1; heads
   searching for changes
+  all remote heads known locally
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
   no changes found
+  bundle2-output-bundle: "HG20", 3 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "replycaps"
+  bundle2-output-part: "replycaps" 185 bytes payload
+  bundle2-output: part 0: "REPLYCAPS"
+  bundle2-output: header chunk size: 16
+  bundle2-output: payload chunk size: 185
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "check:phases"
+  bundle2-output-part: "check:phases" 48 bytes payload
+  bundle2-output: part 1: "CHECK:PHASES"
+  bundle2-output: header chunk size: 19
+  bundle2-output: payload chunk size: 48
+  bundle2-output: closing payload chunk
+  bundle2-output: bundle part: "pushkey"
+  bundle2-output-part: "pushkey" (params: 4 mandatory) empty payload
+  bundle2-output: part 2: "PUSHKEY"
+  bundle2-output: header chunk size: 90
+  bundle2-output: closing payload chunk
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: with-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 16
+  bundle2-input: part type: "REPLYCAPS"
+  bundle2-input: part id: "0"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part replycaps
+  bundle2-input-part: "replycaps" supported
+  bundle2-input: payload chunk size: 185
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 185
+  bundle2-input: part header size: 19
+  bundle2-input: part type: "CHECK:PHASES"
+  bundle2-input: part id: "1"
+  bundle2-input: part parameters: 0
+  bundle2-input: found a handler for part check:phases
+  bundle2-input-part: "check:phases" supported
+  bundle2-input: payload chunk size: 48
+  bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 48
+  bundle2-input: part header size: 90
+  bundle2-input: part type: "PUSHKEY"
+  bundle2-input: part id: "2"
+  bundle2-input: part parameters: 4
+  bundle2-input: found a handler for part pushkey
+  bundle2-input-part: "pushkey" (params: 4 mandatory) supported
+  pushing key for "bookmarks:W"
+  bundle2-input: payload chunk size: 0
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 2 parts total
+  running hook txnclose-bookmark.test: sh $TESTTMP/hook.sh
   test-hook-bookmark: W:   -> 
+  bundle2-output-bundle: "HG20", 1 parts total
+  bundle2-output: start emission of HG20 stream
+  bundle2-output: bundle parameter: 
+  bundle2-output: start of parts
+  bundle2-output: bundle part: "reply:pushkey"
+  bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload
+  bundle2-output: part 0: "REPLY:PUSHKEY"
+  bundle2-output: header chunk size: 43
+  bundle2-output: closing payload chunk
+  bundle2-output: end of bundle
+  bundle2-input: start processing of HG20 stream
+  bundle2-input: reading bundle2 stream parameters
+  bundle2-input-bundle: no-transaction
+  bundle2-input: start extraction of bundle2 parts
+  bundle2-input: part header size: 43
+  bundle2-input: part type: "REPLY:PUSHKEY"
+  bundle2-input: part id: "0"
+  bundle2-input: part parameters: 2
+  bundle2-input: found a handler for part reply:pushkey
+  bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported
+  bundle2-input: payload chunk size: 0
+  bundle2-input: part header size: 0
+  bundle2-input: end of bundle2 stream
+  bundle2-input-bundle: 0 parts total
   deleting remote bookmark W
+  listing keys for "phases"
   [1]
 
 export the active bookmark
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 15 V2] bookmark: add a 'check:bookmarks' bundle2 part

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508072463 -7200
#  Sun Oct 15 15:01:03 2017 +0200
# Node ID d9c0b8c5d92f97ba3fb32cd6d819258a39a27e63
# Parent  4d0c6772a81aa1e2b25f32f944563db1f33fd327
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
d9c0b8c5d92f
bookmark: add a 'check:bookmarks' bundle2 part

This part checks that bookmarks are still at the node they are expected to be.
This allows a pushing client to detect push race where the repository was
updated between the time it discovered the server state and the time it managed
to finish its push.

Such checking already exists when pushing bookmark through pushkey. This new
part can be inserted at the beginning of the bundle, triggering abort earlier.
In addition, we would like to move away from pushey to push bookmark. A step
useful to solve issue5165.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -155,6 +155,7 @@ import sys
 
 from .i18n import _
 from . import (
+bookmarks,
 changegroup,
 error,
 node as nodemod,
@@ -1702,6 +1703,34 @@ def handlereplychangegroup(op, inpart):
 replyto = int(inpart.params['in-reply-to'])
 op.records.add('changegroup', {'return': ret}, replyto)
 
+@parthandler('check:bookmarks')
+def handlecheckbookmarks(op, inpart):
+"""check location of bookmarks
+
+This part is to be used to detect push race regarding bookmark, it
+contains binary encoded (bookmark, node) tuple. If the local state does
+not marks the one in the part, a PushRaced exception is raised
+"""
+bookdata = bookmarks.binarydecode(inpart)
+
+msgstandard = ('repository changed while pushing - please try again '
+   '(bookmark "%s" move from %s to %s)')
+msgmissing = ('repository changed while pushing - please try again '
+  '(bookmark "%s" is missing, expected %s)')
+msgexist = ('repository changed while pushing - please try again '
+'(bookmark "%s" set on %s, expected missing)')
+for book, node in bookdata:
+currentnode = op.repo._bookmarks.get(book)
+if currentnode != node:
+if node is None:
+finalmsg = msgexist % (book, nodemod.short(currentnode))
+elif currentnode is None:
+finalmsg = msgmissing % (book, nodemod.short(node))
+else:
+finalmsg = msgstandard % (book, nodemod.short(node),
+  nodemod.short(currentnode))
+raise error.PushRaced(finalmsg)
+
 @parthandler('check:heads')
 def handlecheckheads(op, inpart):
 """check that head of the repo did not change
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] obsfate: makes successorsetverb takes the markers as argument

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508409347 -7200
#  Thu Oct 19 12:35:47 2017 +0200
# Node ID b5b9f31a676701ca272c10fc2630e4587413e4e7
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic fix-obsfate
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
b5b9f31a6767
obsfate: makes successorsetverb takes the markers as argument

Right now, successorsetverb only needs successors to compute the verb. But we
will want use additional information (effect-flags and operation) in the near
future to compute a better verb.

Add the markers parameter now so extensions (like Evolve) could wrap the
function and start experimenting around better obsfate verbs.

As successorsetverb now takes both successorset and markers parameters, rename
it to obsfateverb, successorsetandmarkersverb was too long.

Differential Revision: https://phab.mercurial-scm.org/D1191

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -751,8 +751,9 @@ def successorsandmarkers(repo, ctx):
 
 return values
 
-def successorsetverb(successorset):
-""" Return the verb summarizing the successorset
+def obsfateverb(successorset, markers):
+""" Return the verb summarizing the successorset and potentially using
+information from the markers
 """
 if not successorset:
 verb = 'pruned'
@@ -795,7 +796,7 @@ def obsfateprinter(successors, markers, 
 line = []
 
 # Verb
-line.append(successorsetverb(successors))
+line.append(obsfateverb(successors, markers))
 
 # Operations
 operations = markersoperations(markers)
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1005,17 +1005,18 @@ def obsfateusers(context, mapping, args)
 "obsmakers")
 raise error.ParseError(msg)
 
-@templatefunc('obsfateverb(successors)')
+@templatefunc('obsfateverb(successors, markers)')
 def obsfateverb(context, mapping, args):
 """Compute obsfate related information based on successors 
(EXPERIMENTAL)"""
-if len(args) != 1:
+if len(args) != 2:
 # i18n: "obsfateverb" is a keyword
-raise error.ParseError(_("obsfateverb expects one arguments"))
+raise error.ParseError(_("obsfateverb expects two arguments"))
 
 successors = evalfuncarg(context, mapping, args[0])
+markers = evalfuncarg(context, mapping, args[1])
 
 try:
-return obsutil.successorsetverb(successors)
+return obsutil.obsfateverb(successors, markers)
 except TypeError:
 # i18n: "obsfateverb" is a keyword
 errmsg = _("obsfateverb first argument should be countable")
diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -13,7 +13,7 @@ Global setup
   > evolution=true
   > [templates]
   > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
-  > obsfateverb = "{obsfateverb(successors)}"
+  > obsfateverb = "{obsfateverb(successors, markers)}"
   > obsfateoperations = "{if(obsfateoperations(markers), " using 
{join(obsfateoperations(markers), ", ")}")}"
   > obsfateusers = "{if(obsfateusers(markers), " by 
{join(obsfateusers(markers), ", ")}")}"
   > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), 
max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " 
(between {min(obsfatedate(markers))|isodate} and 
{max(obsfatedate(markers))|isodate})")}")}"
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] obsolete: activate effect-flag by default

2017-11-02 Thread Yuya Nishihara
On Thu, 02 Nov 2017 10:40:40 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1509552513 -3600
> #  Wed Nov 01 17:08:33 2017 +0100
> # Node ID 89a2f069e47da9701bef9ae1b937000f7293c255
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> # EXP-Topic effect-flag-default-on
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 89a2f069e47d
> obsolete: activate effect-flag by default
> 
> Let's activate effect-flag by default as Evolve is experimental and in order
> to gather feedback from users.

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


Re: [PATCH 1 of 2] debug: add a debugcapabilities commands

2017-11-02 Thread Yuya Nishihara
On Thu, 02 Nov 2017 10:43:11 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1509379696 -3600
> #  Mon Oct 30 17:08:16 2017 +0100
> # Node ID dbbc24ac042afccea32d4ba05a887bf2040de5ca
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> # EXP-Topic debugcap
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> dbbc24ac042a
> debug: add a debugcapabilities commands

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


Re: [PATCH RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Yuya Nishihara
On Thu, 2 Nov 2017 10:03:44 +0100, Denis Laxalde wrote:
> Augie Fackler a écrit :
> > # HG changeset patch
> > # User Augie Fackler 
> > # Date 1509399967 14400
> > #  Mon Oct 30 17:46:07 2017 -0400
> > # Node ID a2fc2086ac3116c63ab890180697b2695c50d9f4
> > # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> > revert: no longer mark --interactive as experimental
> > 
> > We seem to have settled down on behavior changes here (nothing
> > matching revset `keyword(revert) and keyword(interactive)` since 4.2
> > was released), so let's go ahead and advertise this excellent feature.
> 
> +1

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


Re: [PATCH] ui: add configlist doctest to document a bit more of the whitespace behavior

2017-11-02 Thread Yuya Nishihara
On Wed, 01 Nov 2017 19:31:49 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler 
> # Date 1508986914 14400
> #  Wed Oct 25 23:01:54 2017 -0400
> # Node ID 7e5b4ce0c445d4fc8f906f6926c71163a27c85a2
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> ui: add configlist doctest to document a bit more of the whitespace behavior

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


D1270: help: adding a topic on flags

2017-11-02 Thread av6 (Anton Shestakov)
av6 added inline comments.

INLINE COMMENTS

> flags.txt:7
> +Mercurial command-line flags can be strings, numbers, booleans, or lists of
> +strings.
> +

This "lists of strings" caught my attention, but it took me some time to figure 
out what's the matter. I don't feel strongly, but here are some points:

1. it's not clear what a "list of strings" is and how to specify it: is it a 
comma-separated list?
2. it's not a type that //one// command-line flag can take (i.e. no 
`--flag=foo,bar` or anything), you must use multiple flags on command line to 
build this list, so it's unlike the 3 previous types
3. I don't think we have anywhere (in the code) a list of integers or booleans 
right now, but nothing prevents this in future, or in an extension

I think this data type is a result of looking at the internals that allow some 
python variables (associated with handling command line flags in the code) to 
be lists, but because our CLI is not python, this phrase is more distracting 
than helpful. I think taking the note that's in `hg help` and explaining it is 
better: "[+] can be repeated" (essentially merging "​Specifying list flags" and 
"Overriding flag defaults").

> flags.txt:35
> +
> +For more information on hgrc files, see :hg:help:config.
> +

This is a weird-looking macro. Does it work when rendered into e.g. HTML (can 
be seen hgweb)? I've only seen this format:

  :hg:`help config`

> flags.txt:49
> +Some flags are not shown in a command's help by default - specifically, those
> +that are deemed to be experimental, deprecated or advanced. To show all 
> flags,
> +add the --verbose flag for the help command::

There are also global flags, they are hidden by default too. I guess you can 
put them into these 3 categories, but I don't think of --quiet or --verbose as 
advanced (much less experimental or deprecated). Just a nitpick.

REPOSITORY
  rHG Mercurial

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

To: rdamazio, #hg-reviewers
Cc: av6, dlax, martinvonz, 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] strip: strip obsmarkers exclusive to the stripped changeset

2017-11-02 Thread Mathias De Maré


On 01-06-17 15:39, Pierre-Yves David wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 149528 -7200
#  Sat May 20 16:19:59 2017 +0200
# Node ID fb16a4d85cf46afbc12bb61f8d22784cef31d1dc
# Parent  2c44bd45fdeeb3a8bf1762af4a81af3914fadc29
# EXP-Topic obsstrip
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#  hg pull 
https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r fb16a4d85cf4
strip: strip obsmarkers exclusive to the stripped changeset

This is it, `hg strip --rev X` will now also remove obsolescence markers
exclusive to X. Since a previous changeset, the obsmarkers has been backed up
in the strip backup bundle, so it is possible to restore them.

Note: stripping obsmarkers means the precursors of the stripped changeset might 
no
longer be obsolete after the strip.

Stripping changeset without obsmarkers can be useful when building test case. So
It is possible to disable the stripping of obsmarkers using the
'devel.strip-obsmarkers' config option.

Test change have been carefully validated.


We recently upgrade to 4.3.3, and received some user complaints about 
this change.
They used 'hg strip' to remove in-development changesets they no longer 
need. This could be solved by having 'hg prune' in Mercurial itself (we 
don't have evolve enabled for our users). Unless there is already an 
alternative present?


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


[PATCH 1 of 2] debug: add a debugcapabilities commands

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1509379696 -3600
#  Mon Oct 30 17:08:16 2017 +0100
# Node ID dbbc24ac042afccea32d4ba05a887bf2040de5ca
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic debugcap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
dbbc24ac042a
debug: add a debugcapabilities commands

This new debugcommand prints the capabilities of any remote in a human friendly
way. Improved bundle2 capabilities support will be introduced in the next
changesets.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -360,6 +360,16 @@ def debugbundle(ui, bundlepath, all=None
 return _debugbundle2(ui, gen, all=all, **opts)
 _debugchangegroup(ui, gen, all=all, **opts)
 
+@command('debugcapabilities',
+[], _('PATH'),
+norepo=True)
+def debugcapabilities(ui, path, **opts):
+"""lists the capabilities of a remote peer"""
+peer = hg.peer(ui, opts, path)
+caps = peer.capabilities()
+ui.write(('Main capabilities:\n'))
+for c in sorted(caps):
+ui.write(('  %s\n') % c)
 @command('debugcheckstate', [], '')
 def debugcheckstate(ui, repo):
 """validate the correctness of the current dirstate"""
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -72,6 +72,7 @@ Show debug commands if there are no othe
   debugapplystreamclonebundle
   debugbuilddag
   debugbundle
+  debugcapabilities
   debugcheckstate
   debugcolor
   debugcommands
@@ -249,6 +250,7 @@ Show all commands + options
   debugapplystreamclonebundle: 
   debugbuilddag: mergeable-file, overwritten-file, new-file
   debugbundle: all, part-type, spec
+  debugcapabilities: 
   debugcheckstate: 
   debugcolor: style
   debugcommands: 
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -156,3 +156,15 @@ Test internal debugstacktrace command
   from h hidden in g at:
debugstacktrace.py:6 in f
debugstacktrace.py:9 in g
+
+Test debugcapabilities command:
+
+  $ hg debugcapabilities ./debugrevlog/
+  Main capabilities:
+branchmap
+
bundle2=HG20%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Aphases%3Dheads%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps
+getbundle
+known
+lookup
+pushkey
+unbundle
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -895,6 +895,8 @@ Test list of internal help commands
  builds a repo with a given DAG from scratch in the current
  empty repo
debugbundle   lists the contents of a bundle
+   debugcapabilities
+ lists the capabilities of a remote peer
debugcheckstate
  validate the correctness of the current dirstate
debugcolorshow available color, effects or style
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] debug: print parsed bundle2 capabilities with debugcapabilities

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1509379769 -3600
#  Mon Oct 30 17:09:29 2017 +0100
# Node ID d70fcb439e0b72e4124d209554be599952b85651
# Parent  dbbc24ac042afccea32d4ba05a887bf2040de5ca
# EXP-Topic debugcap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
d70fcb439e0b
debug: print parsed bundle2 capabilities with debugcapabilities

The bundle2 capabilities are hard to read in their encoded form. We parse and
print them in a human friendly way.

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -370,6 +370,14 @@ def debugcapabilities(ui, path, **opts):
 ui.write(('Main capabilities:\n'))
 for c in sorted(caps):
 ui.write(('  %s\n') % c)
+b2caps = bundle2.bundle2caps(peer)
+if b2caps:
+ui.write(('Bundle2 capabilities:\n'))
+for key, values in sorted(b2caps.iteritems()):
+ui.write(('  %s\n') % key)
+for v in values:
+ui.write(('%s\n') % v)
+
 @command('debugcheckstate', [], '')
 def debugcheckstate(ui, repo):
 """validate the correctness of the current dirstate"""
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -168,3 +168,25 @@ Test debugcapabilities command:
 lookup
 pushkey
 unbundle
+  Bundle2 capabilities:
+HG20
+changegroup
+  01
+  02
+digests
+  md5
+  sha1
+  sha512
+error
+  abort
+  unsupportedcontent
+  pushraced
+  pushkey
+hgtagsfnodes
+listkeys
+phases
+  heads
+pushkey
+remote-changegroup
+  http
+  https
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] obsolete: activate effect-flag by default

2017-11-02 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1509552513 -3600
#  Wed Nov 01 17:08:33 2017 +0100
# Node ID 89a2f069e47da9701bef9ae1b937000f7293c255
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic effect-flag-default-on
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
89a2f069e47d
obsolete: activate effect-flag by default

Let's activate effect-flag by default as Evolve is experimental and in order
to gather feedback from users.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -376,7 +376,7 @@ coreconfigitem('experimental', 'evolutio
 default=None,
 )
 coreconfigitem('experimental', 'evolution.effect-flags',
-default=False,
+default=True,
 alias=[('experimental', 'effect-flags')]
 )
 coreconfigitem('experimental', 'evolution.exchange',
diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -203,8 +203,8 @@ Checking the note stored in the obsmarke
   [255]
   $ hg amend --note "adding bar"
   $ hg debugobsolete -r .
-  112478962961147124edd43549aedd1a335e44bf 
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'amend', 'user': 'test'}
-  be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 
16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +) 
{'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
+  112478962961147124edd43549aedd1a335e44bf 
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'operation': 'amend', 'user': 'test'}
+  be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 
16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
 #endif
 
 Cannot amend public changeset
diff --git a/tests/test-drawdag.t b/tests/test-drawdag.t
--- a/tests/test-drawdag.t
+++ b/tests/test-drawdag.t
@@ -227,11 +227,11 @@ Create obsmarkers via comments
   o  A 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
   
   $ hg debugobsolete
-  112478962961147124edd43549aedd1a335e44bf 
7fb047a69f220c21711122dfd94305a9efb60cba 
64a8289d249234b9886244d379f15e6b650b28e3 
711f53bbef0bebd12eb6f0511d5e2e998b984846 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'split', 'user': 'test'}
-  26805aba1e600a82e93661149f2313866a221a7b 
be0ef73c17ade3fc89dc41701eb9fc3a91b58282 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'replace', 'user': 'test'}
-  be0ef73c17ade3fc89dc41701eb9fc3a91b58282 
575c4b5ec114d64b681d33f8792853568bfb2b2c 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'replace', 'user': 'test'}
-  64a8289d249234b9886244d379f15e6b650b28e3 0 
{7fb047a69f220c21711122dfd94305a9efb60cba} (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'prune', 'user': 'test'}
-  58e6b987bf7045fcd9c54f496396ca1d1fc81047 0 
{575c4b5ec114d64b681d33f8792853568bfb2b2c} (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'prune', 'user': 'test'}
+  112478962961147124edd43549aedd1a335e44bf 
7fb047a69f220c21711122dfd94305a9efb60cba 
64a8289d249234b9886244d379f15e6b650b28e3 
711f53bbef0bebd12eb6f0511d5e2e998b984846 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'split', 'user': 'test'}
+  26805aba1e600a82e93661149f2313866a221a7b 
be0ef73c17ade3fc89dc41701eb9fc3a91b58282 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '9', 'operation': 'replace', 'user': 'test'}
+  be0ef73c17ade3fc89dc41701eb9fc3a91b58282 
575c4b5ec114d64b681d33f8792853568bfb2b2c 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'replace', 'user': 'test'}
+  64a8289d249234b9886244d379f15e6b650b28e3 0 
{7fb047a69f220c21711122dfd94305a9efb60cba} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'prune', 'user': 'test'}
+  58e6b987bf7045fcd9c54f496396ca1d1fc81047 0 
{575c4b5ec114d64b681d33f8792853568bfb2b2c} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'prune', 'user': 'test'}
 
 Change file contents via comments
 
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -51,9 +51,9 @@ Test that histedit learns about obsolesc
   o  0:cb9a9f314b8b a
   
   $ hg debugobsolete
-  e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 
49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'amend', 'user': 'test'}
-  1b2d564fad96311b45362f17c2aa855150efb35f 
46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'histedit', 'user': 'test'}
-  114f4176969ef342759a8a57e6bccefc4234829b 
49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +) 
{'operation': 'histedit', 'user': 'test'}
+  e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 
49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'operation': 'amend', 

Re: [PATCH RFC] revert: no longer mark --interactive as experimental

2017-11-02 Thread Denis Laxalde

Augie Fackler a écrit :

# HG changeset patch
# User Augie Fackler 
# Date 1509399967 14400
#  Mon Oct 30 17:46:07 2017 -0400
# Node ID a2fc2086ac3116c63ab890180697b2695c50d9f4
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
revert: no longer mark --interactive as experimental

We seem to have settled down on behavior changes here (nothing
matching revset `keyword(revert) and keyword(interactive)` since 4.2
was released), so let's go ahead and advertise this excellent feature.


+1


.. feature:: revert --interactive

   The revert command now accepts the flag --interactive to allow reverting
   only some of the changes to the specified files.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4517,8 +4517,7 @@ def resolve(ui, repo, *pats, **opts):
  ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
  ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
  ('C', 'no-backup', None, _('do not save backup copies of files')),
-('i', 'interactive', None,
-_('interactively select the changes (EXPERIMENTAL)')),
+('i', 'interactive', None, _('interactively select the changes')),
  ] + walkopts + dryrunopts,
  _('[OPTION]... [-r REV] [NAME]...'))
  def revert(ui, repo, *pats, **opts):

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