D949: run-tests: set HGPLAIN=1 when bisecting

2017-10-16 Thread quark (Jun Wu)
quark updated this revision to Diff 2890.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D949?vs=2450&id=2890

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2104,8 +2104,10 @@
 if bisectrepo:
 bisectcmd.extend(['-R', os.path.abspath(bisectrepo)])
 def pread(args):
+env = os.environ.copy()
+env['HGPLAIN'] = '1'
 p = subprocess.Popen(args, stderr=subprocess.STDOUT,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE, env=env)
 data = p.stdout.read()
 p.wait()
 return data



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


D1044: bisect: add --abort flag

2017-10-16 Thread quark (Jun Wu)
quark abandoned this revision.
quark added a comment.


  In https://phab.mercurial-scm.org/D1044#18824, @durin42 wrote:
  
  > I'm confused what you think the state of this is: the proximate goal of 
this series (as I understood it!) was to get run-tests able to restore to an 
original revision after doing its bisection, a goal which I wholeheartedly 
endorse.
  
  
  This series fixes other things, like the run-tests.py bisect does not work 
with a customized `log` template.
  
  > While I also agree that some built-in-to-bisect mechanism for "take be back 
where I was before bisection began" probably makes sense, 
  >  I disagree that it should be named --abort.
  
  I'd like to make it a built-in bisect feature so `run-tests.py` does not need 
to implement the feature using a less reliable (shell script) way.
  
  It's unlikely to reach an agreement about how (what flags or revsets) to 
implement it before the freeze. Therefore I'm abandoning these two patches.
  
  > I've not looked at any of the earlier diffs in the series because @ryanmce 
requested changes, so much like a commented V1 on the list, I wasn't going to 
spend time on them until you sent a V2 (aka updated the diff, or otherwise 
cleared the "changes requested" state.) Does that make sense? I'm happy to land 
947-949 assuming they're ready to go, but it looks like at least 948 needs some 
minor indentation cleanup?
  
  I don't think @ryanmce requested changes fairly for the 1st and 3rd patch. 
I've pushed back.

REPOSITORY
  rHG Mercurial

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

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


D948: run-tests: extract Popen logic to a single method

2017-10-16 Thread quark (Jun Wu)
quark updated this revision to Diff 2889.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D948?vs=2449&id=2889

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2103,29 +2103,25 @@
 bisectrepo = self._runner.options.bisect_repo
 if bisectrepo:
 bisectcmd.extend(['-R', os.path.abspath(bisectrepo)])
-def nooutput(args):
+def pread(args):
 p = subprocess.Popen(args, stderr=subprocess.STDOUT,
  stdout=subprocess.PIPE)
-p.stdout.read()
+data = p.stdout.read()
 p.wait()
+return data
 for test in tests:
-nooutput(bisectcmd + ['--reset']),
-nooutput(bisectcmd + ['--bad', '.'])
-nooutput(bisectcmd + ['--good',
-  self._runner.options.known_good_rev])
+pread(bisectcmd + ['--reset']),
+pread(bisectcmd + ['--bad', '.'])
+pread(bisectcmd + ['--good', self._runner.options.known_good_rev])
 # TODO: we probably need to forward more options
 # that alter hg's behavior inside the tests.
 opts = ''
 withhg = self._runner.options.with_hg
 if withhg:
 opts += ' --with-hg=%s ' % shellquote(_strpath(withhg))
 rtc = '%s %s %s %s' % (sys.executable, sys.argv[0], opts,
test)
-sub = subprocess.Popen(bisectcmd + ['--command', rtc],
-   stderr=subprocess.STDOUT,
-   stdout=subprocess.PIPE)
-data = sub.stdout.read()
-sub.wait()
+data = pread(bisectcmd + ['--command', rtc])
 m = re.search(
 (br'\nThe first (?Pbad|good) revision '
  br'is:\nchangeset: +\d+:(?P[a-f0-9]+)\n.*\n'



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


D947: run-tests: move bisect logic to a separate method

2017-10-16 Thread quark (Jun Wu)
quark requested review of this revision.
quark added a comment.


  I don't think this patch needs change.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

2017-10-16 Thread Matt Harbison
On Tue, 17 Oct 2017 00:20:38 -0400, Matt Harbison   
wrote:


On Mon, 16 Oct 2017 10:00:32 -0400, Pulkit Goyal <7895pul...@gmail.com>  
wrote:


On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbison   
wrote:

# HG changeset patch
# User Matt Harbison 
# Date 1508122082 14400
#  Sun Oct 15 22:48:02 2017 -0400
# Node ID d0c2b68fedb27184337af6392ecc1f03dab39522
# Parent  718adb1bf3a9a1ee509a803c7512c14296a1db79
subrepo: share instead of clone if the parent repo is shared  
(issue5675) (BC)


Can you please add a releasenotes part to the commit message?
For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension


I took a run at it (probably not successfully- the command aborts, but  
check-code didn't complain).


$ hg --config extensions.releasenotes= releasenotes -r . rn.txt
abort: unexpected block in release notes directive fix


This went away after putting the 'and' line between the two annotations  
like Augie did in one of his commits.  That's pretty subtle- it would be  
nice if that requirement went away somehow.

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


[PATCH V2] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

2017-10-16 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1508122082 14400
#  Sun Oct 15 22:48:02 2017 -0400
# Node ID 7f5dd96256997c9ada54c969919abe8c6f3f970f
# Parent  22d774b9dbab4689b186afc8acbca3165cd2a660
subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

Previously, only the top level repo was shared, and then any subrepos were
cloned on demand.  This is problematic because commits to the parent repo would
write an updated .hgsubstate to the share source, but the corresponding subrepo
commit would be stuck in the local subrepo.  That would prevent an update in the
source repo.  We already go to great lengths to avoid having inconsistent repos
(e.g., `hg push -r rev` will push _everything_ in a subrepo, even if it isn't
referenced in one of the parent's outgoing commits).  Therefore, this seems like
a bug fix, and there's no option to get the old behavior.  I can't imagine the
previous behavior was useful to anybody.

There shouldn't be an issue with svn, since it is centralized.  Maybe --git-dir
can be used for git subrepos, but I'll leave that to someone more familiar with
git.

An integer was previously being implicitly returned from commands.share(), which
caused dispatch() to start crashing when changing over to returning the shared
repo.  All error paths appear to raise, so this can be hardcoded to success.
The clone command checks for 'is None' in a similar pattern, but since
hg.clone() always returns a tuple, that seems wrong?

.. fix:: Issue 5675

   Creating a share of a repository with a Mercurial subrepository will now
   share the subrepository.

and

.. bc::

   Mercurial subrepositories are now shared instead of cloned when the parent
   repository is shared.  This prevents dangling subrepository references in the
   share source.  Previously shared repositories with cloned subrepositories
   will continue to function unchanged.

diff --git a/hgext/share.py b/hgext/share.py
--- a/hgext/share.py
+++ b/hgext/share.py
@@ -100,8 +100,9 @@
the broken clone to reset it to a changeset that still exists.
 """
 
-return hg.share(ui, source, dest=dest, update=not noupdate,
-bookmarks=bookmarks, relative=relative)
+hg.share(ui, source, dest=dest, update=not noupdate,
+ bookmarks=bookmarks, relative=relative)
+return 0
 
 @command('unshare', [], '')
 def unshare(ui, repo):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -255,6 +255,7 @@
 r = repository(ui, destwvfs.base)
 postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath)
 _postshareupdate(r, update, checkout=checkout)
+return r
 
 def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
 """Called after a new shared repo is created.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -857,21 +857,32 @@
 
 def _get(self, state):
 source, revision, kind = state
+parentrepo = self._repo._subparent
+
 if revision in self._repo.unfiltered():
-return True
+# Allow shared subrepos tracked at null to setup the sharedpath
+if len(self._repo) != 0 or not parentrepo.shared():
+return True
 self._repo._subsource = source
 srcurl = _abssource(self._repo)
 other = hg.peer(self._repo, {}, srcurl)
 if len(self._repo) == 0:
-self.ui.status(_('cloning subrepo %s from %s\n')
-   % (subrelpath(self), srcurl))
-parentrepo = self._repo._subparent
 # use self._repo.vfs instead of self.wvfs to remove .hg only
 self._repo.vfs.rmtree()
-other, cloned = hg.clone(self._repo._subparent.baseui, {},
- other, self._repo.root,
- update=False)
-self._repo = cloned.local()
+if parentrepo.shared():
+self.ui.status(_('sharing subrepo %s from %s\n')
+   % (subrelpath(self), srcurl))
+shared = hg.share(self._repo._subparent.baseui,
+  other, self._repo.root,
+  update=False, bookmarks=False)
+self._repo = shared.local()
+else:
+self.ui.status(_('cloning subrepo %s from %s\n')
+   % (subrelpath(self), srcurl))
+other, cloned = hg.clone(self._repo._subparent.baseui, {},
+ other, self._repo.root,
+ update=False)
+self._repo = cloned.local()
 self._initrepo(parentrepo, source, create=True)
 self._cachestorehash(srcurl)
 else:
diff --git a/tests/test-archive.t b/tests/test-archive.t
--- a/tests/test-archive.t
+++ b/tests/test-archive.t

Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

2017-10-16 Thread Matt Harbison
On Mon, 16 Oct 2017 10:00:32 -0400, Pulkit Goyal <7895pul...@gmail.com>  
wrote:


On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbison   
wrote:

# HG changeset patch
# User Matt Harbison 
# Date 1508122082 14400
#  Sun Oct 15 22:48:02 2017 -0400
# Node ID d0c2b68fedb27184337af6392ecc1f03dab39522
# Parent  718adb1bf3a9a1ee509a803c7512c14296a1db79
subrepo: share instead of clone if the parent repo is shared  
(issue5675) (BC)


Can you please add a releasenotes part to the commit message?
For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension


I took a run at it (probably not successfully- the command aborts, but  
check-code didn't complain).


$ hg --config extensions.releasenotes= releasenotes -r . rn.txt
abort: unexpected block in release notes directive fix

Is there any way to get the location of the error?  (I know nothing about  
this format, so I'm not sure where to start.)



In trying to reproduce this on a revision that's not mine (and in fact  
doesn't have an annotation), I got this:


$ hg --config extensions.releasenotes= releasenotes -r cfb054a7ecc4 rn.txt
** Unknown exception encountered with possibly-broken third-party  
extension evolve

** which supports versions 4.2 of Mercurial.
** Please disable evolve and try your action again.
** If that fixes the bug please report it to https://bz.mercurial-scm.org/
** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500  
64 bit (AMD64)]

** Mercurial Distributed SCM (version 4.3-rc+4-ac3477dc1814)
** Extensions loaded: eol, rebase, convert, graphlog, patchbomb, extdiff,  
strip, mq, evolve, releasenotes

Traceback (most recent call last):
  File "hg", line 45, in 
  File "mercurial\dispatch.pyc", line 81, in run
  File "mercurial\dispatch.pyc", line 162, in dispatch
  File "mercurial\dispatch.pyc", line 302, in _runcatch
  File "mercurial\dispatch.pyc", line 310, in _callcatch
  File "mercurial\scmutil.pyc", line 150, in callcatch
  File "mercurial\dispatch.pyc", line 292, in _runcatchfunc
  File "mercurial\dispatch.pyc", line 895, in _dispatch
  File "mercurial\dispatch.pyc", line 658, in runcommand
  File "mercurial\dispatch.pyc", line 903, in _runcommand
  File "mercurial\dispatch.pyc", line 892, in 
  File "mercurial\util.pyc", line 1069, in check
  File "mercurial\extensions.pyc", line 322, in closure
  File "mercurial\util.pyc", line 1069, in check
  File "hgext\mq.pyc", line 3542, in mqcommand
  File "mercurial\util.pyc", line 1069, in check
  File "hgext\releasenotes.pyc", line 440, in releasenotes
  File "hgext\releasenotes.pyc", line 339, in serializenotes
IndexError: list index out of range
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] tests: update output for no-symlink platforms

2017-10-16 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1508101054 14400
#  Sun Oct 15 16:57:34 2017 -0400
# Node ID 22d774b9dbab4689b186afc8acbca3165cd2a660
# Parent  cfb054a7ecc45bcaac95f1e64b644dd0411ffe41
tests: update output for no-symlink platforms

This goes with eb586ed5d8ce.

diff --git a/tests/test-no-symlinks.t b/tests/test-no-symlinks.t
--- a/tests/test-no-symlinks.t
+++ b/tests/test-no-symlinks.t
@@ -48,6 +48,7 @@
   adding manifests
   adding file changes
   added 2 changesets with 6 changes to 6 files
+  new changesets d326ae2d01ee:71d85cf3ba90
   (run 'hg update' to get a working copy)
   $ hg update
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1138: webcommands: replace str(ctx) etc with pycompat.bytestr(ctx) etc

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

REVISION SUMMARY
  hgweb can now serve the graph view in Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/webcommands.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -31,6 +31,7 @@
 encoding,
 error,
 graphmod,
+pycompat,
 revset,
 revsetlang,
 scmutil,
@@ -1247,7 +1248,7 @@
 for (id, type, ctx, vtx, edges) in tree:
 if type != graphmod.CHANGESET:
 continue
-node = str(ctx)
+node = pycompat.bytestr(ctx)
 age = encodestr(templatefilters.age(ctx.date()))
 desc = templatefilters.firstline(encodestr(ctx.description()))
 desc = url.escape(templatefilters.nonempty(desc))
@@ -1303,7 +1304,7 @@
 canvasheight=canvasheight, bg_height=bg_height,
 # {jsdata} will be passed to |json, so it must be in utf-8
 jsdata=lambda **x: graphdata(True, encoding.fromlocal),
-nodes=lambda **x: graphdata(False, str),
+nodes=lambda **x: graphdata(False, pycompat.bytestr),
 node=ctx.hex(), changenav=changenav)
 
 def _getdoc(e):



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


D1137: templater: don't blow up when trying to build an abort message

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

REVISION SUMMARY
  __name__ is unicode, but we need bytes. For now, we'll make the
  (mostly-safe) assumption that template filter names will be ascii.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -427,7 +427,7 @@
 sym = findsymbolicname(arg)
 if sym:
 msg = (_("template filter '%s' is not compatible with keyword 
'%s'")
-   % (filt.__name__, sym))
+   % (filt.__name__.encode('ascii'), sym))
 else:
 msg = _("incompatible use of template filter '%s'") % filt.__name__
 raise error.Abort(msg)



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


D1136: templatefilters: defend against evil unicode strs in json filter

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

REVISION SUMMARY
  We only want to do I/O in terms of bytes, so lets explode early
  instead of recursing forever.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/templatefilters.py

CHANGE DETAILS

diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -233,6 +233,13 @@
 return pycompat.bytestr(obj)
 elif isinstance(obj, bytes):
 return '"%s"' % encoding.jsonescape(obj, paranoid=paranoid)
+elif isinstance(obj, str):
+# This branch is unreachable on Python 2, because bytes == str
+# and we'll return in the next-earlier block in the elif
+# ladder. On Python 3, this helps us catch bugs before they
+# hurt someone.
+raise TypeError(
+r'Mercurial only does output with bytes on Python 3: %r' % obj)
 elif util.safehasattr(obj, 'keys'):
 out = ['"%s": %s' % (encoding.jsonescape(k, paranoid=paranoid),
  json(v, paranoid))



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


D1134: hgweb: correct an earlier error of mine - `start` should be bytes

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

REVISION SUMMARY
  Gets hgweb very close to working.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -187,7 +187,7 @@
 if style == styles[0]:
 vars['style'] = style
 
-start = r'&' if req.url[-1] == r'?' else r'?'
+start = '&' if req.url[-1] == r'?' else '?'
 sessionvars = webutil.sessionvars(vars, start)
 
 if not self.reponame:



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


D1135: webutil: use pycompat.bytestr() instead of str()

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

REVISION SUMMARY
  Stops us from choking the templater on Python 3. With this patch
  applied, much of hgweb works correctly in Python 3. The notable
  exception is the graph page, which chokes because it gets node IDs as
  str instead of bytes.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/webutil.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -30,6 +30,7 @@
 mdiff,
 patch,
 pathutil,
+pycompat,
 templatefilters,
 ui as uimod,
 util,
@@ -589,7 +590,10 @@
 def __iter__(self):
 separator = self.start
 for key, value in sorted(self.vars.iteritems()):
-yield {'name': key, 'value': str(value), 'separator': separator}
+yield {'name': key,
+   'value': pycompat.bytestr(value),
+   'separator': separator,
+}
 separator = '&'
 
 class wsgiui(uimod.ui):



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


Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

2017-10-16 Thread Matt Harbison

On Mon, 16 Oct 2017 10:36:22 -0400, Yuya Nishihara  wrote:


On Mon, 16 Oct 2017 09:21:24 -0400, Matt Harbison wrote:

# HG changeset patch
# User Matt Harbison 
# Date 1508122082 14400
#  Sun Oct 15 22:48:02 2017 -0400
# Node ID d0c2b68fedb27184337af6392ecc1f03dab39522
# Parent  718adb1bf3a9a1ee509a803c7512c14296a1db79
subrepo: share instead of clone if the parent repo is shared  
(issue5675) (BC)


Generally looks good to me, but a few questions.


--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -255,6 +255,7 @@
 r = repository(ui, destwvfs.base)
 postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath)
 _postshareupdate(r, update, checkout=checkout)
+return r

 def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
 """Called after a new shared repo is created.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -857,28 +857,40 @@

 def _get(self, state):
 source, revision, kind = state
+parentrepo = self._repo._subparent
+
 if revision in self._repo.unfiltered():
-return True
+# Allow shared subrepos tracked at null to setup the  
sharedpath

+if revision != node.nullhex or not parentrepo.shared():


'revisions != node.nullhex' looks a bit tricky, which seemed to assume a
certain sequence how the current subrepo clone works under the hood.

Can we check 'len(self._repo) != 0' instead?


It looks like it.


+return True
 self._repo._subsource = source
 srcurl = _abssource(self._repo)
 other = hg.peer(self._repo, {}, srcurl)
 if len(self._repo) == 0:
-self.ui.status(_('cloning subrepo %s from %s\n')
-   % (subrelpath(self), srcurl))
-parentrepo = self._repo._subparent
 # use self._repo.vfs instead of self.wvfs to remove .hg  
only

 self._repo.vfs.rmtree()
-other, cloned = hg.clone(self._repo._subparent.baseui, {},
- other, self._repo.root,
- update=False)
-self._repo = cloned.local()
+if parentrepo.shared():
+self.ui.status(_('sharing subrepo %s from %s\n')
+   % (subrelpath(self), srcurl))
+shared = hg.share(self._repo._subparent.baseui,
+  other, self._repo.root,
+  update=False, bookmarks=False)


Perhaps bookmarks option should follow the parentrepo's, but that can be
addressed later.


I wondered about that.  But since the subrepo update may be deferred, and  
I don't think the -B for the original share command is preserved, I wasn't  
sure how.  (I don't think we can infer that -B was used, just because  
there are bookmarks, right?)



+self._repo = shared.local()
+else:
+self.ui.status(_('cloning subrepo %s from %s\n')
+   % (subrelpath(self), srcurl))
+other, cloned = hg.clone(self._repo._subparent.baseui,  
{},

+ other, self._repo.root,
+ update=False)
+self._repo = cloned.local()
 self._initrepo(parentrepo, source, create=True)
 self._cachestorehash(srcurl)
 else:
-self.ui.status(_('pulling subrepo %s from %s\n')
-   % (subrelpath(self), srcurl))
 cleansub = self.storeclean(srcurl)
-exchange.pull(self._repo, other)
+if not parentrepo.shared():


self._repo.shared() seems better since self._repo could be an existing
unshared repo.


I dropped this whole section.  Originally I was thinking that you never  
pull on update with a share.  But that aspect should be handled by the  
'revision in self._repo' check at the top.  You can `hg -R share pull  
some_other_clone`, so I think the pull code needs to stay.  (Though I  
failed to adapt the test to show this making a difference.)



+self.ui.status(_('pulling subrepo %s from %s\n')
+   % (subrelpath(self), srcurl))
+exchange.pull(self._repo, other)

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


fat-fingered push and some "duplicate" phabricator revisions

2017-10-16 Thread Augie Fackler
I accidentally pushed some of my own changes - I've cleaned up the mess, but as 
a result several of my clang-format changes had to get re-uploaded under new 
differential IDs in order to allow review. Sorry for the mess folks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1132: mpatch: switch alignment of wrapped line from tab to spaces with clang-format

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

REVISION SUMMARY
  I may be a weird person for liking this style, but our C style is
  historically nominally the Linux Kernel style, and when you configure
  clang-format to be kernel-ish, this is what you get. If we want to
  change it, we can do so by tweaking the formatter rules in the future.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/mpatch.c

CHANGE DETAILS

diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -275,5 +275,5 @@
/* divide and conquer, memory management is elsewhere */
len = (end - start) / 2;
return combine(mpatch_fold(bins, get_next_item, start, start + len),
-  mpatch_fold(bins, get_next_item, start + len, end));
+  mpatch_fold(bins, get_next_item, start + len, end));
 }



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


D1131: mpatch: reformat function prototypes with clang-format

2017-10-16 Thread durin42 (Augie Fackler)
durin42 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/D1131

AFFECTED FILES
  mercurial/mpatch.c
  mercurial/mpatch.h

CHANGE DETAILS

diff --git a/mercurial/mpatch.h b/mercurial/mpatch.h
--- a/mercurial/mpatch.h
+++ b/mercurial/mpatch.h
@@ -14,13 +14,13 @@
struct mpatch_frag *base, *head, *tail;
 };
 
-int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist** res);
+int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist **res);
 ssize_t mpatch_calcsize(ssize_t len, struct mpatch_flist *l);
 void mpatch_lfree(struct mpatch_flist *a);
 int mpatch_apply(char *buf, const char *orig, ssize_t len,
-   struct mpatch_flist *l);
-struct mpatch_flist *mpatch_fold(void *bins,
-   struct mpatch_flist* (*get_next_item)(void*, ssize_t),
-   ssize_t start, ssize_t end);
+ struct mpatch_flist *l);
+struct mpatch_flist *
+mpatch_fold(void *bins, struct mpatch_flist *(*get_next_item)(void *, ssize_t),
+ssize_t start, ssize_t end);
 
 #endif
diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -64,7 +64,7 @@
for changes in offset. the last hunk may be split if necessary.
 */
 static int gather(struct mpatch_flist *dest, struct mpatch_flist *src, int cut,
-   int offset)
+  int offset)
 {
struct mpatch_frag *d = dest->tail, *s = src->head;
int postend, c, l;
@@ -145,7 +145,7 @@
 /* combine hunk lists a and b, while adjusting b for offset changes in a/
this deletes a and b and returns the resultant list. */
 static struct mpatch_flist *combine(struct mpatch_flist *a,
-   struct mpatch_flist *b)
+struct mpatch_flist *b)
 {
struct mpatch_flist *c = NULL;
struct mpatch_frag *bh, *ct;
@@ -239,7 +239,7 @@
 }
 
 int mpatch_apply(char *buf, const char *orig, ssize_t len,
-   struct mpatch_flist *l)
+ struct mpatch_flist *l)
 {
struct mpatch_frag *f = l->head;
int last = 0;
@@ -261,9 +261,9 @@
 }
 
 /* recursively generate a patch of all bins between start and end */
-struct mpatch_flist *mpatch_fold(void *bins,
-   struct mpatch_flist* (*get_next_item)(void*, ssize_t),
-   ssize_t start, ssize_t end)
+struct mpatch_flist *
+mpatch_fold(void *bins, struct mpatch_flist *(*get_next_item)(void *, ssize_t),
+ssize_t start, ssize_t end)
 {
ssize_t len;
 



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


D1130: contrib: remove check-code rule about indentation

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

REVISION SUMMARY
  We're moving towards a clang-format world, and clang-format is able to
  wrap argument lists with spaces reliably, while still enforcing tabs
  globally. Let's let clang-format do its job, and not do as much
  C-style enforcement with regular expressions.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -429,7 +429,6 @@
 cpats = [
   [
 (r'//', "don't use //-style comments"),
-(r'^  ', "don't use spaces to indent"),
 (r'\S\t', "don't use tabs except for indent"),
 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
 (r'.{81}', "line too long"),



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


D1133: test-clang-format: new test to verify that files stay clang-formatted

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

REVISION SUMMARY
  For now all .c and .h files are blacklisted. As they become
  clang-formatted, we'll remove them from the blacklist,and then this
  test will produce output if there are diffs.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/clang-format-blacklist
  tests/test-check-clang-format.t

CHANGE DETAILS

diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-clang-format.t
@@ -0,0 +1,7 @@
+#require clang-format test-repo
+  $ cd "$TESTDIR"/..
+  $ for f in `hg files 'set:(**.c or **.h) and not 
"listfile:contrib/clang-format-blacklist"'` ; do
+  >   clang-format --style file $f > $f.formatted
+  >   cmp $f $f.formatted || diff -u $f $f.formatted
+  >   rm $f.formatted
+  > done
diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist
new file mode 100644
--- /dev/null
+++ b/contrib/clang-format-blacklist
@@ -0,0 +1,70 @@
+# Files that just need to be migrated to the formatter.
+# Do not add new files here!
+contrib/chg/chg.c
+contrib/chg/hgclient.c
+contrib/chg/hgclient.h
+contrib/chg/procutil.c
+contrib/chg/procutil.h
+contrib/chg/util.c
+contrib/chg/util.h
+contrib/hgsh/hgsh.c
+mercurial/cext/base85.c
+mercurial/cext/bdiff.c
+mercurial/cext/charencode.c
+mercurial/cext/charencode.h
+mercurial/cext/diffhelpers.c
+mercurial/cext/dirs.c
+mercurial/cext/manifest.c
+mercurial/cext/mpatch.c
+mercurial/cext/osutil.c
+mercurial/cext/parsers.c
+mercurial/cext/pathencode.c
+mercurial/cext/revlog.c
+# Vendored code that we should never format:
+contrib/python-zstandard/c-ext/bufferutil.c
+contrib/python-zstandard/c-ext/compressiondict.c
+contrib/python-zstandard/c-ext/compressionparams.c
+contrib/python-zstandard/c-ext/compressionwriter.c
+contrib/python-zstandard/c-ext/compressobj.c
+contrib/python-zstandard/c-ext/compressor.c
+contrib/python-zstandard/c-ext/compressoriterator.c
+contrib/python-zstandard/c-ext/constants.c
+contrib/python-zstandard/c-ext/decompressionwriter.c
+contrib/python-zstandard/c-ext/decompressobj.c
+contrib/python-zstandard/c-ext/decompressor.c
+contrib/python-zstandard/c-ext/decompressoriterator.c
+contrib/python-zstandard/c-ext/frameparams.c
+contrib/python-zstandard/c-ext/python-zstandard.h
+contrib/python-zstandard/zstd.c
+contrib/python-zstandard/zstd/common/bitstream.h
+contrib/python-zstandard/zstd/common/entropy_common.c
+contrib/python-zstandard/zstd/common/error_private.c
+contrib/python-zstandard/zstd/common/error_private.h
+contrib/python-zstandard/zstd/common/fse.h
+contrib/python-zstandard/zstd/common/fse_decompress.c
+contrib/python-zstandard/zstd/common/huf.h
+contrib/python-zstandard/zstd/common/mem.h
+contrib/python-zstandard/zstd/common/pool.c
+contrib/python-zstandard/zstd/common/pool.h
+contrib/python-zstandard/zstd/common/threading.c
+contrib/python-zstandard/zstd/common/threading.h
+contrib/python-zstandard/zstd/common/xxhash.c
+contrib/python-zstandard/zstd/common/xxhash.h
+contrib/python-zstandard/zstd/common/zstd_common.c
+contrib/python-zstandard/zstd/common/zstd_errors.h
+contrib/python-zstandard/zstd/common/zstd_internal.h
+contrib/python-zstandard/zstd/compress/fse_compress.c
+contrib/python-zstandard/zstd/compress/huf_compress.c
+contrib/python-zstandard/zstd/compress/zstd_compress.c
+contrib/python-zstandard/zstd/compress/zstd_opt.h
+contrib/python-zstandard/zstd/compress/zstdmt_compress.c
+contrib/python-zstandard/zstd/compress/zstdmt_compress.h
+contrib/python-zstandard/zstd/decompress/huf_decompress.c
+contrib/python-zstandard/zstd/decompress/zstd_decompress.c
+contrib/python-zstandard/zstd/dictBuilder/cover.c
+contrib/python-zstandard/zstd/dictBuilder/divsufsort.c
+contrib/python-zstandard/zstd/dictBuilder/divsufsort.h
+contrib/python-zstandard/zstd/dictBuilder/zdict.c
+contrib/python-zstandard/zstd/dictBuilder/zdict.h
+contrib/python-zstandard/zstd/zstd.h
+hgext/fsmonitor/pywatchman/bser.c



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


D1129: clang-format: configuration for the clang-format source formatter

2017-10-16 Thread durin42 (Augie Fackler)
durin42 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/D1129

AFFECTED FILES
  .clang-format
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -39,6 +39,7 @@
 
   $ testrepohg files 'glob:*'
   .arcconfig
+  .clang-format
   .editorconfig
   .hgignore
   .hgsigs
diff --git a/.clang-format b/.clang-format
new file mode 100644
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,8 @@
+BasedOnStyle: LLVM
+IndentWidth: 8
+UseTab: ForIndentation
+BreakBeforeBraces: Linux
+AllowShortIfStatementsOnASingleLine: false
+IndentCaseLabels: false
+AllowShortBlocksOnASingleLine: false
+AllowShortFunctionsOnASingleLine: false



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


D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG85cee4c0c329: arbitraryfilecontext: skip the cmp fast path 
if any side is a symlink (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1122?vs=2841&id=2878

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

AFFECTED FILES
  mercurial/context.py
  tests/test-arbitraryfilectx.t

CHANGE DETAILS

diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
new file mode 100644
--- /dev/null
+++ b/tests/test-arbitraryfilectx.t
@@ -0,0 +1,58 @@
+Setup:
+  $ cat > eval.py < from __future__ import absolute_import
+  > from mercurial import context, commands, registrar
+  > import filecmp
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command(b'eval', [], 'hg eval CMD')
+  > def eval_(ui, repo, *cmds, **opts):
+  > cmd = " ".join(cmds)
+  > res = str(eval(cmd, globals(), locals()))
+  > ui.warn("%s" % res)
+  > EOF
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "eval=`pwd`/eval.py" >> $HGRCPATH
+
+Arbitraryfilectx.cmp does not follow symlinks:
+  $ mkdir case1
+  $ cd case1
+  $ hg init
+  $ hg eval "repo[None]['real_A'].write('A', '')"
+  None (no-eol)
+  $ echo -n "foo" > A
+  $ echo -n "foo" > B
+  $ ln -s A sym_A
+  $ hg add .
+  adding A
+  adding B
+  adding real_A
+  adding sym_A
+  $ hg commit -m "base"
+
+These files are different and should return True (different):
+(Note that filecmp.cmp's return semantics are inverted from ours, so we invert
+for simplicity):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])"
+  True (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'real_A')"
+  True (no-eol)
+
+These files are identical and should return False (same):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])"
+  False (no-eol)
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])"
+  False (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'B')"
+  False (no-eol)
+
+This comparison should also return False, since A and sym_A are substantially
+the same in the eyes of ``filectx.cmp``, which looks at data only.
+  $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])"
+  False (no-e ol)
+
+A naive use of filecmp on those two would wrongly return True, since it follows
+the symlink to "A", which has different contents.
+  $ hg eval "not filecmp.cmp('real_A', 'sym_A')"
+  True (no-eol)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2569,9 +2569,13 @@
 self._path = path
 
 def cmp(self, fctx):
-if isinstance(fctx, workingfilectx) and self._repo:
+# filecmp follows symlinks whereas `cmp` should not, so skip the fast
+# path if either side is a symlink.
+symlinks = ('l' in self.flags() or 'l' in fctx.flags())
+if isinstance(fctx, workingfilectx) and self._repo and not symlinks:
 # Add a fast-path for merge if both sides are disk-backed.
-# Note that filecmp uses the opposite return values as cmp.
+# Note that filecmp uses the opposite return values (True if same)
+# as our ``cmp`` functions (True if different).
 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
 return self.data() != fctx.data()
 



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


D1094: cmdutil: pass metadata from amend() to cleanupnodes

2017-10-16 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG63712407c620: cmdutil: pass metadata from amend() to 
cleanupnodes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1094?vs=2784&id=2874

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3152,7 +3152,10 @@
 # Reroute the working copy parent to the new changeset
 repo.setparents(newid, nullid)
 mapping = {old.node(): (newid,)}
-scmutil.cleanupnodes(repo, mapping, 'amend')
+obsmetadata = None
+if opts.get('note'):
+obsmetadata = {'note': opts['note']}
+scmutil.cleanupnodes(repo, mapping, 'amend', metadata=obsmetadata)
 
 # Fixing the dirstate because localrepo.commitctx does not update
 # it. This is rather convenient because we did not need to update



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


D932: filemerge: introduce functions to halt merge flow

2017-10-16 Thread ryanmce (Ryan McElroy)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa1625035db16: filemerge: introduce functions to halt merge 
flow (authored by ryanmce, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D932?vs=2501&id=2876#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D932?vs=2501&id=2876

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

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

CHANGE DETAILS

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1288,6 +1288,17 @@
different contents. Similar to ``merge.checkignored``, except for files that
are not ignored. (default: ``abort``)
 
+``on-failure``
+   When set to ``continue`` (the default), the merge process attempts to
+   merge all unresolved files using the merge chosen tool, regardless of
+   whether previous file merge attempts during the process succeeded or not.
+   Setting this to ``prompt`` will prompt after any merge failure continue
+   or halt the merge process. Setting this to ``halt`` will automatically
+   halt the merge process on any merge tool failure. The merge process
+   can be restarted by using the ``resolve`` command. When a merge is
+   halted, the repository is left in a normal ``unresolved`` merge state.
+   (default: ``continue``)
+
 ``merge-patterns``
 --
 
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -745,6 +745,20 @@
 if not r and back is not None:
 back.remove()
 
+def _haltmerge():
+msg = _('merge halted after failed merge (see hg resolve)')
+raise error.InterventionRequired(msg)
+
+def _onfilemergefailure(ui):
+action = ui.config('merge', 'on-failure')
+if action == 'prompt':
+msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No')
+if ui.promptchoice(msg, 0) == 1:
+_haltmerge()
+if action == 'halt':
+_haltmerge()
+# default action is 'continue', in which case we neither prompt nor halt
+
 def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
 unused, unused, unused, back = files
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -531,6 +531,9 @@
 coreconfigitem('merge', 'followcopies',
 default=True,
 )
+coreconfigitem('merge', 'on-failure',
+default='continue',
+)
 coreconfigitem('merge', 'preferancestor',
 default=lambda: ['*'],
 )



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


D1124: test-hgweb-annotate-whitespace: make test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG96fea7580ac4: test-hgweb-annotate-whitespace: make test 
compatible with chg (authored by singhsrb, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1124?vs=2842&id=2872

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

AFFECTED FILES
  tests/test-hgweb-annotate-whitespace.t

CHANGE DETAILS

diff --git a/tests/test-hgweb-annotate-whitespace.t 
b/tests/test-hgweb-annotate-whitespace.t
--- a/tests/test-hgweb-annotate-whitespace.t
+++ b/tests/test-hgweb-annotate-whitespace.t
@@ -76,7 +76,7 @@
 
   $ hg serve -p $HGPORT -d --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
-  $ hg --config annotate.ignorews=true serve -p $HGPORT1 -d --pid-file hg.pid
+  $ hg serve --config annotate.ignorews=true -p $HGPORT1 -d --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
   $ cd ..
 



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


D951: merge: allow user to halt merge on merge-tool failures

2017-10-16 Thread ryanmce (Ryan McElroy)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf583cef55995: merge: allow user to halt merge on merge-tool 
failures (authored by ryanmce, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D951?vs=2502&id=2877

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

AFFECTED FILES
  mercurial/filemerge.py
  tests/test-merge-halt.t

CHANGE DETAILS

diff --git a/tests/test-merge-halt.t b/tests/test-merge-halt.t
--- a/tests/test-merge-halt.t
+++ b/tests/test-merge-halt.t
@@ -44,8 +44,7 @@
   merging a
   merging b
   merging a failed!
-  merging b failed!
-  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  merge halted after failed merge (see hg resolve)
   [1]
 
   $ hg resolve --list
@@ -65,8 +64,10 @@
   merging a
   merging b
   merging a failed!
+  continue merge operation (yn)? y
   merging b failed!
-  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  continue merge operation (yn)? n
+  merge halted after failed merge (see hg resolve)
   [1]
 
   $ hg resolve --list
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -739,6 +739,7 @@
 if r:
 if onfailure:
 ui.warn(onfailure % fd)
+_onfilemergefailure(ui)
 
 return True, r, deleted
 finally:



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


D1095: amend: add a flag `-n/--note` to store note with amend

2017-10-16 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfdec31766a51: amend: add a flag `-n/--note` to store note 
with amend (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1095?vs=2785&id=2875

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

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

CHANGE DETAILS

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -193,6 +193,14 @@
   |/
   o  0 426bada5c675 A
   
+Checking the note stored in the obsmarker
+
+  $ echo foo > bar
+  $ hg add bar
+  $ 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'}
 #endif
 
 Cannot amend public changeset
diff --git a/hgext/amend.py b/hgext/amend.py
--- a/hgext/amend.py
+++ b/hgext/amend.py
@@ -33,6 +33,7 @@
   _('mark new/missing files as added/removed before committing')),
  ('e', 'edit', None, _('invoke editor on commit messages')),
  ('i', 'interactive', None, _('use interactive mode')),
+ ('n', 'note', '', _('store a note on the amend')),
 ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2,
 _('[OPTION]... [FILE]...'),
 inferrepo=True)



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


D1093: scmutil: add capability to cleanupnodes to take obsmarker metadata

2017-10-16 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG162e8807abad: scmutil: add capability to cleanupnodes to 
take obsmarker metadata (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1093?vs=2783&id=2873

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -613,7 +613,7 @@
 def __contains__(self, node):
 return self._revcontains(self._torev(node))
 
-def cleanupnodes(repo, replacements, operation, moves=None):
+def cleanupnodes(repo, replacements, operation, moves=None, metadata=None):
 """do common cleanups when old nodes are replaced by new nodes
 
 That includes writing obsmarkers or stripping nodes, and moving bookmarks.
@@ -625,6 +625,9 @@
 
 replacements is {oldnode: [newnode]} or a iterable of nodes if they do not
 have replacements. operation is a string, like "rebase".
+
+metadata is dictionary containing metadata to be stored in obsmarker if
+obsolescence is enabled.
 """
 if not replacements and not moves:
 return
@@ -695,7 +698,8 @@
 for n, s in sorted(replacements.items(), key=sortfunc)
 if s or not isobs(n)]
 if rels:
-obsolete.createmarkers(repo, rels, operation=operation)
+obsolete.createmarkers(repo, rels, operation=operation,
+   metadata=metadata)
 else:
 from . import repair # avoid import cycle
 tostrip = list(replacements)



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


D1106: context: add workingfilectx.markcopied

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcc1bf4612bb4: context: add workingfilectx.markcopied 
(authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1106?vs=2798&id=2867

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

AFFECTED FILES
  hgext/rebase.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2001,5 +2001,5 @@
 repo.setparents(repo['.'].node(), pother)
 repo.dirstate.write(repo.currenttransaction())
 # fix up dirstate for copies and renames
-copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
+copies.duplicatecopies(repo, repo[None], ctx.rev(), pctx.rev())
 return stats
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -842,7 +842,7 @@
 data['incompletediverge'][sf] = [of, f]
 return
 
-def duplicatecopies(repo, rev, fromrev, skiprev=None):
+def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
 '''reproduce copies from fromrev to rev in the dirstate
 
 If skiprev is specified, it's a revision that should be used to
@@ -863,5 +863,4 @@
 # actually be in the dirstate
 if dst in exclude:
 continue
-if repo.dirstate[dst] in "nma":
-repo.dirstate.copy(src, dst)
+wctx[dst].markcopied(src)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1935,6 +1935,11 @@
 self._repo.wwrite(self._path, data, flags,
   backgroundclose=backgroundclose)
 
+def markcopied(self, src):
+"""marks this file a copy of `src`"""
+if self._repo.dirstate[self._path] in "nma":
+self._repo.dirstate.copy(src, self._path)
+
 def clearunknown(self):
 """Removes conflicting items in the working directory so that
 ``write()`` can be called successfully.
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -977,18 +977,19 @@
 repo.ui.debug("   detach base %d:%s\n" % (base, repo[base]))
 # When collapsing in-place, the parent is the common ancestor, we
 # have to allow merging with it.
+wctx = repo[None]
 stats = mergemod.update(repo, rev, True, True, base, collapse,
 labels=['dest', 'source'])
 if collapse:
-copies.duplicatecopies(repo, rev, dest)
+copies.duplicatecopies(repo, wctx, rev, dest)
 else:
 # If we're not using --collapse, we need to
 # duplicate copies between the revision we're
 # rebasing and its first parent, but *not*
 # duplicate any copies that have already been
 # performed in the destination.
 p1rev = repo[rev].p1().rev()
-copies.duplicatecopies(repo, rev, p1rev, skiprev=dest)
+copies.duplicatecopies(repo, wctx, rev, p1rev, skiprev=dest)
 return stats
 
 def adjustdest(repo, rev, destmap, state, skipped):



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


D736: registrar: add support for storing the type of command in func object

2017-10-16 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG18507697d917: registrar: add support for storing the type 
of command in func object (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D736?vs=2595&id=2861

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

AFFECTED FILES
  mercurial/dispatch.py
  mercurial/registrar.py

CHANGE DETAILS

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -7,6 +7,7 @@
 
 from __future__ import absolute_import
 
+from .i18n import _
 from . import (
 configitems,
 error,
@@ -131,13 +132,35 @@
 command line arguments. If True, arguments will be examined for potential
 repository locations. See ``findrepo()``. If a repository is found, it
 will be used.
+
+There are three constants in the class which tells what type of the command
+that is. That information will be helpful at various places. It will be 
also
+be used to decide what level of access the command has on hidden commits.
+The constants are:
+
+unrecoverablewrite is for those write commands which can't be recovered 
like
+push.
+recoverablewrite is for write commands which can be recovered like commit.
+readonly is for commands which are read only.
 """
 
+unrecoverablewrite = "unrecoverable"
+recoverablewrite = "recoverable"
+readonly = "readonly"
+
 def _doregister(self, func, name, options=(), synopsis=None,
-norepo=False, optionalrepo=False, inferrepo=False):
+norepo=False, optionalrepo=False, inferrepo=False,
+cmdtype=unrecoverablewrite):
+
+possiblecmdtypes = set([self.unrecoverablewrite, self.recoverablewrite,
+self.readonly])
+if cmdtype not in possiblecmdtypes:
+raise error.ProgrammingError(_("unknown cmdtype value '%s' for "
+"'%s' command") % (cmdtype, name))
 func.norepo = norepo
 func.optionalrepo = optionalrepo
 func.inferrepo = inferrepo
+func.cmdtype = cmdtype
 if synopsis:
 self._table[name] = func, list(options), synopsis
 else:
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -35,11 +35,14 @@
 hook,
 profiling,
 pycompat,
+registrar,
 scmutil,
 ui as uimod,
 util,
 )
 
+unrecoverablewrite = registrar.command.unrecoverablewrite
+
 class request(object):
 def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
  ferr=None, prereposetups=None):
@@ -495,7 +498,7 @@
 return aliasargs(self.fn, args)
 
 def __getattr__(self, name):
-adefaults = {r'norepo': True,
+adefaults = {r'norepo': True, r'cmdtype': unrecoverablewrite,
  r'optionalrepo': False, r'inferrepo': False}
 if name not in adefaults:
 raise AttributeError(name)



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


D1057: filemerge: use arbitraryfilectx for backups

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
phillco marked an inline comment as done.
Closed by commit rHG8e247db0d0f6: filemerge: use arbitraryfilectx for backups 
(authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1057?vs=2843&id=2862

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,6 @@
 
 from __future__ import absolute_import
 
-import filecmp
 import os
 import re
 import tempfile
@@ -226,9 +225,9 @@
 return '\n'
 return None # unknown
 
-def _matcheol(file, origfile):
+def _matcheol(file, back):
 "Convert EOL markers in a file to match origfile"
-tostyle = _eoltype(util.readfile(origfile))
+tostyle = _eoltype(back.data()) # No repo.wread filters?
 if tostyle:
 data = util.readfile(file)
 style = _eoltype(data)
@@ -505,7 +504,9 @@
 
 args = _toolstr(ui, tool, "args", '$local $base $other')
 if "$output" in args:
-out, a = a, back # read input from backup, write to original
+# read input from backup, write to original
+out = a
+a = repo.wvfs.join(back.path())
 replace = {'local': a, 'base': b, 'other': c, 'output': out}
 args = util.interpolate(r'\$', replace, args,
 lambda s: util.shellquote(util.localpath(s)))
@@ -588,24 +589,26 @@
 def _restorebackup(fcd, back):
 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
 # util.copy here instead.
-fcd.write(util.readfile(back), fcd.flags())
+fcd.write(back.data(), fcd.flags())
 
-def _makebackup(repo, ui, fcd, premerge):
-"""Makes a backup of the local `fcd` file prior to merging.
+def _makebackup(repo, ui, wctx, fcd, premerge):
+"""Makes and returns a filectx-like object for ``fcd``'s backup file.
 
 In addition to preserving the user's pre-existing modifications to `fcd`
 (if any), the backup is used to undo certain premerges, confirm whether a
 merge changed anything, and determine what line endings the new file should
 have.
 """
 if fcd.isabsent():
 return None
-
+# TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
+# merge -> filemerge). (I suspect the fileset import is the weakest link)
+from . import context
 a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
-return back
+return context.arbitraryfilectx(back, repo=repo)
 
 def _maketempfiles(repo, fco, fca):
 """Writes out `fco` and `fca` as temporary files, so an external merge
@@ -691,7 +694,7 @@
 ui.warn(onfailure % fd)
 return True, 1, False
 
-back = _makebackup(repo, ui, fcd, premerge)
+back = _makebackup(repo, ui, wctx, fcd, premerge)
 files = (None, None, None, back)
 r = 1
 try:
@@ -719,7 +722,7 @@
 return True, r, deleted
 finally:
 if not r and back is not None:
-util.unlink(back)
+back.remove()
 
 def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
@@ -741,7 +744,7 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
+if back is not None and not fcd.cmp(back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):



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


D1127: test-obsolete-bounds-checking: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf20b987625f7: test-obsolete-bounds-checking: make the test 
compatible with chg (authored by singhsrb, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1127?vs=2851&id=2870

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

AFFECTED FILES
  tests/test-obsolete-bounds-checking.t

CHANGE DETAILS

diff --git a/tests/test-obsolete-bounds-checking.t 
b/tests/test-obsolete-bounds-checking.t
--- a/tests/test-obsolete-bounds-checking.t
+++ b/tests/test-obsolete-bounds-checking.t
@@ -20,4 +20,4 @@
   transaction abort!
   rollback completed
   Traceback (most recent call last):
-  mercurial.error.ProgrammingError: obsstore metadata value cannot be longer 
than 255 bytes (value 
"
 " for key "user" is 285 bytes)
+  *ProgrammingError: obsstore metadata value cannot be longer than 255 bytes 
(value 
"
 " for key "user" is 285 bytes) (glob)



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


D1058: context: add overlayfilectx.cmp()

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe8ec39263850: context: add overlayfilectx.cmp() (authored 
by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1058?vs=2697&id=2863

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2098,6 +2098,9 @@
 self._parent = parent
 self._path = path
 
+def cmp(self, fctx):
+return self.data() != fctx.data()
+
 def ctx(self):
 return self._parent
 



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


D1060: filemerge: add a missing flushall()

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa25f886e1b8b: filemerge: add a missing flushall() (authored 
by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1060?vs=2699&id=2865

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -467,6 +467,12 @@
 a = _workingpath(repo, fcd)
 fd = fcd.path()
 
+# Run ``flushall()`` to make any missing folders the following wwrite
+# calls might be depending on.
+from . import context
+if isinstance(fcd, context.overlayworkingfilectx):
+fcd.ctx().flushall()
+
 util.writefile(a + ".local", fcd.decodeddata())
 repo.wwrite(fd + ".other", fco.data(), fco.flags())
 repo.wwrite(fd + ".base", fca.data(), fca.flags())



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


D1126: test-dispatch: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG65a2c4114158: test-dispatch: make the test compatible with 
chg (authored by singhsrb, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1126?vs=2852&id=2869

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

AFFECTED FILES
  tests/test-dispatch.t

CHANGE DETAILS

diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -69,7 +69,8 @@
   $ cd $TESTTMP/repo1
   $ rm -rf $TESTTMP/repo1
   $ HGDEMANDIMPORT=disable hg version -q
-  abort: error getting current working directory: * (glob)
+  abort: error getting current working directory: * (glob) (no-chg !)
+  chg: abort: failed to getcwd (errno = *) (glob) (chg !)
   [255]
 
 #endif



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


D1059: filemerge: store backups in the overlayworkingctx if using imm

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb5e7aa688689: filemerge: store backups in the 
overlayworkingctx if using imm (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1059?vs=2698&id=2864

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -606,9 +606,24 @@
 from . import context
 a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
-if premerge:
-util.copyfile(a, back)
-return context.arbitraryfilectx(back, repo=repo)
+inworkingdir = (back.startswith(repo.wvfs.base) and not
+back.startswith(repo.vfs.base))
+
+if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
+# If the backup file is to be in the working directory, and we're
+# merging in-memory, we must redirect the backup to the memory context
+# so we don't disturb the working directory.
+relpath = back[len(repo.wvfs.base) + 1:]
+wctx[relpath].write(fcd.data(), fcd.flags())
+return wctx[relpath]
+else:
+# Otherwise, write to wherever the user specified the backups should 
go.
+#
+# A arbitraryfilectx is returned, so we can run the same functions on
+# the backup context regardless of where it lives.
+if premerge:
+util.copyfile(a, back)
+return context.arbitraryfilectx(back, repo=repo)
 
 def _maketempfiles(repo, fco, fca):
 """Writes out `fco` and `fca` as temporary files, so an external merge



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


D1123: histedit: remove the nonexistant config 'histeditng'

2017-10-16 Thread singhsrb (Saurabh Singh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG85596338f122: histedit: remove the nonexistant config 
'histeditng' (authored by singhsrb, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1123?vs=2837&id=2868

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -220,9 +220,6 @@
 configitem('experimental', 'histedit.autoverb',
 default=False,
 )
-configitem('experimental', 'histeditng',
-default=False,
-)
 configitem('histedit', 'defaultrev',
 default=configitems.dynamicdefault,
 )



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


D1105: merge: don't use workers in in-memory mode

2017-10-16 Thread phillco (Phil Cohen)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8ff80d1c75b5: merge: don't use workers in in-memory 
mode (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1105?vs=2797&id=2866

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1427,8 +1427,12 @@
 z += 1
 progress(_updating, z, item=f, total=numupdates, unit=_files)
 
+# When merging in-memory, we can't support worker processes, so set the
+# per-item cost at 0 in that case.
+cost = 0 if wctx.isinmemory() else 0.001
+
 # remove in parallel (must come before resolving path conflicts and 
getting)
-prog = worker.worker(repo.ui, 0.001, batchremove, (repo, wctx),
+prog = worker.worker(repo.ui, cost, batchremove, (repo, wctx),
  actions['r'])
 for i, item in prog:
 z += i
@@ -1452,7 +1456,7 @@
 wctx.flushall()
 
 # get in parallel
-prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx, wctx),
+prog = worker.worker(repo.ui, cost, batchget, (repo, mctx, wctx),
  actions['g'])
 for i, item in prog:
 z += i



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


D1128: test-pager: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4effa078d157: test-pager: make the test compatible with chg 
(authored by singhsrb, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1128?vs=2853&id=2871

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

AFFECTED FILES
  tests/test-pager.t

CHANGE DETAILS

diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -216,16 +216,6 @@
   date:Thu Jan 01 00:00:00 1970 +
   summary: modify a 8
   
-#else
-Currently, chg has its own runpager implementation, which does not show the
-"missing pager" message. The error message is globed out since the shell could
-print different message.
-  $ hg log --limit 3 --config pager.pager=this-command-better-never-exist
-  /bin/sh: this-command-better-never-exist: command not found (?)
-  * (glob) (?)
-  killed!
-  [255]
-
 #endif
 
 A complicated pager command gets worse behavior. Bonus points if you can



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


D1113: clang-format: configuration for the clang-format source formatter

2017-10-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGebfbf4e48d65: clang-format: configuration for the 
clang-format source formatter (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1113?vs=2821&id=2854

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

AFFECTED FILES
  .clang-format
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -39,6 +39,7 @@
 
   $ testrepohg files 'glob:*'
   .arcconfig
+  .clang-format
   .editorconfig
   .hgignore
   .hgsigs
diff --git a/.clang-format b/.clang-format
new file mode 100644
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,8 @@
+BasedOnStyle: LLVM
+IndentWidth: 8
+UseTab: ForIndentation
+BreakBeforeBraces: Linux
+AllowShortIfStatementsOnASingleLine: false
+IndentCaseLabels: false
+AllowShortBlocksOnASingleLine: false
+AllowShortFunctionsOnASingleLine: false



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


D1119: releasenotes: fix documentation of similaritycheck()

2017-10-16 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG735153be8151: releasenotes: fix documentation of 
similaritycheck() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1119?vs=2829&id=2860

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

AFFECTED FILES
  hgext/releasenotes.py

CHANGE DETAILS

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -216,7 +216,7 @@
 
 def similaritycheck(incoming_str, existingnotes):
 """
-Returns true when note fragment can be merged to existing notes.
+Returns false when note fragment can be merged to existing notes.
 """
 import fuzzywuzzy.fuzz as fuzz
 merge = True



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


D1030: mpatch: switch alignment of wrapped line from tab to spaces with clang-format

2017-10-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3b9e510335ee: mpatch: switch alignment of wrapped line from 
tab to spaces with clang-format (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1030?vs=2630&id=2857

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

AFFECTED FILES
  mercurial/mpatch.c

CHANGE DETAILS

diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -275,5 +275,5 @@
/* divide and conquer, memory management is elsewhere */
len = (end - start) / 2;
return combine(mpatch_fold(bins, get_next_item, start, start + len),
-  mpatch_fold(bins, get_next_item, start + len, end));
+  mpatch_fold(bins, get_next_item, start + len, end));
 }



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


D1116: Makefile: add target to apply clang-format in-place

2017-10-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGaf487f227278: Makefile: add target to apply clang-format 
in-place (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1116?vs=2825&id=2859

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

AFFECTED FILES
  Makefile

CHANGE DETAILS

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,10 @@
 check-code:
hg manifest | xargs python contrib/check-code.py
 
+format-c:
+   clang-format --style file -i \
+ `hg files 'set:(**.c or **.h) and not 
"listfile:contrib/clang-format-blacklist"'`
+
 update-pot: i18n/hg.pot
 
 i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext



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


D1115: test-clang-format: new test to verify that files stay clang-formatted

2017-10-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8d2cada7277d: test-clang-format: new test to verify that 
files stay clang-formatted (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1115?vs=2824&id=2858

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

AFFECTED FILES
  contrib/clang-format-blacklist
  tests/test-check-clang-format.t

CHANGE DETAILS

diff --git a/tests/test-check-clang-format.t b/tests/test-check-clang-format.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-clang-format.t
@@ -0,0 +1,7 @@
+#require clang-format test-repo
+  $ cd "$TESTDIR"/..
+  $ for f in `hg files 'set:(**.c or **.h) and not 
"listfile:contrib/clang-format-blacklist"'` ; do
+  >   clang-format --style file $f > $f.formatted
+  >   cmp $f $f.formatted || diff -u $f $f.formatted
+  >   rm $f.formatted
+  > done
diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist
new file mode 100644
--- /dev/null
+++ b/contrib/clang-format-blacklist
@@ -0,0 +1,70 @@
+# Files that just need to be migrated to the formatter.
+# Do not add new files here!
+contrib/chg/chg.c
+contrib/chg/hgclient.c
+contrib/chg/hgclient.h
+contrib/chg/procutil.c
+contrib/chg/procutil.h
+contrib/chg/util.c
+contrib/chg/util.h
+contrib/hgsh/hgsh.c
+mercurial/cext/base85.c
+mercurial/cext/bdiff.c
+mercurial/cext/charencode.c
+mercurial/cext/charencode.h
+mercurial/cext/diffhelpers.c
+mercurial/cext/dirs.c
+mercurial/cext/manifest.c
+mercurial/cext/mpatch.c
+mercurial/cext/osutil.c
+mercurial/cext/parsers.c
+mercurial/cext/pathencode.c
+mercurial/cext/revlog.c
+# Vendored code that we should never format:
+contrib/python-zstandard/c-ext/bufferutil.c
+contrib/python-zstandard/c-ext/compressiondict.c
+contrib/python-zstandard/c-ext/compressionparams.c
+contrib/python-zstandard/c-ext/compressionwriter.c
+contrib/python-zstandard/c-ext/compressobj.c
+contrib/python-zstandard/c-ext/compressor.c
+contrib/python-zstandard/c-ext/compressoriterator.c
+contrib/python-zstandard/c-ext/constants.c
+contrib/python-zstandard/c-ext/decompressionwriter.c
+contrib/python-zstandard/c-ext/decompressobj.c
+contrib/python-zstandard/c-ext/decompressor.c
+contrib/python-zstandard/c-ext/decompressoriterator.c
+contrib/python-zstandard/c-ext/frameparams.c
+contrib/python-zstandard/c-ext/python-zstandard.h
+contrib/python-zstandard/zstd.c
+contrib/python-zstandard/zstd/common/bitstream.h
+contrib/python-zstandard/zstd/common/entropy_common.c
+contrib/python-zstandard/zstd/common/error_private.c
+contrib/python-zstandard/zstd/common/error_private.h
+contrib/python-zstandard/zstd/common/fse.h
+contrib/python-zstandard/zstd/common/fse_decompress.c
+contrib/python-zstandard/zstd/common/huf.h
+contrib/python-zstandard/zstd/common/mem.h
+contrib/python-zstandard/zstd/common/pool.c
+contrib/python-zstandard/zstd/common/pool.h
+contrib/python-zstandard/zstd/common/threading.c
+contrib/python-zstandard/zstd/common/threading.h
+contrib/python-zstandard/zstd/common/xxhash.c
+contrib/python-zstandard/zstd/common/xxhash.h
+contrib/python-zstandard/zstd/common/zstd_common.c
+contrib/python-zstandard/zstd/common/zstd_errors.h
+contrib/python-zstandard/zstd/common/zstd_internal.h
+contrib/python-zstandard/zstd/compress/fse_compress.c
+contrib/python-zstandard/zstd/compress/huf_compress.c
+contrib/python-zstandard/zstd/compress/zstd_compress.c
+contrib/python-zstandard/zstd/compress/zstd_opt.h
+contrib/python-zstandard/zstd/compress/zstdmt_compress.c
+contrib/python-zstandard/zstd/compress/zstdmt_compress.h
+contrib/python-zstandard/zstd/decompress/huf_decompress.c
+contrib/python-zstandard/zstd/decompress/zstd_decompress.c
+contrib/python-zstandard/zstd/dictBuilder/cover.c
+contrib/python-zstandard/zstd/dictBuilder/divsufsort.c
+contrib/python-zstandard/zstd/dictBuilder/divsufsort.h
+contrib/python-zstandard/zstd/dictBuilder/zdict.c
+contrib/python-zstandard/zstd/dictBuilder/zdict.h
+contrib/python-zstandard/zstd/zstd.h
+hgext/fsmonitor/pywatchman/bser.c



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


D1028: mpatch: reformat function prototypes with clang-format

2017-10-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbd177139e635: mpatch: reformat function prototypes with 
clang-format (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1028?vs=2823&id=2856

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

AFFECTED FILES
  mercurial/mpatch.c
  mercurial/mpatch.h

CHANGE DETAILS

diff --git a/mercurial/mpatch.h b/mercurial/mpatch.h
--- a/mercurial/mpatch.h
+++ b/mercurial/mpatch.h
@@ -14,13 +14,13 @@
struct mpatch_frag *base, *head, *tail;
 };
 
-int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist** res);
+int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist **res);
 ssize_t mpatch_calcsize(ssize_t len, struct mpatch_flist *l);
 void mpatch_lfree(struct mpatch_flist *a);
 int mpatch_apply(char *buf, const char *orig, ssize_t len,
-   struct mpatch_flist *l);
-struct mpatch_flist *mpatch_fold(void *bins,
-   struct mpatch_flist* (*get_next_item)(void*, ssize_t),
-   ssize_t start, ssize_t end);
+ struct mpatch_flist *l);
+struct mpatch_flist *
+mpatch_fold(void *bins, struct mpatch_flist *(*get_next_item)(void *, ssize_t),
+ssize_t start, ssize_t end);
 
 #endif
diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c
--- a/mercurial/mpatch.c
+++ b/mercurial/mpatch.c
@@ -64,7 +64,7 @@
for changes in offset. the last hunk may be split if necessary.
 */
 static int gather(struct mpatch_flist *dest, struct mpatch_flist *src, int cut,
-   int offset)
+  int offset)
 {
struct mpatch_frag *d = dest->tail, *s = src->head;
int postend, c, l;
@@ -145,7 +145,7 @@
 /* combine hunk lists a and b, while adjusting b for offset changes in a/
this deletes a and b and returns the resultant list. */
 static struct mpatch_flist *combine(struct mpatch_flist *a,
-   struct mpatch_flist *b)
+struct mpatch_flist *b)
 {
struct mpatch_flist *c = NULL;
struct mpatch_frag *bh, *ct;
@@ -239,7 +239,7 @@
 }
 
 int mpatch_apply(char *buf, const char *orig, ssize_t len,
-   struct mpatch_flist *l)
+ struct mpatch_flist *l)
 {
struct mpatch_frag *f = l->head;
int last = 0;
@@ -261,9 +261,9 @@
 }
 
 /* recursively generate a patch of all bins between start and end */
-struct mpatch_flist *mpatch_fold(void *bins,
-   struct mpatch_flist* (*get_next_item)(void*, ssize_t),
-   ssize_t start, ssize_t end)
+struct mpatch_flist *
+mpatch_fold(void *bins, struct mpatch_flist *(*get_next_item)(void *, ssize_t),
+ssize_t start, ssize_t end)
 {
ssize_t len;
 



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


D1114: contrib: remove check-code rule about indentation

2017-10-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6aeb3d69e16b: contrib: remove check-code rule about 
indentation (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1114?vs=2822&id=2855

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

AFFECTED FILES
  contrib/check-code.py

CHANGE DETAILS

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -429,7 +429,6 @@
 cpats = [
   [
 (r'//', "don't use //-style comments"),
-(r'^  ', "don't use spaces to indent"),
 (r'\S\t', "don't use tabs except for indent"),
 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
 (r'.{81}', "line too long"),



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


D1124: test-hgweb-annotate-whitespace: make test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb added a comment.


  @durin42: That's a valid concern and I am planning to look at the pattern 
handling code at some point.

REPOSITORY
  rHG Mercurial

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

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


D952: merge: additional test cases to show changing behavior

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  https://phab.mercurial-scm.org/D953 is abandoned-  should this be as well?

REPOSITORY
  rHG Mercurial

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

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


D1095: amend: add a flag `-n/--note` to store note with amend

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  (Thanks to @yuja for reviewing this new feature so I could have more 
confidence landing the patch this late in the cycle.)

REPOSITORY
  rHG Mercurial

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

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


D1124: test-hgweb-annotate-whitespace: make test compatible with chg

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I'm a bit worried that chg can't handle the typical argument pattern here...

REPOSITORY
  rHG Mercurial

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

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


D1128: test-pager: make the test compatible with chg

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  It's probably worth pointing out that the "killed!" message is racy on 
solaris, which probably means it's just straight-up racy and Linux/FreeBSD/OS X 
aren't annoying enough to trigger the race on a regular basis

REPOSITORY
  rHG Mercurial

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

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


D1128: test-pager: make the test compatible with chg

2017-10-16 Thread quark (Jun Wu)
quark accepted this revision.
quark added a comment.


  This was suggested by me. Basically there are too many "racy" cases that 
errors can happen everywhere, ex. chg cannot send fds, etc. And the "killed!" 
output is also racy that it may appear before or after a chg error message.
  
  Instead of trying to match all possible outputs, it is cleaner to just remove 
the test until we implement something similar to core hg to not execute the 
shell.

REPOSITORY
  rHG Mercurial

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

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


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

2017-10-16 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  Needs tests.

REPOSITORY
  rHG Mercurial

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

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


D1117: config: simplify aliasing commands.update.check

2017-10-16 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> configitems.py:184
>  default=None,
> +alias=[('experimental', 'updatecheck')]
>  )

Please add the comment that this alias should be discarded post-4.4?

REPOSITORY
  rHG Mercurial

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

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


D1044: bisect: add --abort flag

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D1044#18780, @quark wrote:
  
  > I think with `--command`, an option to restore to the original commit is a 
useful feature in `bisect` itself. If we cannot reach an agreement before 
freeze, could we push the first 3 commits 
(https://phab.mercurial-scm.org/D947+https://phab.mercurial-scm.org/D948+https://phab.mercurial-scm.org/D949)?
 They are safe and solve a real issue when log template is changed.
  
  
  I'm confused what you think the state of this is: the proximate goal of this 
series (as I understood it!) was to get run-tests able to restore to an 
original revision after doing its bisection, a goal which I wholeheartedly 
endorse.
  
  While I also agree that some built-in-to-bisect mechanism for "take be back 
where I was before bisection began" probably makes sense, I disagree that it 
should be named --abort. I've not looked at any of the earlier diffs in the 
series because @ryanmce requested changes, so much like a commented V1 on the 
list, I wasn't going to spend time on them until you sent a V2 (aka updated the 
diff, or otherwise cleared the "changes requested" state.) Does that make 
sense? I'm happy to land 947-949 assuming they're ready to go, but it looks 
like at least 948 needs some minor indentation cleanup?

REPOSITORY
  rHG Mercurial

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

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


D1128: test-pager: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  https://phab.mercurial-scm.org/D911 tried to make this test compatible with 
chg but instead resulted
  in the test being flaky for chg. For now, disabling this test for chg because
  it seems difficult to fix the test. This will allow for the continuous build
  setup for chg.

TEST PLAN
  Ran the test 'test-pager.t' with and without the '--chg' option.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-pager.t

CHANGE DETAILS

diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -216,16 +216,6 @@
   date:Thu Jan 01 00:00:00 1970 +
   summary: modify a 8
   
-#else
-Currently, chg has its own runpager implementation, which does not show the
-"missing pager" message. The error message is globed out since the shell could
-print different message.
-  $ hg log --limit 3 --config pager.pager=this-command-better-never-exist
-  /bin/sh: this-command-better-never-exist: command not found (?)
-  * (glob) (?)
-  killed!
-  [255]
-
 #endif
 
 A complicated pager command gets worse behavior. Bonus points if you can



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


D1126: test-dispatch: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb updated this revision to Diff 2852.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1126?vs=2850&id=2852

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

AFFECTED FILES
  tests/test-dispatch.t

CHANGE DETAILS

diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -69,7 +69,8 @@
   $ cd $TESTTMP/repo1
   $ rm -rf $TESTTMP/repo1
   $ HGDEMANDIMPORT=disable hg version -q
-  abort: error getting current working directory: * (glob)
+  abort: error getting current working directory: * (glob) (no-chg !)
+  chg: abort: failed to getcwd (errno = *) (glob) (chg !)
   [255]
 
 #endif



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


D1126: test-dispatch: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb added inline comments.

INLINE COMMENTS

> quark wrote in test-dispatch.t:77
> Alternatively, you can use individual line matching without duplicating the 
> `hg version` line:
> 
>   abort: error getting current working directory: * (glob) (no-chg !)
>   chg: abort: failed to getcwd (errno = *) (glob) (chg !)

That certainly seems like a better approach. Thanks!

> quark wrote in test-dispatch.t:85
> `errno` and error message could be platform dependent:
> 
>   chg: ... (errno = *) (glob)

Hmmm, didn't consider that. Thanks!

REPOSITORY
  rHG Mercurial

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

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


D1127: test-obsolete-bounds-checking: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This test fails when run with chg because the error message starts
  with "ProgrammingError" instead of "mercurial.error.ProgrammingError".
  Therefore, globing the "mercurial.error." to ensure that the test is 
compatible
  with chg.

TEST PLAN
  Ran the test 'test-obsolete-bounds-checking.t' with and without the
  '--chg' option.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-obsolete-bounds-checking.t

CHANGE DETAILS

diff --git a/tests/test-obsolete-bounds-checking.t 
b/tests/test-obsolete-bounds-checking.t
--- a/tests/test-obsolete-bounds-checking.t
+++ b/tests/test-obsolete-bounds-checking.t
@@ -20,4 +20,4 @@
   transaction abort!
   rollback completed
   Traceback (most recent call last):
-  mercurial.error.ProgrammingError: obsstore metadata value cannot be longer 
than 255 bytes (value 
"
 " for key "user" is 285 bytes)
+  *ProgrammingError: obsstore metadata value cannot be longer than 255 bytes 
(value 
"
 " for key "user" is 285 bytes) (glob)



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


D1126: test-dispatch: make the test compatible with chg

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


  Just a small nit.

INLINE COMMENTS

> test-dispatch.t:77
>$ HGDEMANDIMPORT=disable hg version -q
>abort: error getting current working directory: * (glob)
>[255]

Alternatively, you can use individual line matching without duplicating the `hg 
version` line:

  abort: error getting current working directory: * (glob) (no-chg !)
  chg: abort: failed to getcwd (errno = *) (glob) (chg !)

> test-dispatch.t:85
> +  $ HGDEMANDIMPORT=disable hg version -q
> +  chg: abort: failed to getcwd (errno = 2, No such file or directory)
> +  [255]

`errno` and error message could be platform dependent:

  chg: ... (errno = *) (glob)

REPOSITORY
  rHG Mercurial

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

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


D1126: test-dispatch: make the test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The test is broken when run with chg because it prints a different
  error message when chg is running. This commit fixes the test by special 
casing
  for chg.

TEST PLAN
  Ran the test 'test-dispatch.t' with and without '--chg' option.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-dispatch.t

CHANGE DETAILS

diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -68,8 +68,21 @@
   $ mkdir $TESTTMP/repo1
   $ cd $TESTTMP/repo1
   $ rm -rf $TESTTMP/repo1
+
+#endif
+
+#if rmcwd no-chg
+
   $ HGDEMANDIMPORT=disable hg version -q
   abort: error getting current working directory: * (glob)
   [255]
 
 #endif
+
+#if rmcwd chg
+
+  $ HGDEMANDIMPORT=disable hg version -q
+  chg: abort: failed to getcwd (errno = 2, No such file or directory)
+  [255]
+
+#endif



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


D1044: bisect: add --abort flag

2017-10-16 Thread quark (Jun Wu)
quark added a comment.


  I think with `--command`, an option to restore to the original commit is a 
useful feature in `bisect` itself. If we cannot reach agreement, could we push 
the first 3 commits 
(https://phab.mercurial-scm.org/D947+https://phab.mercurial-scm.org/D948+https://phab.mercurial-scm.org/D949)?
 They are safe.

REPOSITORY
  rHG Mercurial

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

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


[Bug 5711] New: Cannot clone in Python 3 due to string handling

2017-10-16 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5711

Bug ID: 5711
   Summary: Cannot clone in Python 3 due to string handling
   Product: Mercurial
   Version: 4.3.3
  Hardware: Macintosh
OS: Mac OS
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: ri...@gerkin.org
CC: mercurial-devel@mercurial-scm.org

# Python 2 version, succeeds
~/miniconda2/bin/hg clone https://www.neuron.yale.edu/hg/neuron/nrn

# Python 3 version, fails
~/miniconda2/bin/hg clone https://www.neuron.yale.edu/hg/neuron/nrn

The error message is: 
abort: error: unknown url type: b'https

This results from the clone argument being processed as a bytes object in
Python 3, which urllib.request cannot handle.  

Example in Python 3:  
from urllib.request import urlopen,Request
url1 = "http://www.python.org";
url2 = b"http://www.python.org";
r1 = Request(url1)
r2 = Request(url2)
urlopen(r1) # Works
urlopen(r2) # Fails
# Easily fixed with:  
r2_fixed = Request(url2.decode())
urlopen(r2_fixed)

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


D1063: rebase: enable multidest by default

2017-10-16 Thread quark (Jun Wu)
quark added a comment.


  Interface-wise, I'm thinking about defining `BASE` as `max(roots(ALLSRC) & 
::SRC)^` to make it easier to use.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

2017-10-16 Thread Augie Fackler
On Mon, Oct 16, 2017 at 11:36:22PM +0900, Yuya Nishihara wrote:
> On Mon, 16 Oct 2017 09:21:24 -0400, Matt Harbison wrote:
> > # HG changeset patch
> > # User Matt Harbison 
> > # Date 1508122082 14400
> > #  Sun Oct 15 22:48:02 2017 -0400
> > # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522
> > # Parent  718adb1bf3a9a1ee509a803c7512c14296a1db79
> > subrepo: share instead of clone if the parent repo is shared (issue5675) 
> > (BC)
>
> Generally looks good to me, but a few questions.
>
> > --- a/mercurial/hg.py
> > +++ b/mercurial/hg.py
> > @@ -255,6 +255,7 @@
> >  r = repository(ui, destwvfs.base)
> >  postshare(srcrepo, r, bookmarks=bookmarks, defaultpath=defaultpath)
> >  _postshareupdate(r, update, checkout=checkout)
> > +return r
> >
> >  def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
> >  """Called after a new shared repo is created.
> > diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> > --- a/mercurial/subrepo.py
> > +++ b/mercurial/subrepo.py
> > @@ -857,28 +857,40 @@
> >
> >  def _get(self, state):
> >  source, revision, kind = state
> > +parentrepo = self._repo._subparent
> > +
> >  if revision in self._repo.unfiltered():
> > -return True
> > +# Allow shared subrepos tracked at null to setup the sharedpath
> > +if revision != node.nullhex or not parentrepo.shared():
>
> 'revisions != node.nullhex' looks a bit tricky, which seemed to assume a
> certain sequence how the current subrepo clone works under the hood.
>
> Can we check 'len(self._repo) != 0' instead?

That seems like a safer check to me.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)

2017-10-16 Thread Augie Fackler
On Mon, Oct 16, 2017 at 07:30:32PM +0530, Pulkit Goyal wrote:
> On Mon, Oct 16, 2017 at 6:51 PM, Matt Harbison  wrote:
> > # HG changeset patch
> > # User Matt Harbison 
> > # Date 1508122082 14400
> > #  Sun Oct 15 22:48:02 2017 -0400
> > # Node ID d0c2b68fedb27184337af6392ecc1f03dab39522
> > # Parent  718adb1bf3a9a1ee509a803c7512c14296a1db79
> > subrepo: share instead of clone if the parent repo is shared (issue5675) 
> > (BC)
>
> Can you please add a releasenotes part to the commit message?
> For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtension

+1 - that'll make my life much easier on Wednesday!

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


Phabricator and [stable] patches

2017-10-16 Thread Augie Fackler
As we approach the freeze, I'm realizing we don't have a good way of flagging 
things for stable in Phabricator. Anyone have ideas for how we should do this?

Thanks,
Augie

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


D1057: filemerge: use arbitraryfilectx for backups

2017-10-16 Thread phillco (Phil Cohen)
phillco marked 4 inline comments as done.
phillco added inline comments.

INLINE COMMENTS

> phillco wrote in filemerge.py:604
> Sure, will do. I think most likely by breaking the context -> fileset 
> dependency.

@durin42 done

REPOSITORY
  rHG Mercurial

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

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


D1057: filemerge: use arbitraryfilectx for backups

2017-10-16 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 2843.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1057?vs=2696&id=2843

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,6 @@
 
 from __future__ import absolute_import
 
-import filecmp
 import os
 import re
 import tempfile
@@ -226,9 +225,9 @@
 return '\n'
 return None # unknown
 
-def _matcheol(file, origfile):
+def _matcheol(file, back):
 "Convert EOL markers in a file to match origfile"
-tostyle = _eoltype(util.readfile(origfile))
+tostyle = _eoltype(back.data()) # No repo.wread filters?
 if tostyle:
 data = util.readfile(file)
 style = _eoltype(data)
@@ -505,7 +504,9 @@
 
 args = _toolstr(ui, tool, "args", '$local $base $other')
 if "$output" in args:
-out, a = a, back # read input from backup, write to original
+# read input from backup, write to original
+out = a
+a = repo.wvfs.join(back.path())
 replace = {'local': a, 'base': b, 'other': c, 'output': out}
 args = util.interpolate(r'\$', replace, args,
 lambda s: util.shellquote(util.localpath(s)))
@@ -588,24 +589,26 @@
 def _restorebackup(fcd, back):
 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
 # util.copy here instead.
-fcd.write(util.readfile(back), fcd.flags())
+fcd.write(back.data(), fcd.flags())
 
-def _makebackup(repo, ui, fcd, premerge):
-"""Makes a backup of the local `fcd` file prior to merging.
+def _makebackup(repo, ui, wctx, fcd, premerge):
+"""Makes and returns a filectx-like object for ``fcd``'s backup file.
 
 In addition to preserving the user's pre-existing modifications to `fcd`
 (if any), the backup is used to undo certain premerges, confirm whether a
 merge changed anything, and determine what line endings the new file should
 have.
 """
 if fcd.isabsent():
 return None
-
+# TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
+# merge -> filemerge). (I suspect the fileset import is the weakest link)
+from . import context
 a = _workingpath(repo, fcd)
 back = scmutil.origpath(ui, repo, a)
 if premerge:
 util.copyfile(a, back)
-return back
+return context.arbitraryfilectx(back, repo=repo)
 
 def _maketempfiles(repo, fco, fca):
 """Writes out `fco` and `fca` as temporary files, so an external merge
@@ -691,7 +694,7 @@
 ui.warn(onfailure % fd)
 return True, 1, False
 
-back = _makebackup(repo, ui, fcd, premerge)
+back = _makebackup(repo, ui, wctx, fcd, premerge)
 files = (None, None, None, back)
 r = 1
 try:
@@ -719,7 +722,7 @@
 return True, r, deleted
 finally:
 if not r and back is not None:
-util.unlink(back)
+back.remove()
 
 def _check(repo, r, ui, tool, fcd, files):
 fd = fcd.path()
@@ -741,7 +744,7 @@
 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
   'changed' in
   _toollist(ui, tool, "check")):
-if back is not None and filecmp.cmp(_workingpath(repo, fcd), back):
+if back is not None and not fcd.cmp(back):
 if ui.promptchoice(_(" output file %s appears unchanged\n"
  "was merge successful (yn)?"
  "$$ &Yes $$ &No") % fd, 1):



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


D1124: test-hgweb-annotate-whitespace: make test compatible with chg

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  https://phab.mercurial-scm.org/D946 fixed a bunch of tests which had the same 
root cause. Please see
  that for details. This seems to be one of the newer tests which fails because
  of the same reason.

TEST PLAN
  Ran the test 'test-hgweb-annotate-whitespace.t' with and without the
  '--chg' option.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-hgweb-annotate-whitespace.t

CHANGE DETAILS

diff --git a/tests/test-hgweb-annotate-whitespace.t 
b/tests/test-hgweb-annotate-whitespace.t
--- a/tests/test-hgweb-annotate-whitespace.t
+++ b/tests/test-hgweb-annotate-whitespace.t
@@ -76,7 +76,7 @@
 
   $ hg serve -p $HGPORT -d --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
-  $ hg --config annotate.ignorews=true serve -p $HGPORT1 -d --pid-file hg.pid
+  $ hg serve --config annotate.ignorews=true -p $HGPORT1 -d --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS
   $ cd ..
 



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


D1057: filemerge: use arbitraryfilectx for backups

2017-10-16 Thread phillco (Phil Cohen)
phillco added inline comments.

INLINE COMMENTS

> durin42 wrote in filemerge.py:604
> Ick. Please add a TODO here to figure out a way to break the cycle (it can be 
> done! I'm sure of it, even if I don't yet know how) and then we can move 
> forward with this.

Sure, will do. I think most likely by breaking the context -> fileset 
dependency.

REPOSITORY
  rHG Mercurial

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

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


D1063: rebase: enable multidest by default

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  (Note that I'd still welcome feedback from non-BigCo contributors here - is 
this something we should make permanent? Have people been testing this? Etc.)

REPOSITORY
  rHG Mercurial

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

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


D1063: rebase: enable multidest by default

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D1063#17791, @martinvonz wrote:
  
  > In https://phab.mercurial-scm.org/D1063#17789, @durin42 wrote:
  >
  > > I'm a fan. Will give it to Monday for any objections.
  >
  >
  > I'm against. I'd like to see that the feature is indeed powerful enough for 
handling the intended use cases before we turn it on. Once it's on, we can't go 
back. The intended use case I'm aware of is to mimic "hg restack", IIUC. Maybe 
you have already switched over to using this (multi-dest rebase) internally at 
FB and seen that it does work well?
  >
  > What's the advantage of turning it on? It seems like very few users would 
use it directly anyway. Won't you provide aliases instead and those aliases 
could then also enable the feature?
  
  
  
  
  In https://phab.mercurial-scm.org/D1063#17931, @quark wrote:
  
  > In https://phab.mercurial-scm.org/D1063#17791, @martinvonz wrote:
  >
  > > In https://phab.mercurial-scm.org/D1063#17789, @durin42 wrote:
  > >
  > > > I'm a fan. Will give it to Monday for any objections.
  > >
  > >
  > > I'm against. I'd like to see that the feature is indeed powerful enough 
for handling the intended use cases before we turn it on. Once it's on, we 
can't go back. The intended use case I'm aware of is to mimic "hg restack", 
IIUC. Maybe you have already switched over to using this (multi-dest rebase) 
internally at FB and seen that it does work well?
  >
  >
  > Define "powerful enough for handling the intended use cases" precisely?
  
  
  I think what @martinvonz is getting at here is that we'd like to have some 
confidence that this is the right interface, by satisfying ourselves that this 
has been at least somewhat fieldtested at FB, if not anywhere else. Have you 
been doing so, and has it helped `hg restack` or whatever be simpler to 
implement?
  
  > 
  > 
  >> What's the advantage of turning it on? It seems like very few users would 
use it directly anyway. Won't you provide aliases instead and those aliases 
could then also enable the feature?
  > 
  > Aliases cannot use `--config`.
  
  Yes, this is a known issue, and largely orthogonal to the concern here IMO 
(could still be done as a shell alias.)

REPOSITORY
  rHG Mercurial

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

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


D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink

2017-10-16 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 2841.
phillco edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1122?vs=2840&id=2841

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

AFFECTED FILES
  mercurial/context.py
  tests/test-arbitraryfilectx.t

CHANGE DETAILS

diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
new file mode 100644
--- /dev/null
+++ b/tests/test-arbitraryfilectx.t
@@ -0,0 +1,58 @@
+Setup:
+  $ cat > eval.py < from __future__ import absolute_import
+  > from mercurial import context, commands, registrar
+  > import filecmp
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command(b'eval', [], 'hg eval CMD')
+  > def eval_(ui, repo, *cmds, **opts):
+  > cmd = " ".join(cmds)
+  > res = str(eval(cmd, globals(), locals()))
+  > ui.warn("%s" % res)
+  > EOF
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "eval=`pwd`/eval.py" >> $HGRCPATH
+
+Arbitraryfilectx.cmp does not follow symlinks:
+  $ mkdir case1
+  $ cd case1
+  $ hg init
+  $ hg eval "repo[None]['real_A'].write('A', '')"
+  None (no-eol)
+  $ echo -n "foo" > A
+  $ echo -n "foo" > B
+  $ ln -s A sym_A
+  $ hg add .
+  adding A
+  adding B
+  adding real_A
+  adding sym_A
+  $ hg commit -m "base"
+
+These files are different and should return True (different):
+(Note that filecmp.cmp's return semantics are inverted from ours, so we invert
+for simplicity):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])"
+  True (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'real_A')"
+  True (no-eol)
+
+These files are identical and should return False (same):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])"
+  False (no-eol)
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])"
+  False (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'B')"
+  False (no-eol)
+
+This comparison should also return False, since A and sym_A are substantially
+the same in the eyes of ``filectx.cmp``, which looks at data only.
+  $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])"
+  False (no-e ol)
+
+A naive use of filecmp on those two would wrongly return True, since it follows
+the symlink to "A", which has different contents.
+  $ hg eval "not filecmp.cmp('real_A', 'sym_A')"
+  True (no-eol)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2561,9 +2561,13 @@
 self._path = path
 
 def cmp(self, fctx):
-if isinstance(fctx, workingfilectx) and self._repo:
+# filecmp follows symlinks whereas `cmp` should not, so skip the fast
+# path if either side is a symlink.
+symlinks = ('l' in self.flags() or 'l' in fctx.flags())
+if isinstance(fctx, workingfilectx) and self._repo and not symlinks:
 # Add a fast-path for merge if both sides are disk-backed.
-# Note that filecmp uses the opposite return values as cmp.
+# Note that filecmp uses the opposite return values (True if same)
+# as our ``cmp`` functions (True if different).
 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
 return self.data() != fctx.data()
 



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


D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink

2017-10-16 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 2840.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1122?vs=2839&id=2840

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

AFFECTED FILES
  mercurial/context.py
  tests/test-arbitraryfilectx.t

CHANGE DETAILS

diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
new file mode 100644
--- /dev/null
+++ b/tests/test-arbitraryfilectx.t
@@ -0,0 +1,58 @@
+Setup:
+  $ cat > eval.py < from __future__ import absolute_import
+  > from mercurial import context, commands, registrar
+  > import filecmp
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command(b'eval', [], 'hg eval CMD')
+  > def eval_(ui, repo, *cmds, **opts):
+  > cmd = " ".join(cmds)
+  > res = str(eval(cmd, globals(), locals()))
+  > ui.warn("%s" % res)
+  > EOF
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "eval=`pwd`/eval.py" >> $HGRCPATH
+
+Arbitraryfilectx.cmp does not follow symlinks:
+  $ mkdir case1
+  $ cd case1
+  $ hg init
+  $ hg eval "repo[None]['real_A'].write('A', '')"
+  None (no-eol)
+  $ echo -n "foo" > A
+  $ echo -n "foo" > B
+  $ ln -s A sym_A
+  $ hg add .
+  adding A
+  adding B
+  adding real_A
+  adding sym_A
+  $ hg commit -m "base"
+
+These files are different and should return True (different):
+(Note that filecmp.cmp's return semantics are inverted from ours, so we invert
+for simplicity):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])"
+  True (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'real_A')"
+  True (no-eol)
+
+These files are identical and should return False (same):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])"
+  False (no-eol)
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])"
+  False (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'B')"
+  False (no-eol)
+
+This comparison should also return False, since A and sym_A are substantially
+the same in the eyes of ``filectx.cmp``, which looks at data only.
+  $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])"
+  False (no-eol)
+
+A naive use of filecmp on those two would wrongly return True, since it follows
+the symlink to "A", which has different contents.
+  $ hg eval "not filecmp.cmp('real_A', 'sym_A')"
+  True (no-eol)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2561,9 +2561,13 @@
 self._path = path
 
 def cmp(self, fctx):
-if isinstance(fctx, workingfilectx) and self._repo:
+# filecmp follows symlinks whereas `cmp` should not, so skip the fast
+# path if either side is a symlink.
+symlinks = ('l' in self.flags() or 'l' in fctx.flags())
+if isinstance(fctx, workingfilectx) and self._repo and not symlinks:
 # Add a fast-path for merge if both sides are disk-backed.
-# Note that filecmp uses the opposite return values as cmp.
+# Note that filecmp uses the opposite return values (True if same)
+# as our ``cmp`` functions (True if different).
 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
 return self.data() != fctx.data()
 



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


D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink

2017-10-16 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 2839.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1122?vs=2838&id=2839

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

AFFECTED FILES
  mercurial/context.py
  tests/test-arbitraryfilectx.t

CHANGE DETAILS

diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
new file mode 100644
--- /dev/null
+++ b/tests/test-arbitraryfilectx.t
@@ -0,0 +1,58 @@
+Setup:
+  $ cat > eval.py < from __future__ import absolute_import
+  > from mercurial import context, commands, registrar
+  > import filecmp
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command(b'eval', [], 'hg eval CMD')
+  > def eval_(ui, repo, *cmds, **opts):
+  > cmd = " ".join(cmds)
+  > res = str(eval(cmd, globals(), locals()))
+  > ui.warn("%s" % res)
+  > EOF
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "eval=`pwd`/eval.py" >> $HGRCPATH
+
+Arbitraryfilectx.cmp does not follow symlinks:
+  $ mkdir case1
+  $ cd case1
+  $ hg init
+  $ hg eval "repo[None]['real_A'].write('A', '')"
+  None (no-eol)
+  $ echo -n "foo" > A
+  $ echo -n "foo" > B
+  $ ln -s A sym_A
+  $ hg add .
+  adding A
+  adding B
+  adding real_A
+  adding sym_A
+  $ hg commit -m "base"
+
+These files are different and should return True (different):
+(Note that filecmp.cmp's return semantics are inverted from ours, so we invert
+for simplicity):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])"
+  True (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'real_A')"
+  True (no-eol)
+
+These files are identical and should return False (same):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])"
+  False (no-eol)
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])"
+  False (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'B')"
+  False (no-eol)
+
+This comparison should also return False, since A and sym_A are substantially
+the same in the eyes of ``filectx.cmp``, which looks at data only.
+  $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])"
+  False (no-eol)
+
+A naive use of filecmp on those two would wrongly return True, since it follows
+the symlink:
+  $ hg eval "not filecmp.cmp('real_A', 'sym_A')"
+  True (no-eol)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2561,9 +2561,13 @@
 self._path = path
 
 def cmp(self, fctx):
-if isinstance(fctx, workingfilectx) and self._repo:
+# filecmp follows symlinks whereas `cmp` should not, so skip the fast
+# path if either side is a symlink.
+symlinks = ('l' in self.flags() or 'l' in fctx.flags())
+if isinstance(fctx, workingfilectx) and self._repo and not symlinks:
 # Add a fast-path for merge if both sides are disk-backed.
-# Note that filecmp uses the opposite return values as cmp.
+# Note that filecmp uses the opposite return values (True if same)
+# as our ``cmp`` functions (True if different).
 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
 return self.data() != fctx.data()
 



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


D1056: context: add a fast-comparision path between arbitraryfilectx and workingfilectx

2017-10-16 Thread phillco (Phil Cohen)
phillco added a comment.


  Done: https://phab.mercurial-scm.org/D1122.

REPOSITORY
  rHG Mercurial

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

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


D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink

2017-10-16 Thread phillco (Phil Cohen)
phillco updated this revision to Diff 2838.
phillco edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1122?vs=2836&id=2838

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

AFFECTED FILES
  mercurial/context.py
  tests/test-arbitraryfilectx.t

CHANGE DETAILS

diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t
new file mode 100644
--- /dev/null
+++ b/tests/test-arbitraryfilectx.t
@@ -0,0 +1,58 @@
+Setup:
+  $ cat > eval.py < from __future__ import absolute_import
+  > from mercurial import context, commands, registrar
+  > import filecmp
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command(b'eval', [], 'hg eval CMD')
+  > def eval_(ui, repo, *cmds, **opts):
+  > cmd = " ".join(cmds)
+  > res = str(eval(cmd, globals(), locals()))
+  > ui.warn("%s" % res)
+  > EOF
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "eval=`pwd`/eval.py" >> $HGRCPATH
+
+Arbitraryfilectx.cmp does not follow symlinks:
+  $ mkdir case1
+  $ cd case1
+  $ hg init
+  $ hg eval "repo[None]['real_A'].write('A', '')"
+  None (no-eol)
+  $ echo -n "foo" > A
+  $ echo -n "foo" > B
+  $ ln -s A sym_A
+  $ hg add .
+  adding A
+  adding B
+  adding real_A
+  adding sym_A
+  $ hg commit -m "base"
+
+These files are different and should return True (different):
+(Note that filecmp.cmp's return semantics are inverted from ours, so we invert
+for simplicity):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['real_A'])"
+  True (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'real_A')"
+  True (no-eol)
+
+These files are identical and should return False (same):
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['A'])"
+  False (no-eol)
+  $ hg eval "context.arbitraryfilectx('A', repo).cmp(repo[None]['B'])"
+  False (no-eol)
+  $ hg eval "not filecmp.cmp('A', 'B')"
+  False (no-eol)
+
+This comparison should also return False, since A and sym_A are substantially
+different in the eyes of cmp (which looks at data only).
+  $ hg eval "context.arbitraryfilectx('real_A', repo).cmp(repo[None]['sym_A'])"
+  False (no-eol)
+
+A naive use of filecmp on those two would wrongly return True, since it follows
+the symlink:
+  $ hg eval "not filecmp.cmp('real_A', 'sym_A')"
+  True (no-eol)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2561,9 +2561,13 @@
 self._path = path
 
 def cmp(self, fctx):
-if isinstance(fctx, workingfilectx) and self._repo:
+# filecmp follows symlinks whereas `cmp` should not, so skip the fast
+# path if either side is a symlink.
+symlinks = ('l' in self.flags() or 'l' in fctx.flags())
+if isinstance(fctx, workingfilectx) and self._repo and not symlinks:
 # Add a fast-path for merge if both sides are disk-backed.
-# Note that filecmp uses the opposite return values as cmp.
+# Note that filecmp uses the opposite return values (True if same)
+# as our ``cmp`` functions (True if different).
 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))
 return self.data() != fctx.data()
 



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


D1123: histedit: remove the nonexistant config 'histeditng'

2017-10-16 Thread singhsrb (Saurabh Singh)
singhsrb created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  https://phab.mercurial-scm.org/D942 removed the experimental config 
'histeditng'. This is a leftover
  which should have been removed in that commit. Therefore, this commit 
completes
  the cleanup.

TEST PLAN
  Ran all the tests.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -220,9 +220,6 @@
 configitem('experimental', 'histedit.autoverb',
 default=False,
 )
-configitem('experimental', 'histeditng',
-default=False,
-)
 configitem('histedit', 'defaultrev',
 default=configitems.dynamicdefault,
 )



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


D785: context: also consider path conflicts when clearing unknown files

2017-10-16 Thread swhitaker (Simon Whitaker)
swhitaker added inline comments.

INLINE COMMENTS

> context.py:1941
> +if wvfs.isfileorlink(p):
> +wvfs.unlink(p)
> +break

This breaks test-audit-path.t on macOS. In the test "attack /tmp/test", we call 
this codepath with f == '/tmp/test'. util.finddirs finds '/tmp', which on macOS 
is a symlink to /private/tmp, so L1940 is true and on L1941 we try to unlink 
/tmp.

@mbthomas Is it intentional that we try to unlink symlinks to directories here? 
If not, we can fix this with:

  -if wvfs.isfileorlink(p):
  +if wvfs.isfileorlink(p) and not wvfs.isdir(p):

REPOSITORY
  rHG Mercurial

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

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


mercurial@34681: 32 new changesets

2017-10-16 Thread Mercurial Commits
32 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/6c85f4e3d914
changeset:   34650:6c85f4e3d914
user:Boris Feld 
date:Fri Sep 29 19:59:15 2017 +0100
summary: test: add a test file dedicated to an important distributed case

https://www.mercurial-scm.org/repo/hg/rev/e88dbbcf2a56
changeset:   34651:e88dbbcf2a56
user:Boris Feld 
date:Sat Sep 30 22:37:20 2017 +0100
summary: test: add an extra case for obsolescence distributed case

https://www.mercurial-scm.org/repo/hg/rev/174d115d8104
changeset:   34652:174d115d8104
user:Yuya Nishihara 
date:Fri Oct 13 22:38:24 2017 +0900
summary: bdiff: include compat.h in header to define ssize_t

https://www.mercurial-scm.org/repo/hg/rev/8bea493e7297
changeset:   34653:8bea493e7297
user:Yuya Nishihara 
date:Fri Oct 13 00:14:28 2017 +0900
summary: configitems: correct default values of web.allow and 
web.hidden

https://www.mercurial-scm.org/repo/hg/rev/4182d2065e7a
changeset:   34654:4182d2065e7a
user:Yuya Nishihara 
date:Fri Oct 13 00:22:54 2017 +0900
summary: configitems: drop redundant default of web.allow

https://www.mercurial-scm.org/repo/hg/rev/01c57eeb35cb
changeset:   34655:01c57eeb35cb
user:Yuya Nishihara 
date:Thu Oct 12 22:21:14 2017 +0900
summary: chg: remove outdated rule to start test server

https://www.mercurial-scm.org/repo/hg/rev/eb7fffdc6e5b
changeset:   34656:eb7fffdc6e5b
user:Yuya Nishihara 
date:Thu Oct 12 21:42:42 2017 +0900
summary: help: fix formatting of template keywords

https://www.mercurial-scm.org/repo/hg/rev/bfb6fd93b637
changeset:   34657:bfb6fd93b637
user:Yuya Nishihara 
date:Thu Oct 12 21:48:02 2017 +0900
summary: help: hide template keywords of obsolescence as they are still 
experimental

https://www.mercurial-scm.org/repo/hg/rev/dbe1f5118864
changeset:   34658:dbe1f5118864
user:Yuya Nishihara 
date:Thu Oct 12 21:56:13 2017 +0900
summary: help: use single quotes in ``template example``

https://www.mercurial-scm.org/repo/hg/rev/3edfd472f3cb
changeset:   34659:3edfd472f3cb
user:Yuya Nishihara 
date:Thu Oct 12 22:09:11 2017 +0900
summary: templater: fix ifcontains() to handle type mismatch gracefully

https://www.mercurial-scm.org/repo/hg/rev/d00ec62d156f
changeset:   34660:d00ec62d156f
user:Yuya Nishihara 
date:Fri Oct 13 21:36:10 2017 +0900
summary: i18n: cache translated messages per encoding

https://www.mercurial-scm.org/repo/hg/rev/eb586ed5d8ce
changeset:   34661:eb586ed5d8ce
user:Denis Laxalde 
date:Thu Oct 12 09:39:50 2017 +0200
summary: transaction-summary: show the range of new revisions upon 
pull/unbundle (BC)

https://www.mercurial-scm.org/repo/hg/rev/181d913b17e6
changeset:   34662:181d913b17e6
user:Boris Feld 
date:Tue Oct 10 10:49:15 2017 +0200
summary: configitems: allow for the registration of "generic" config item

https://www.mercurial-scm.org/repo/hg/rev/6de7842290b2
changeset:   34663:6de7842290b2
user:Boris Feld 
date:Sun Oct 08 20:26:25 2017 +0200
summary: configitems: register the 'alias' section

https://www.mercurial-scm.org/repo/hg/rev/a0c2a19d64e7
changeset:   34664:a0c2a19d64e7
user:Boris Feld 
date:Tue Oct 10 10:49:28 2017 +0200
summary: configitems: register the 'color' section

https://www.mercurial-scm.org/repo/hg/rev/dd1357edff37
changeset:   34665:dd1357edff37
user:Boris Feld 
date:Sun Oct 08 21:02:02 2017 +0200
summary: configitems: register the 'committemplate' section

https://www.mercurial-scm.org/repo/hg/rev/e7966337aed0
changeset:   34666:e7966337aed0
user:Boris Feld 
date:Sun Oct 08 20:39:51 2017 +0200
summary: configitems: register the 'defaults' section

https://www.mercurial-scm.org/repo/hg/rev/23f891164e59
changeset:   34667:23f891164e59
user:Boris Feld 
date:Tue Oct 10 10:48:47 2017 +0200
summary: configitems: register the 'extensions' section

https://www.mercurial-scm.org/repo/hg/rev/31723cff35fa
changeset:   34668:31723cff35fa
user:Boris Feld 
date:Fri Oct 13 16:39:06 2017 +0200
summary: configitems: register the 'hooks' config section

https://www.mercurial-scm.org/repo/hg/rev/03f7db5f8e71
changeset:   34669:03f7db5f8e71
user:Boris Feld 
date:Wed Oct 11 02:26:09 2017 +0200
summary: configitems: register the 'pager.attend-.*' options

https://www.mercurial-scm.org/repo/hg/rev/ec45d7a6d799
changeset:   34670:ec45d7a6d799
user:Boris Feld 
date:Wed Oct 11 05:01:55 2017 +0200
summary: configitems: register the 'paths' config section

https://www.mercurial-scm.org/repo/hg/rev/16d73491416b
changeset:   34671:16d73491416b
user:Boris Feld 
date:Sun Oct 08 21:29:24 2017 +0200
summary: configitems: register the 'templates' section

https://ww

D1057: filemerge: use arbitraryfilectx for backups

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> phillco wrote in filemerge.py:604
> I don't think so, because the filectx classes reference the ctx classes in 
> various places.

Ick. Please add a TODO here to figure out a way to break the cycle (it can be 
done! I'm sure of it, even if I don't yet know how) and then we can move 
forward with this.

REPOSITORY
  rHG Mercurial

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

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


D1122: arbitraryfilecontext: skip the cmp fast path if any side is a symlink

2017-10-16 Thread phillco (Phil Cohen)
phillco 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/D1122

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2561,7 +2561,10 @@
 self._path = path
 
 def cmp(self, fctx):
-if isinstance(fctx, workingfilectx) and self._repo:
+# filecmp follows symlinks whereas `cmp` should not, so skip the fast
+# path if either side is a symlink.
+symlinks = ('l' in self.flags() or 'l' in fctx.flags())
+if isinstance(fctx, workingfilectx) and self._repo and not symlinks:
 # Add a fast-path for merge if both sides are disk-backed.
 # Note that filecmp uses the opposite return values as cmp.
 return not filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))



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


D1056: context: add a fast-comparision path between arbitraryfilectx and workingfilectx

2017-10-16 Thread durin42 (Augie Fackler)
durin42 added a comment.


  For now, send a follow-up to not do that fast-path if it's a symlink, and we 
can reason more carefully about this API during the freeze with an eye towards 
landing something better in 4.5...

REPOSITORY
  rHG Mercurial

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

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


D1082: split: new extension to split changesets

2017-10-16 Thread quark (Jun Wu)
quark added inline comments.

INLINE COMMENTS

> martinvonz wrote in test-split.t:487-493
> Leaving these two behind seems reasonable. It would also be reasonable to 
> evolve/stabilize them. Either way, it's different from what "hg rebase" does. 
> Do we eventually want them to behave the same? If so, are we okay with a 
> small BC break here (either in split or in rebase)?

>   It would also be reasonable to evolve/stabilize them. 

Only if we know that would not cause conflicts. Otherwise I don't think it's 
reasonable to do that automatically. This is also a difference between split's 
rebase and rebase command itself. The former cares about no-conflict experience 
and the latter does not care.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 4 of 4 v3] log: add -L/--line-range option to follow file history by line range

2017-10-16 Thread Denis Laxalde

Augie Fackler a écrit :

(+jordigh, themystic, indygreg in case one of them has an opinion or 
inspiration)


On Oct 13, 2017, at 10:24 AM, Yuya Nishihara  wrote:

On Fri, 13 Oct 2017 10:02:07 +0200, Denis Laxalde wrote:

Yuya Nishihara a écrit :

On Tue, 10 Oct 2017 17:37:27 +0200, Denis Laxalde wrote:

# HG changeset patch
# User Denis Laxalde 
# Date 1507290475 -7200
#  Fri Oct 06 13:47:55 2017 +0200
# Node ID a05d3b45319a9ec28205f19dd7012b206a2b200f
# Parent  86a055d1c06f55daeb5d725187b61522974d24e3
# Available At http://hg.logilab.org/users/dlaxalde/hg
#  hg pull http://hg.logilab.org/users/dlaxalde/hg -r a05d3b45319a
# EXP-Topic followlines-cli/v2
log: add -L/--line-range option to follow file history by line range


The series generally looks good to me in functionality POV. Some nits follow.


Nits addressed in v4 which I can send now or once we agree on the UI.



So, do we really like this UI?


For the record, there are currently two proposals:

1. The one implemented in this patch that adds a -L option to specify
both the file and its line range:

  hg log -L file.c,13-23 -L main.c,2-6

2. The idea by Yuya to have pairs of -L FROMLINE-TOLINE options and
regular FILE arguments

  hg log -L 13-23 file.c -L 2-6 main.c

The issue with this one (as explained in [1]) is that option parsing
would not be strict, meaning that (IIUC) we would allow:

  hg log -L 13-23 -L 2-6 file.c main.c

to work the same as the previous example.


Thanks for the great summary. Some other crazy proposals just came up:

3. Extend the fileset syntax

  hg log set:file.c@13-23 set:main.c@2-6

but we have to always type 'set:'

4. Reuse the matcher kind to carry linerange in pats

  hg log file.c L:13-23 main.c L:2-6

linerange: and L: are preprocessed to be paired with the previous file
pattern.

Another UI concern is whether --follow should be implied or required:

  hg log -L file.c,13-23  (implies --follow)

or

  hg log -L file.c,13-23  (abort)
  hg log --follow -L file.c,13-23

If we take the latter, a plain file pattern can be used to select all lines.

  hg log --follow -L file.c,13-23 main.c


I feel like the -L file.c,13-23 is the least ambiguous option in terms of 
understanding what a command *does*, and probably also the easiest to actually 
implement with our command line parser. The others feel clever in a way that 
kind of makes me nervous.

I guess that’s to say, +0 on that version, and I think my second choice is the 
fileset syntax option? None of these enthuse me, but I’d be enthusiastic about 
landing the feature *somehow*. I’m hesitant to not ship this series with 4.4, 
as it seems like this is just complicated enough we’ll have to do something 
that’s a compromise no matter what to make it work on the command line.



So, what should I do to move forward? I'd really like to get this in for 
4.4. I'm happy to change anything, but need something actionable :)

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


D1082: split: new extension to split changesets

2017-10-16 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D1082#18648, @lothiraldan wrote:
  
  > It will be great to have split in core, even if it's only as an 
experimental experiment for now.
  >
  > I like the UX improvements, but could we add a config knob to disable the 
auto-rebase for power-users? I agree that generating orphans is maybe not the 
best UX for users, so I think having it on by default could be an improvement.
  
  
  I believe most users want auto-rebase by default. Auto-rebase is the default 
at FB for months and people like it.
  
  I agree power users may want a different default. In that case, you can set 
alias `split = split --no-rebase`.
  
  > But, I often am in the middle of a too big stack and auto-rebasing would 
break my flow of fixing commits from bottom to top without mentioning the 
number of obs-markers it would generate.

INLINE COMMENTS

> martinvonz wrote in test-split.t:487-493
> Leaving these two behind seems reasonable. It would also be reasonable to 
> evolve/stabilize them. Either way, it's different from what "hg rebase" does. 
> Do we eventually want them to behave the same? If so, are we okay with a 
> small BC break here (either in split or in rebase)?

I don't understand why you think "it's different from what "hg rebase" does". 
The `--rebase` flag does not suggest what rebase source or destination it uses. 
So it's up to the `split` implementation to do a reasonable thing. It can do 
`-r SMART_REVSET -d ...` instead of `-s SINGLE_REV -d ...`. I can revise the 
help text to clarify.

I think we wanted to implement "Option 2 (skip troublemakers)" as the default 
behavior in https://www.mercurial-scm.org/wiki/CEDRebase according to previous 
sprint discussion. That said, I don't think that should block this patch.

REPOSITORY
  rHG Mercurial

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

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


D1097: releasenotes: don't abort is there is a bad formatted entry for releasenotes

2017-10-16 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 2833.
pulkit edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1097?vs=2787&id=2833

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

AFFECTED FILES
  hgext/releasenotes.py

CHANGE DETAILS

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -24,6 +24,7 @@
 config,
 error,
 minirst,
+node,
 registrar,
 scmutil,
 util,
@@ -333,9 +334,8 @@
 
 # TODO consider using title as paragraph for more concise notes.
 if not paragraphs:
-raise error.Abort(_('could not find content for release note '
-'%s') % directive)
-
+repo.ui.warn(_("error parsing releasenotes for revision: "
+   "'%s'\n") % node.hex(ctx.node()))
 if title:
 notes.addtitleditem(directive, title, paragraphs)
 else:



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


D1121: releasenotes: show a warning if fuzzywuzzy is not present

2017-10-16 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/D1121

AFFECTED FILES
  hgext/releasenotes.py

CHANGE DETAILS

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -99,6 +99,10 @@
 
 This is used to combine multiple sources of release notes together.
 """
+if not fuzz:
+ui.warn(_("module 'fuzzywuzzy' not found, merging of similar"
+  " releasenotes is disbaled"))
+
 for section in other:
 existingnotes = converttitled(self.titledforsection(section)) + \
 convertnontitled(self.nontitledforsection(section))



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


D1120: releasenotes: move import of fuzzywuzzy to import level

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

REVISION SUMMARY
  This will help us in determining easily that whether fuzzywuzzy is loaded or 
not
  loaded in any of the function.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/releasenotes.py

CHANGE DETAILS

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -32,6 +32,12 @@
 cmdtable = {}
 command = registrar.command(cmdtable)
 
+try:
+import fuzzywuzzy.fuzz as fuzz
+fuzz.token_set_ratio
+except ImportError:
+fuzz = None
+
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
@@ -218,10 +224,8 @@
 """
 Returns false when note fragment can be merged to existing notes.
 """
-try:
-import fuzzywuzzy.fuzz as fuzz
-fuzz.token_set_ratio
-except ImportError:
+# fuzzywuzzy not present
+if not fuzz:
 return True
 
 merge = True



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


D1119: releasenotes: fix documentation of similaritycheck()

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

REVISION SUMMARY
  The function document says that it returns true when the fragment can be 
merged,
  but if you see the function just above it which is similar(), it writes 
already
  exists thing if return value from similaritycheck() is False which is just
  opposite of the doc. This patch fixes that.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/releasenotes.py

CHANGE DETAILS

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -216,7 +216,7 @@
 
 def similaritycheck(incoming_str, existingnotes):
 """
-Returns true when note fragment can be merged to existing notes.
+Returns false when note fragment can be merged to existing notes.
 """
 import fuzzywuzzy.fuzz as fuzz
 merge = True



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


D1096: releasenotes: make the import of fuzzywuzzy optional

2017-10-16 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 2830.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1096?vs=2786&id=2830

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

AFFECTED FILES
  hgext/releasenotes.py

CHANGE DETAILS

diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -218,7 +218,12 @@
 """
 Returns false when note fragment can be merged to existing notes.
 """
-import fuzzywuzzy.fuzz as fuzz
+try:
+import fuzzywuzzy.fuzz as fuzz
+fuzz.token_set_ratio
+except ImportError:
+return True
+
 merge = True
 for bullet in existingnotes:
 score = fuzz.token_set_ratio(incoming_str, bullet)



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


[PATCH 5 of 8 V2] phase: introduce a new 'check:phases' part

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507698782 -7200
#  Wed Oct 11 07:13:02 2017 +0200
# Node ID 3e12cfeb7b0177e2efdd39de00dc7f03d944
# Parent  c581583a2c085662c9a59f55f2483a2c748eb573
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
3e12cfeb7b01
phase: introduce a new 'check:phases' part

This part check check if revisions are still in the same phase as when the
bundle was generated. This is similar to what 'check:heads' or
'check:updated-heads' bundle2 part achieves for changesets.

We needs seems before we can move away from pushkey usage from phase since
pushkey has it own built-in push-race detection.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -157,6 +157,7 @@
 from . import (
 changegroup,
 error,
+node as nodemod,
 obsolete,
 phases,
 pushkey,
@@ -1749,6 +1750,26 @@
 raise error.PushRaced('repository changed while pushing - '
   'please try again')
 
+@parthandler('check:phases')
+def handlecheckphases(op, inpart):
+"""check that phase of the repository did not changed
+
+This is used to detect a push race."""
+phasetonodes = phases.binarydecode(inpart)
+unfi = op.repo.unfiltered()
+cl = unfi.changelog
+phasecache = unfi._phasecache
+msg = ('repository changed while pushing - please try again '
+   '(%s is %s expected %s)')
+for expectedphase, nodes in enumerate(phasetonodes):
+for n in nodes:
+actualphase = phasecache.phase(unfi, cl.rev(n))
+if actualphase != expectedphase:
+finalmsg = msg % (nodemod.short(n),
+  phases.phasenames[actualphase],
+  phases.phasenames[expectedphase])
+raise error.PushRaced(finalmsg)
+
 @parthandler('output')
 def handleoutput(op, inpart):
 """forward output captured on the server to the client"""
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 8 of 8 V2] phase: use a binary phase part to push through bundle2 (BC)

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1505929086 -7200
#  Wed Sep 20 19:38:06 2017 +0200
# Node ID 76e192debcd8036c6695b56681ca096690322880
# Parent  9c084f14df72a2d511d414e0ecf50a086c0a2341
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
76e192debcd8
phase: use a binary phase part to push through bundle2 (BC)

The part we are using for pull is now used for push too. As we no longer use
pushkey, pushkey hook are no longer triggered. This is an obvious backward
incompatible change. We could artificially trigger the pushkey hook within the
bundle2 part, but this seemed too hacky to me.

An option would be to disable by default this new mechanism for a couple of
versions to help people migrate to `txnclose-phase`. I took the liberal and
optimistic path to just turn it on by default directly.

.. bc::

   Push no longer trigger a pushkey hook when updating phases.  Use the new
   `txnclose-phase` and `txnclose-phase` hooks instead.
   (Apply when both server and client use version 4.4 or above).

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -806,9 +806,26 @@
 if 'phases' in pushop.stepsdone:
 return
 b2caps = bundle2.bundle2caps(pushop.remote)
-if 'pushkey' in b2caps:
+ui = pushop.repo.ui
+
+legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange')
+haspushkey = 'pushkey' in b2caps
+hasphaseheads = 'heads' in b2caps.get('phases', ())
+
+if hasphaseheads and not legacyphase:
+_pushb2phaseheads(pushop, bundler)
+elif haspushkey:
 _pushb2phasespushkey(pushop, bundler)
 
+def _pushb2phaseheads(pushop, bundler):
+"""push phase information through a bundle2 - pushkey part"""
+pushop.stepsdone.add('phases')
+if pushop.outdatedphases:
+updates = [[] for p in phases.allphases]
+updates[0].extend(h.node() for h in pushop.outdatedphases)
+phasedata = phases.binaryencode(updates)
+bundler.newpart('phase-heads', data=phasedata)
+
 def _pushb2phasespushkey(pushop, bundler):
 """push phase information through a bundle2 - pushkey part"""
 pushop.stepsdone.add('phases')
diff --git a/tests/test-acl.t b/tests/test-acl.t
--- a/tests/test-acl.t
+++ b/tests/test-acl.t
@@ -97,7 +97,7 @@
   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: "pushkey" (params: 4 mandatory) empty 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
@@ -117,17 +117,15 @@
   adding quux/file.py revisions
   added 3 changesets with 3 changes to 3 files
   bundle2-input-part: total payload size 1553
-  bundle2-input-part: "pushkey" (params: 4 mandatory) supported
-  pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955"
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
   bundle2-input-bundle: 4 parts total
   updating the branch cache
-  bundle2-output-bundle: "HG20", 2 parts total
+  bundle2-output-bundle: "HG20", 1 parts total
   bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) 
empty payload
-  bundle2-output-part: "reply:pushkey" (params: 0 advisory) empty payload
   bundle2-input-bundle: no-transaction
   bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) 
supported
-  bundle2-input-part: "reply:pushkey" (params: 0 advisory) supported
-  bundle2-input-bundle: 1 parts total
+  bundle2-input-bundle: 0 parts total
   listing keys for "phases"
   repository tip rolled back to revision 0 (undo push)
   0:6675d58eff77
@@ -162,7 +160,7 @@
   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: "pushkey" (params: 4 mandatory) empty 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
@@ -184,17 +182,15 @@
   calling hook pretxnchangegroup.acl: hgext.acl.hook
   acl: changes have source "push" - skipping
   bundle2-input-part: total payload size 1553
-  bundle2-input-part: "pushkey" (params: 4 mandatory) supported
-  pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955"
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
   bundle2-input-bundle: 4 parts total
   updating the branch cache
-  bundle2-output-bundle: "HG20", 2 parts total
+  bundle2-output-bundle: "HG20", 1 parts total
   bundle2-output-part: "

Re: [PATCH 8 of 8] phase: use a binary phase part to push through bundle2 (BC)

2017-10-16 Thread Boris Feld
On Mon, 2017-10-16 at 19:33 +0530, Pulkit Goyal wrote:
> On Mon, Oct 16, 2017 at 7:11 PM, Boris Feld 
> wrote:
> > # HG changeset patch
> > # User Boris Feld 
> > # Date 1505929086 -7200
> > #  Wed Sep 20 19:38:06 2017 +0200
> > # Node ID cd40bc7040c08dad560f14300c1f665914dded19
> > # Parent  9c084f14df72a2d511d414e0ecf50a086c0a2341
> > # EXP-Topic b2.phases.push
> > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > #  hg pull https://bitbucket.org/octobus/mercurial-deve
> > l/ -r cd40bc7040c0
> > phase: use a binary phase part to push through bundle2 (BC)
> 
> Since this is a BC patch, can you please add a releasenotes part to
> the commit message?
> For reference: https://www.mercurial-scm.org/wiki/ReleasenotesExtensi
> on

Sure, I just sent a follow-up.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 8 V2] phase: generate a push-race detection part on push

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507700400 -7200
#  Wed Oct 11 07:40:00 2017 +0200
# Node ID e688d8b13100c464897c7f872c498202f8e82272
# Parent  3e12cfeb7b0177e2efdd39de00dc7f03d944
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
e688d8b13100
phase: generate a push-race detection part on push

We are about to switch phase pushing from using pushkey to using a the new
dedicated binary part. We introduce the push race detection on its own to help
detect potential impact.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -735,6 +735,31 @@
 data = iter(sorted(affected))
 bundler.newpart('check:updated-heads', data=data)
 
+def _pushing(pushop):
+"""return True if we are pushing anything"""
+return bool(pushop.outgoing.missing
+or pushop.outdatedphases
+or pushop.outobsmarkers
+or pushop.outbookmarks)
+
+@b2partsgenerator('check-phases')
+def _pushb2checkphases(pushop, bundler):
+"""insert phase move checking"""
+if not _pushing(pushop) or pushop.force:
+return
+b2caps = bundle2.bundle2caps(pushop.remote)
+hasphaseheads = 'heads' in b2caps.get('phases', ())
+if pushop.remotephases is not None and hasphaseheads:
+# check that the remote phase has not changed
+checks = [[] for p in phases.allphases]
+checks[phases.public].extend(pushop.remotephases.publicheads)
+checks[phases.draft].extend(pushop.remotephases.draftroots)
+if any(checks):
+for nodes in checks:
+nodes.sort()
+checkdata = phases.binaryencode(checks)
+bundler.newpart('check:phases', data=checkdata)
+
 @b2partsgenerator('changeset')
 def _pushb2ctx(pushop, bundler):
 """handle changegroup push through bundle2
diff --git a/tests/test-acl.t b/tests/test-acl.t
--- a/tests/test-acl.t
+++ b/tests/test-acl.t
@@ -92,14 +92,17 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  bundle2-output-bundle: "HG20", 4 parts total
+  bundle2-output-bundle: "HG20", 5 parts total
   bundle2-output-part: "replycaps" 168 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: "pushkey" (params: 4 mandatory) empty payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
   bundle2-input-part: total payload size 168
+  bundle2-input-part: "check:phases" supported
+  bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
   bundle2-input-part: total payload size 20
   bundle2-input-part: "changegroup" (params: 1 mandatory) supported
@@ -116,7 +119,7 @@
   bundle2-input-part: total payload size 1553
   bundle2-input-part: "pushkey" (params: 4 mandatory) supported
   pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955"
-  bundle2-input-bundle: 3 parts total
+  bundle2-input-bundle: 4 parts total
   updating the branch cache
   bundle2-output-bundle: "HG20", 2 parts total
   bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) 
empty payload
@@ -154,14 +157,17 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  bundle2-output-bundle: "HG20", 4 parts total
+  bundle2-output-bundle: "HG20", 5 parts total
   bundle2-output-part: "replycaps" 168 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: "pushkey" (params: 4 mandatory) empty payload
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "replycaps" supported
   bundle2-input-part: total payload size 168
+  bundle2-input-part: "check:phases" supported
+  bundle2-input-part: total payload size 24
   bundle2-input-part: "check:heads" supported
   bundle2-input-part: total payload size 20
   bundle2-input-part: "changegroup" (params: 1 mandatory) supported
@@ -180,7 +186,7 @@
   bundle2-input-part: total payload size 1553
   bundle2-input-part: "pushkey" (params: 4 mandatory) supported
   pushing key for "phases:911600dab2ae7a9baff75958b84fe606851ce955"
-  bundle2-input-bundle: 3 parts total
+  bundle2-input-bundle: 4 parts total
   updating the branch cache
   bundle2-output-bundle: "HG20", 2 parts total
   bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) 
empty payload
@@ -219,14 +225,17 @@
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff

[PATCH 7 of 8 V2] phase: isolate logic to update remote phrase through bundle2 pushkey

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1505927857 -7200
#  Wed Sep 20 19:17:37 2017 +0200
# Node ID 9c084f14df72a2d511d414e0ecf50a086c0a2341
# Parent  e688d8b13100c464897c7f872c498202f8e82272
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9c084f14df72
phase: isolate logic to update remote phrase through bundle2 pushkey

Move the logic to build bundle2 pushkey part into its dedicated function. It
will help to keep the logic clear when adding support for sending phases change
using 'phase-heads' part.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -806,8 +806,11 @@
 if 'phases' in pushop.stepsdone:
 return
 b2caps = bundle2.bundle2caps(pushop.remote)
-if not 'pushkey' in b2caps:
-return
+if 'pushkey' in b2caps:
+_pushb2phasespushkey(pushop, bundler)
+
+def _pushb2phasespushkey(pushop, bundler):
+"""push phase information through a bundle2 - pushkey part"""
 pushop.stepsdone.add('phases')
 part2node = []
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 8 V2] phase: filter out non-draft item in "draft root"

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507745282 -7200
#  Wed Oct 11 20:08:02 2017 +0200
# Node ID 629de091478a249c97ce410733c8520aaec779f2
# Parent  a652b7763f669683eb5540c6d4b77ee18e55bc80
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
629de091478a
phase: filter out non-draft item in "draft root"

The on-disk file can contain draft root that are descendants of secret root.
The resulting phase computation is correct, but the phases root content is
not. I will send another series to introduce code that remove some of the
cases where this can happens, but we first need to damage control the existing
case.

After this changeset, we can no longer advertise secret changeset as draft
root.

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -502,8 +502,10 @@
 # Use ordered dictionary so behavior is deterministic.
 keys = util.sortdict()
 value = '%i' % draft
+cl = repo.unfiltered().changelog
 for root in repo._phasecache.phaseroots[draft]:
-keys[hex(root)] = value
+if repo._phasecache.phase(repo, cl.rev(root)) <= draft:
+keys[hex(root)] = value
 
 if repo.publishing():
 # Add an extra data to let remote know we are a publishing
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 8 V2] phase: gather remote phase information in a summary object

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507739944 -7200
#  Wed Oct 11 18:39:04 2017 +0200
# Node ID c581583a2c085662c9a59f55f2483a2c748eb573
# Parent  9fb76d6c80d20b5af8ee1d0e7d6c221924b1d7bb
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
c581583a2c08
phase: gather remote phase information in a summary object

We keep useful phase information around. The data will be reused with detecting
push-race in later changesets.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -340,6 +340,8 @@
 self.pushbranchmap = None
 # testable as a boolean indicating if any nodes are missing locally.
 self.incoming = None
+# summary of the remote phase situation
+self.remotephases = None
 # phases changes that must be pushed along side the changesets
 self.outdatedphases = None
 # phases changes that must be pushed if changeset push fails
@@ -527,7 +529,6 @@
 outgoing = pushop.outgoing
 unfi = pushop.repo.unfiltered()
 remotephases = pushop.remote.listkeys('phases')
-publishing = remotephases.get('publishing', False)
 if (pushop.ui.configbool('ui', '_usedassubrepo')
 and remotephases# server supports phases
 and not pushop.outgoing.missing # no changesets to be pushed
@@ -544,12 +545,14 @@
 pushop.outdatedphases = []
 pushop.fallbackoutdatedphases = []
 return
-ana = phases.analyzeremotephases(pushop.repo,
- pushop.fallbackheads,
- remotephases)
-pheads, droots = ana
+
+pushop.remotephases = phases.remotephasessummary(pushop.repo,
+ pushop.fallbackheads,
+ remotephases)
+droots = pushop.remotephases.draftroots
+
 extracond = ''
-if not publishing:
+if not pushop.remotephases.publishing:
 extracond = ' and public()'
 revset = 'heads((%%ln::%%ln) %s)' % extracond
 # Get the list of all revs draft on remote by public here.
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -604,6 +604,27 @@
 publicheads = newheads(repo, subset, draftroots)
 return publicheads, draftroots
 
+class remotephasessummary(object):
+"""summarize phase information on the remote side
+
+:publishing: True is the remote is publishing
+:publicheads: list of remote public phase heads (nodes)
+:draftheads: list of remote draft phase heads (nodes)
+:draftroots: list of remote draft phase root (nodes)
+"""
+
+def __init__(self, repo, remotesubset, remoteroots):
+unfi = repo.unfiltered()
+self._allremoteroots = remoteroots
+
+self.publishing = remoteroots.get('publishing', False)
+
+ana = analyzeremotephases(repo, remotesubset, remoteroots)
+self.publicheads, self.draftroots = ana
+# Get the list of all "heads" revs draft on remote
+dheads = unfi.set('heads(%ln::%ln)', self.draftroots, remotesubset)
+self.draftheads = [c.node() for c in dheads]
+
 def newheads(repo, heads, roots):
 """compute new head of a subset minus another
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 8 V2] phase: simplify the check for issue3781 shortcut in discovery

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1507739974 -7200
#  Wed Oct 11 18:39:34 2017 +0200
# Node ID 9fb76d6c80d20b5af8ee1d0e7d6c221924b1d7bb
# Parent  29a71a5125a7beb8334a7f7386a3023bfa1f66f8
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9fb76d6c80d2
phase: simplify the check for issue3781 shortcut in discovery

We'll rework the code around this check. Limiting the entanglement will help
with later changesets

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -531,7 +531,7 @@
 if (pushop.ui.configbool('ui', '_usedassubrepo')
 and remotephases# server supports phases
 and not pushop.outgoing.missing # no changesets to be pushed
-and publishing):
+and remotephases.get('publishing', False)):
 # When:
 # - this is a subrepo push
 # - and remote support phase
@@ -541,7 +541,9 @@
 # We drop the possible phase synchronisation done by
 # courtesy to publish changesets possibly locally draft
 # on the remote.
-remotephases = {'publishing': 'True'}
+pushop.outdatedphases = []
+pushop.fallbackoutdatedphases = []
+return
 ana = phases.analyzeremotephases(pushop.repo,
  pushop.fallbackheads,
  remotephases)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 8 V2] exchange: fix issue3781 reference in the comment

2017-10-16 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1508150202 -7200
#  Mon Oct 16 12:36:42 2017 +0200
# Node ID 29a71a5125a7beb8334a7f7386a3023bfa1f66f8
# Parent  629de091478a249c97ce410733c8520aaec779f2
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
29a71a5125a7
exchange: fix issue3781 reference in the comment

This comment is about:

  issue3781: Courtesy Phases synchronisation to publishing server prevent
 subrepo push
Not about:

  issue3871: Slow hg log when template contains {file_adds}, {file_mods} and
 {file_dels}

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -537,7 +537,7 @@
 # - and remote support phase
 # - and no changeset are to be pushed
 # - and remote is publishing
-# We may be in issue 3871 case!
+# We may be in issue 3781 case!
 # We drop the possible phase synchronisation done by
 # courtesy to publish changesets possibly locally draft
 # on the remote.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


  1   2   >