Re: [PATCH 3 of 8 "] compression: introduce a `storage.revlog.zlib.level` configuration

2019-04-28 Thread Matt Harbison
On Sun, 31 Mar 2019 11:36:19 -0400, Pierre-Yves David  
 wrote:



# HG changeset patch
# User Pierre-Yves David 
# Date 1553708127 -3600
#  Wed Mar 27 18:35:27 2019 +0100
# Node ID df7c537a8d07d6c1d4e7aa7604af30a57717bcf6
# Parent  0779dd6ec612bf7dcb5ca4628b42409dad2cde29
# EXP-Topic zstd-revlog
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r  
df7c537a8d07

compression: introduce a `storage.revlog.zlib.level` configuration


Not sure what's going on here, but I noticed the OS X buildbot has a  
problem with test-repo-compengines.t when using --pure. [1]  Windows has a  
different output on this test, which I've bisected back to this commit  
(1fac9b931d46):


--- c:/Users/Matt/hg/tests/test-repo-compengines.t
+++ c:/Users/Matt/hg/tests/test-repo-compengines.t.err
@@ -111,9 +111,10 @@
   > done

   $ $RUNTESTDIR/f -s */.hg/store/data/*
-  zlib-level-1/.hg/store/data/a.i: size=4146
-  zlib-level-9/.hg/store/data/a.i: size=4138
-  zlib-level-default/.hg/store/data/a.i: size=4138
+  default/.hg/store/data/foo.i: size=64\r (esc)
+  zlib-level-1/.hg/store/data/a.i: size=4138\r (esc)
+  zlib-level-9/.hg/store/data/a.i: size=4138\r (esc)
+  zlib-level-default/.hg/store/data/a.i: size=4138\r (esc)

 Test error cases

@@ -123,9 +124,6 @@
   > revlog.zlib.level=foobar
   > EOF
   $ commitone zlib-level-invalid
-  abort: storage.revlog.zlib.level is not a valid integer ('foobar')
-  abort: storage.revlog.zlib.level is not a valid integer ('foobar')
-  [255]

   $ hg init zlib-level-out-of-range
   $ cat << EOF >> zlib-level-out-of-range/.hg/hgrc
@@ -134,7 +132,4 @@
   > EOF

   $ commitone zlib-level-out-of-range
-  abort: invalid value for `storage.revlog.zlib.level` config: 42
-  abort: invalid value for `storage.revlog.zlib.level` config: 42
-  [255]


ERROR: test-repo-compengines.t output changed
!
Failed test-repo-compengines.t: output changed
# Ran 1 tests, 0 skipped, 1 failed.
python hash seed: 1576757354


The strange thing is that on both systems, --pure works if coupled with  
--local.  I assume the file size difference is some file not being opened  
in binary mode?


With the latest stable, there's additional output:

--- c:/Users/Matt/hg/tests/test-repo-compengines.t
+++ c:/Users/Matt/hg/tests/test-repo-compengines.t.err
@@ -22,9 +22,6 @@
 Unknown compression engine to format.compression aborts

   $ hg --config format.revlog-compression=unknown init unknown
-  abort: compression engine unknown defined by format.revlog-compression  
not available

-  (run "hg debuginstall" to list available compression engines)
-  [255]

 A requirement specifying an unknown compression engine results in bail


[1]  
https://buildbot.mercurial-scm.org/builders/macOS%2010.12%20hg%20tests%20%28stable%29/builds/128/steps/pure/logs/stdio

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


D6329: gendoc: nest command headers under category headers

2019-04-28 Thread Sietse (Sietse Brouwer)
Sietse 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/D6329

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -120,7 +120,7 @@
 
 # print cmds
 ui.write(minirst.section(_(b"Commands")))
-commandprinter(ui, table, minirst.subsection)
+commandprinter(ui, table, minirst.subsection, minirst.subsubsection)
 
 # print help topics
 # The config help topic is included in the hgrc.5 man page.
@@ -143,7 +143,8 @@
 cmdtable = getattr(mod, 'cmdtable', None)
 if cmdtable:
 ui.write(minirst.subsubsection(_(b'Commands')))
-commandprinter(ui, cmdtable, minirst.subsubsubsection)
+commandprinter(ui, cmdtable, minirst.subsubsubsection,
+minirst.subsubsubsubsection)
 
 def showtopic(ui, topic):
 extrahelptable = [
@@ -177,7 +178,27 @@
 ui.write(doc)
 ui.write(b"\n")
 
-def commandprinter(ui, cmdtable, sectionfunc):
+def commandprinter(ui, cmdtable, sectionfunc, subsectionfunc):
+"""Render restructuredtext describing a list of commands and their
+documentations, grouped by command category.
+
+Args:
+  ui: UI object to write the output to
+  cmdtable: a dict that maps a string of the command name plus its aliases
+(separated with pipes) to a 3-tuple of (the command's function, a list
+of its option descriptions, and a string summarizing available
+options). Example, with aliases added for demonstration purposes:
+
+  'phase|alias1|alias2': (
+ ,
+ [ ('p', 'public', False, 'set changeset phase to public'),
+   ...,
+   ('r', 'rev', [], 'target revision', 'REV')],
+ '[-p|-d|-s] [-f] [-r] [REV...]'
+  )
+  sectionfunc: minirst function to format command category headers
+  subsectionfunc: minirst function to format command headers
+"""
 h = {}
 for c, attr in cmdtable.items():
 f = c.split(b"|")[0]
@@ -213,18 +234,16 @@
 categorycmds = sorted([
 cmd for cmd in cmds
 if helpcategory(cmd) == category])
-# Print a section header for the category. Skip empty categories. For
-# now, the category header is at the same level as the headers for the
-# commands in the category; this is fixed in the next commit.
+# Print a section header for the category. Skip empty categories.
 if categorycmds:
 ui.write(sectionfunc(help.CATEGORY_NAMES[category]))
 # Print each command in the category
 for f in sorted(categorycmds):
 if f.startswith(b"debug"):
 continue
 processedcmds.append(f)  # log command
 d = get_cmd(h[f], cmdtable)
-ui.write(sectionfunc(d[b'cmd']))
+ui.write(subsectionfunc(d[b'cmd']))
 # short description
 ui.write(d[b'desc'][0])
 # synopsis



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


D6328: minirst: support subsubsubsubsections (header level 5) with marker ''''

2019-04-28 Thread Sietse (Sietse Brouwer)
Sietse 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/D6328

AFFECTED FILES
  mercurial/minirst.py

CHANGE DETAILS

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -44,6 +44,9 @@
 def subsubsubsection(s):
 return "%s\n%s\n\n" % (s, "." * encoding.colwidth(s))
 
+def subsubsubsubsection(s):
+return "%s\n%s\n\n" % (s, "'" * encoding.colwidth(s))
+
 def replace(text, substs):
 '''
 Apply a list of (find, replace) pairs to a text.



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


D6327: gendoc: guarantee that all commands were processed.

2019-04-28 Thread Sietse (Sietse Brouwer)
Sietse created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The new logic renders the commands belonging to each category in turn.
  Commands with an unregistered category are at risk of getting skipped
  because their category is not in the list. By comparing the list of all
  commands to a log of processed commands, we can detect commands with
  unregistered categories and fail with an error message.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -196,6 +196,12 @@
 return help.registrar.command.CATEGORY_NONE
 return helpcategory
 
+# Keep a log of processed commands. If a command category isn't registered
+# in help.CATEGORY_ORDER, the command doesn't get processed by
+# commandprinter. By comparing the list of processed commands to the
+# original list of commands, we can detect unregistered categories.
+processedcmds = []
+
 # Print the help for each command. We present the commands grouped by
 # category, and we use help.CATEGORY_ORDER as a guide for a helpful order
 # in which to present the categories.
@@ -216,6 +222,7 @@
 for f in sorted(categorycmds):
 if f.startswith(b"debug"):
 continue
+processedcmds.append(f)  # log command
 d = get_cmd(h[f], cmdtable)
 ui.write(sectionfunc(d[b'cmd']))
 # short description
@@ -251,7 +258,17 @@
 # aliases
 if d[b'aliases']:
 ui.write(_(b"aliases: %s\n\n") % b" ".join(d[b'aliases']))
-
+# Make sure that we left no commands unprocessed.
+expected = sorted(filter(lambda c: not c.startswith('debug'), cmds))
+observed = sorted(processedcmds)
+if not observed == expected:
+unprocessed = sorted(set(expected) - set(observed))
+unprocessedinfo = ', '.join(
+"%s (%s)" % (cmd, helpcategory(cmd))
+for cmd in unprocessed
+)
+raise AssertionError("The following commands did not register their"
+" (category) in help.CATEGORY_ORDER: %s" % unprocessedinfo)
 
 def allextensionnames():
 return set(extensions.enabled().keys()) | set(extensions.disabled().keys())



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


D6326: gendoc: group commands by category in man page and HTML help

2019-04-28 Thread Sietse (Sietse Brouwer)
Sietse created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Make Mercurial's man page and HTML help group commands by category, and
  present the categories in a helpful order. `hg help` already does this;
  this patch uses the same metadata.
  
  This patch uses the same header level for command categories, and for
  commands. A subsequent patch will push the command headers down one
  level.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -185,8 +185,35 @@
 h[f] = c
 cmds = h.keys()
 
-if True:
-for f in sorted(cmds):
+def helpcategory(cmd, h=h, cmdtable=cmdtable):
+"""Given a canonical command name from `cmds` (above), retrieve its
+help category. If helpcategory is None, default to CATEGORY_NONE
+"""
+fullname = h[cmd]
+details = cmdtable[fullname]
+helpcategory = details[0].helpcategory
+if helpcategory is None:
+return help.registrar.command.CATEGORY_NONE
+return helpcategory
+
+# Print the help for each command. We present the commands grouped by
+# category, and we use help.CATEGORY_ORDER as a guide for a helpful order
+# in which to present the categories.
+for category in help.CATEGORY_ORDER:
+# Make a list of the commands in this category.
+# Rescanning the list of all commands for each category is quadratic;
+# this is justified because N is low, and repeating the lookup keeps
+# our data structure simpler.
+categorycmds = sorted([
+cmd for cmd in cmds
+if helpcategory(cmd) == category])
+# Print a section header for the category. Skip empty categories. For
+# now, the category header is at the same level as the headers for the
+# commands in the category; this is fixed in the next commit.
+if categorycmds:
+ui.write(sectionfunc(help.CATEGORY_NAMES[category]))
+# Print each command in the category
+for f in sorted(categorycmds):
 if f.startswith(b"debug"):
 continue
 d = get_cmd(h[f], cmdtable)



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


D6325: gendoc: indent loop to make next patch more legible

2019-04-28 Thread Sietse (Sietse Brouwer)
Sietse 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/D6325

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -185,44 +185,45 @@
 h[f] = c
 cmds = h.keys()
 
-for f in sorted(cmds):
-if f.startswith(b"debug"):
-continue
-d = get_cmd(h[f], cmdtable)
-ui.write(sectionfunc(d[b'cmd']))
-# short description
-ui.write(d[b'desc'][0])
-# synopsis
-ui.write(b"::\n\n")
-synopsislines = d[b'synopsis'].splitlines()
-for line in synopsislines:
-# some commands (such as rebase) have a multi-line
+if True:
+for f in sorted(cmds):
+if f.startswith(b"debug"):
+continue
+d = get_cmd(h[f], cmdtable)
+ui.write(sectionfunc(d[b'cmd']))
+# short description
+ui.write(d[b'desc'][0])
 # synopsis
-ui.write(b"   %s\n" % line)
-ui.write(b'\n')
-# description
-ui.write(b"%s\n\n" % d[b'desc'][1])
-# options
-opt_output = list(d[b'opts'])
-if opt_output:
-opts_len = max([len(line[0]) for line in opt_output])
-ui.write(_(b"Options:\n\n"))
-multioccur = False
-for optstr, desc in opt_output:
-if desc:
-s = b"%-*s  %s" % (opts_len, optstr, desc)
-else:
-s = optstr
-ui.write(b"%s\n" % s)
-if optstr.endswith(b"[+]>"):
-multioccur = True
-if multioccur:
-ui.write(_(b"\n[+] marked option can be specified"
-   b" multiple times\n"))
-ui.write(b"\n")
-# aliases
-if d[b'aliases']:
-ui.write(_(b"aliases: %s\n\n") % b" ".join(d[b'aliases']))
+ui.write(b"::\n\n")
+synopsislines = d[b'synopsis'].splitlines()
+for line in synopsislines:
+# some commands (such as rebase) have a multi-line
+# synopsis
+ui.write(b"   %s\n" % line)
+ui.write(b'\n')
+# description
+ui.write(b"%s\n\n" % d[b'desc'][1])
+# options
+opt_output = list(d[b'opts'])
+if opt_output:
+opts_len = max([len(line[0]) for line in opt_output])
+ui.write(_(b"Options:\n\n"))
+multioccur = False
+for optstr, desc in opt_output:
+if desc:
+s = b"%-*s  %s" % (opts_len, optstr, desc)
+else:
+s = optstr
+ui.write(b"%s\n" % s)
+if optstr.endswith(b"[+]>"):
+multioccur = True
+if multioccur:
+ui.write(_(b"\n[+] marked option can be specified"
+   b" multiple times\n"))
+ui.write(b"\n")
+# aliases
+if d[b'aliases']:
+ui.write(_(b"aliases: %s\n\n") % b" ".join(d[b'aliases']))
 
 
 def allextensionnames():



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


D6324: help: register the 'gpg' command category and give it a description

2019-04-28 Thread Sietse (Sietse Brouwer)
Sietse created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  help.py expects extensions to register their command category in the
  CATEGORY_ORDER and CATEGORY_NAMES variables. Once gendoc.py orders
  commands by category, in the next patch, it'll assume this registration
  (and raise an exception on encountering any unregistered categories).
  Luckily, gpg is the only bundled extension with an unregistered custom
  category, so let's fix it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/gpg.py

CHANGE DETAILS

diff --git a/hgext/gpg.py b/hgext/gpg.py
--- a/hgext/gpg.py
+++ b/hgext/gpg.py
@@ -49,6 +49,11 @@
 
 # Custom help category
 _HELP_CATEGORY = 'gpg'
+help.CATEGORY_ORDER.insert(
+help.CATEGORY_ORDER.index(registrar.command.CATEGORY_HELP),
+_HELP_CATEGORY
+)
+help.CATEGORY_NAMES[_HELP_CATEGORY] = 'Signing changes (GPG)'
 
 class gpg(object):
 def __init__(self, path, key=None):



To: Sietse, #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 1 of 2] rust: published the three extension crates to crates.io

2019-04-28 Thread Yuya Nishihara
On Thu, 25 Apr 2019 15:11:23 +0200, Georges Racinet wrote:
> On 4/23/19 2:36 PM, Yuya Nishihara wrote:
> >> Besides third party dependencies to hg-core or even hg-cpython
> >> appearing, here's a reason for them not being purely internal:
> >> downstream packagers may need to rely on the crates.io version as per
> >> their policies or tooling capabilities.
> > Do we plan to provide a Rust library? I'm not against to if that's worth
> > the cost. I just feel it's too early.
> >
> Well actually, yes, at least for hg-core.
> 
> For instance, this work of Valentin (added Cc) on a Rust hg status would
> probably benefit to cargo-depend on hg-core soon :
> https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-February/128768.html
> 
> Another case where I'd imagine it to be useful that hg-core version on
> crates.io would be consistent with released hg versions is for third
> party extensions. I've already taken a serious look at treedirstate, and
> would like to bring it to the core at some point. I'm not sure how I'll
> proceed, but being able in intermediate steps to simply depend onto the
> hg-core from crates.io would be an interesting option.

Okay, then, how about releasing only the hg-core crate? IIRC, the cpython
bridge connects to Mercurial over C API, which means there's no guarantee
that the released crate will work flawlessly with the system Mercurial.
And the direct-ffi should be removed hopefully soon.

> In general, I agree that our Rust code is not stable enough for people
> to rely it without a strong coordination with us, and the version number
> should reflect that, but such strong coordination cases do exist.
> 
> About the version number, I reached a conclusion (could elaborate on it
> later on):
> 
>     Mercurial x.y.z would correspond to hg-core 0.xy.z  (example: 4.9.1
> -> 0.49.1)

Sure it seems less scary than hg-core x.y.z (which means we can't change
the API until hg-core x+1.0.0.) I don't know if the crate version should
look similar to the Mercurial version.

> I understand all this is probably a complication in the release process,
> though, and I'm ready to help if needed. Maybe I could upload crates
> corresponding to Mercurial 5.0 manually ? I don't think it would harm
> the ecosystem, I'd just have to submit a bump of the version numbers in
> our source tree after that.
> 
> In any case, I don't want to overwork the release team, and I'd
> understand if you'd would postpone all of this for the 5.1 timeframe,
> hoping we could sort this out IRL during the sprint. I would certainly
> put it on the agenda.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] hghave: deal with "rc" release

2019-04-28 Thread Yuya Nishihara
On Thu, 25 Apr 2019 21:19:51 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1556212622 -7200
> #  Thu Apr 25 19:17:02 2019 +0200
> # Branch stable
> # Node ID fcaf2e87d89a2f4b12dfde47c29183a04436c442
> # Parent  ae68418cc3a1a01f7d33f9bad6a3f016d31c544c
> # EXP-Topic hghave
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> fcaf2e87d89a
> hghave: deal with "rc" release

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


D6323: tests: demonstrate that rename is followed to wrong parent from merge

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG618b9ffefa87: tests: demonstrate that rename is followed to 
wrong parent from merge (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6323?vs=14942=14956

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

AFFECTED FILES
  tests/test-commit-amend.t

CHANGE DETAILS

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -783,6 +783,21 @@
   
   $ hg debugrename aaa
   aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
+
+Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' 
exists
+in p1 too, but it was recorded as copied from p2.
+  $ echo modified >> aaa
+BROKEN: should not be follow the rename back to 'aa' here, since the rename
+happened compared to p2
+  $ hg co -m '.^' -t :merge3
+  merging aaa and aa to aa
+  warning: conflicts while merging aa! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 1 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+  $ hg co -C tip
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
   $ hg mv aaa aa
   $ hg ci --amend -m 'merge bar again (undo rename)'
   $ hg log --config diff.git=1 -pr .



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


D6322: test: demonstrate failure to follow rename with shadowed linkrev

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7bb2f358a13b: test: demonstrate failure to follow rename 
with shadowed linkrev (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6322?vs=14941=14955

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

AFFECTED FILES
  tests/test-mv-cp-st-diff.t

CHANGE DETAILS

diff --git a/tests/test-mv-cp-st-diff.t b/tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t
+++ b/tests/test-mv-cp-st-diff.t
@@ -1685,4 +1685,16 @@
 f
   R f
 
+Check that merging across the rename works
+
+  $ echo modified >> renamed
+BROKEN: This should propagate the change to 'f'
+  $ hg co -m 4
+  file 'renamed' was deleted in other [destination] but was modified in local 
[working copy].
+  What do you want to do?
+  use (c)hanged version, (d)elete, or leave (u)nresolved? u
+  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+
   $ cd ..



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


D6311: branchcache: store the maximum tip in a variable inside for loop

2019-04-28 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9893d7aa7420: branchcache: store the maximum tip in a 
variable inside for loop (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6311?vs=14926=14954

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -378,6 +378,10 @@
 # fetch current topological heads to speed up filtering
 topoheads = set(cl.headrevs())
 
+# new tip revision which we found after iterating items from new
+# branches
+ntiprev = self.tiprev
+
 # if older branchheads are reachable from new ones, they aren't
 # really branchheads. Note checking parents is insufficient:
 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
@@ -401,9 +405,12 @@
 bheadrevs = sorted(bheadset)
 self[branch] = [cl.node(rev) for rev in bheadrevs]
 tiprev = bheadrevs[-1]
-if tiprev > self.tiprev:
-self.tipnode = cl.node(tiprev)
-self.tiprev = tiprev
+if tiprev > ntiprev:
+ntiprev = tiprev
+
+if ntiprev > self.tiprev:
+self.tiprev = ntiprev
+self.tipnode = cl.node(ntiprev)
 
 if not self.validfor(repo):
 # cache key are not valid anymore



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


D6321: tests: slightly modify a linkrev test to prepare for expanding it

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG20fce2742399: tests: slightly modify a linkrev test to 
prepare for expanding it (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6321?vs=14940=14953

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

AFFECTED FILES
  tests/test-mv-cp-st-diff.t

CHANGE DETAILS

diff --git a/tests/test-mv-cp-st-diff.t b/tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t
+++ b/tests/test-mv-cp-st-diff.t
@@ -1624,38 +1624,42 @@
   $ echo change > f
   $ hg ci -m 'change f'
 
+Make a rename because we want to track renames. It is also important that the
+faulty linkrev is not only the "start" commit to ensure the linkrev will be
+used.
+
+  $ hg mv f renamed
+  $ hg ci -m renamed
+
 Make a second branch, we use a named branch to create a simple commit
 that does not touch f.
 
   $ hg up -qr 'desc(empty)'
   $ hg branch -q dev
   $ hg ci -Aqm dev
 
-Graft the initial change, as f was untouched, we reuse the same entry and the
-linkrev point to the older branch.
+Graft the initial change and the rename. As f was untouched, we reuse the same
+entry and the linkrev point to the older branch.
 
   $ hg graft -q 'desc(change)'
-
-Make a rename because we want to track renames. It is also important that the
-faulty linkrev is not the "start" commit to ensure the linkrev will be used.
-
-  $ hg mv f renamed
-  $ hg ci -m renamed
+  $ hg graft -q 'desc(renamed)'
 
   $ hg log -G -T '{rev} {desc}'
-  @  4 renamed
+  @  5 renamed
+  |
+  o  4 change f
   |
-  o  3 change f
+  o  3 dev
   |
-  o  2 dev
-  |
+  | o  2 renamed
+  | |
   | o  1 change f
   |/
   o  0 empty f
   
 
-The copy tracking should still reach rev 2 (branch creation).
-accessing the parent of 4 (renamed) should not jump use to revision 1.
+The copy tracking should still reach rev 3 (branch creation).
+accessing the parent of 5 (renamed) should not jump use to revision 1.
 
   $ hg diff --git -r 'desc(dev)' -r .
   diff --git a/f b/renamed
@@ -1669,11 +1673,11 @@
 Check debug output for copy tracing
 
   $ hg status --copies --rev 'desc(dev)' --rev . --config 
devel.debug.copies=yes --debug
-  debug.copies: searching copies from a51f36ab1704 to 7935fd48a8f9
+  debug.copies: searching copies from a51f36ab1704 to 1f4aa1fd627b
   debug.copies: search mode: forward
-  debug.copies:looking into rename from a51f36ab1704 to 7935fd48a8f9
-  debug.copies:  search limit: 2
-  debug.copies:  missing file to search: 1
+  debug.copies:looking into rename from a51f36ab1704 to 1f4aa1fd627b
+  debug.copies:  search limit: 3
+  debug.copies:  missing files to search: 1
   debug.copies:tracing file: renamed
   debug.copies:  rename of: f
   debug.copies:  time: * seconds (glob)



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


D6320: copies: process files in deterministic order for stable tests

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG390ec72b8ea4: copies: process files in deterministic order 
for stable tests (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6320?vs=14939=14952

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -204,9 +204,9 @@
 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
 
 if debug:
-dbg('debug.copies:  missing file to search: %d\n' % len(missing))
+dbg('debug.copies:  missing files to search: %d\n' % len(missing))
 
-for f in missing:
+for f in sorted(missing):
 if debug:
 dbg('debug.copies:tracing file: %s\n' % f)
 fctx = b[f]



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


D6312: branchcache: update the filteredhash if we update the tiprev

2019-04-28 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   if ntiprev > self.tiprev:
  >   self.tiprev = ntiprev
  >   self.tipnode = cl.node(ntiprev)
  > 
  > +self.filteredhash = scmutil.filteredhash(repo, self.tiprev)
  > 
  >   if not self.validfor(repo):
  >   # cache key are not valid anymore
  
  and update `self.filteredhash` later again, which smells. Instead, shouldn't
  we check the validity first, and take the fast path only if it was valid?
  
if self.validfor(repo):  # was valid, can take fast path
self.tiprev = ntiprev
self.tipnode = cl.node(ntiprev)
else:  # bad luck, recompute tiprev/tipnode
...
self.filteredhash = scmutil.filteredhash(repo, self.tiprev)

REPOSITORY
  rHG Mercurial

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

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


Re: D6312: branchcache: update the filteredhash if we update the tiprev

2019-04-28 Thread Yuya Nishihara
>  if ntiprev > self.tiprev:
>  self.tiprev = ntiprev
>  self.tipnode = cl.node(ntiprev)
> +self.filteredhash = scmutil.filteredhash(repo, self.tiprev)
>  
>  if not self.validfor(repo):
>  # cache key are not valid anymore

and update `self.filteredhash` later again, which smells. Instead, shouldn't
we check the validity first, and take the fast path only if it was valid?

```
if self.validfor(repo):  # was valid, can take fast path
self.tiprev = ntiprev
self.tipnode = cl.node(ntiprev)
else:  # bad luck, recompute tiprev/tipnode
...
self.filteredhash = scmutil.filteredhash(repo, self.tiprev)
```
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH v3] py3: properly reject non-encoded strings given to hgweb

2019-04-28 Thread Yuya Nishihara
On Sun, 28 Apr 2019 04:22:53 +, Ludovic Chabant wrote:
> # HG changeset patch
> # User Ludovic Chabant 
> # Date 1555683992 0
> #  Fri Apr 19 14:26:32 2019 +
> # Branch stable
> # Node ID 6805ebb0f1f6a7f34a74732ee6f6ec14e8824e42
> # Parent  3611368a1af3037427eb59635c7dad8dab67c606
> py3: properly reject non-encoded strings given to hgweb

Queued, thanks.

> diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py
> --- a/mercurial/hgweb/__init__.py
> +++ b/mercurial/hgweb/__init__.py
> @@ -13,6 +13,7 @@
>  from ..i18n import _
>  
>  from .. import (
> +encoding,

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


Re: [PATCH v3] py3: handle meta-path finders that only use pre-python3.4 API

2019-04-28 Thread Yuya Nishihara
On Sun, 28 Apr 2019 04:18:45 +, Ludovic Chabant wrote:
> # HG changeset patch
> # User Ludovic Chabant 
> # Date 1555683918 0
> #  Fri Apr 19 14:25:18 2019 +
> # Branch stable
> # Node ID 3611368a1af3037427eb59635c7dad8dab67c606
> # Parent  4a8d9ed864754837a185a642170cde24392f9abf
> py3: handle meta-path finders that only use pre-python3.4 API

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


D6255: copies: calculate mergecopies() based on pathcopies()

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D6255#91851, @martinvonz wrote:
  
  > I'll spend a bit more time to see if I can figure out why pathcopies() and 
mergecopies() walk file ancestor differently. The way mergecopies() does it is 
faster, so I'l see if I can use that for pathcopies() too. 
https://phab.mercurial-scm.org/D6274:: can still be queued if anyone has time.
  
  
  I thought I was done with that after finding some bugs in mergecopies(). I 
thought fixing those would make mergecopies() as slow as pathcopies(), but that 
still doesn't seem to explain it :( Maybe I'll spend even more time on this 
tomorrow.

REPOSITORY
  rHG Mercurial

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

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


D6255: copies: calculate mergecopies() based on pathcopies()

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14943.
martinvonz edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6255?vs=14809=14943

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-annotate.t
  tests/test-commit-amend.t
  tests/test-copies.t
  tests/test-fastannotate-hg.t
  tests/test-graft.t
  tests/test-mv-cp-st-diff.t
  tests/test-rename-merge2.t

CHANGE DETAILS

diff --git a/tests/test-rename-merge2.t b/tests/test-rename-merge2.t
--- a/tests/test-rename-merge2.t
+++ b/tests/test-rename-merge2.t
@@ -433,6 +433,9 @@
   --
   test L:nc a b R:up b   W:   - 12 merge b no ancestor
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
@@ -469,6 +472,9 @@
   --
   test L:up b   R:nm a b W:   - 13 merge b no ancestor
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
@@ -506,6 +512,9 @@
   --
   test L:nc a b R:up a b W:   - 14 merge b no ancestor
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
@@ -543,6 +552,9 @@
   --
   test L:up b   R:nm a b W:   - 15 merge b no ancestor, remove a
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
@@ -580,6 +592,9 @@
   --
   test L:nc a b R:up a b W:   - 16 get a, merge b no ancestor
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
@@ -617,6 +632,9 @@
   --
   test L:up a b R:nc a b W:   - 17 keep a, merge b no ancestor
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24
@@ -653,6 +671,9 @@
   --
   test L:nm a b R:up a b W:   - 18 merge b no ancestor
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
@@ -695,6 +716,9 @@
   --
   test L:up a b R:nm a b W:   - 19 merge b no ancestor, prompt remove a
   --
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'a' -> dst: 'b' 
+checking for directory renames
   resolving manifests
branchmerge: True, force: False, partial: False
ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
diff --git a/tests/test-mv-cp-st-diff.t b/tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t
+++ b/tests/test-mv-cp-st-diff.t
@@ -1688,13 +1688,8 @@
 Check that merging across the rename works
 
   $ echo modified >> renamed
-BROKEN: This should propagate the change to 'f'
   $ hg co -m 4
-  file 'renamed' was deleted in other [destination] but was modified in local 
[working copy].
-  What do you want to do?
-  use (c)hanged version, (d)elete, or leave (u)nresolved? u
-  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  use 'hg resolve' to retry unresolved file merges
-  [1]
+  merging renamed and f to f
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
 
   $ cd ..
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -75,6 +75,8 @@
 
   $ hg graft -r 2 --base 3
   grafting 2:5c095ad7e90f "2"
+  note: possible conflict - c was deleted and renamed to:
+   a
   note: graft of 2:5c095ad7e90f created no changes to commit
 
 Can't continue without starting:
@@ -220,6 

D6276: copies: clarify mutually exclusive cases in _chain() with a s/if/elif/

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14950.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6276?vs=14848=14950

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -134,7 +134,7 @@
 if t[v] != k:
 # file wasn't renamed back to itself (i.e. case 4, not 3)
 t[k] = t[v]
-if v in src:
+elif v in src:
 # file is a copy of an existing file, i.e. case 6.
 t[k] = v
 



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


D6277: copies: filter out copies from non-existent source later in _chain()

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14951.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6277?vs=14849=14951

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -134,13 +134,16 @@
 if t[v] != k:
 # file wasn't renamed back to itself (i.e. case 4, not 3)
 t[k] = t[v]
-elif v in src:
-# file is a copy of an existing file, i.e. case 6.
+else:
+# Renamed only in 'b', i.e. cases 5 & 6. We'll remove case 5 later.
 t[k] = v
 
 for k, v in list(t.items()):
+# remove copies from files that didn't exist, i.e. case 5
+if v not in src:
+del t[k]
 # remove criss-crossed copies, i.e. case 3
-if k in src and v in dst:
+elif k in src and v in dst:
 del t[k]
 # remove copies to files that were then removed, i.e. case 1
 # and file 'y' in cases 3 & 4 (in case of rename)



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


D6274: copies: document cases in _chain()

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14948.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6274?vs=14846=14948

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -108,26 +108,46 @@
 return min(limit, a, b)
 
 def _chain(src, dst, a, b):
-"""chain two sets of copies a->b"""
+"""chain two sets of copies 'a' and 'b'"""
+
+# When chaining copies in 'a' (from 'src' via some other commit 'mid') with
+# copies in 'b' (from 'mid' to 'dst'), we can get the different cases in 
the
+# following table (not including trivial cases). For example, case 2 is
+# where a file existed in 'src' and remained under that name in 'mid' and
+# then was renamed between 'mid' and 'dst'.
+#
+# case src mid dst result
+#   1   x   y   --
+#   2   x   y   y   x->y
+#   3   x   y   x-
+#   4   x   y   z   x->z
+#   5   -   x   y-
+#   6   x   x   y   x->y
+
+# Initialize result ('t') from 'a'. This catches cases 1 & 2. We'll remove
+# case 1 later. We'll also catch cases 3 & 4 here. Case 4 will be
+# overwritten later, and case 3 will be removed later.
 t = a.copy()
 for k, v in b.iteritems():
 if v in t:
-# found a chain
+# found a chain, i.e. cases 3 & 4.
 if t[v] != k:
-# file wasn't renamed back to itself
+# file wasn't renamed back to itself (i.e. case 4, not 3)
 t[k] = t[v]
 if v not in dst:
 # chain was a rename, not a copy
+# this deletes the copy for 'y' in case 4
 del t[v]
 if v in src:
-# file is a copy of an existing file
+# file is a copy of an existing file, i.e. case 6.
 t[k] = v
 
 for k, v in list(t.items()):
-# remove criss-crossed copies
+# remove criss-crossed copies, i.e. case 3
 if k in src and v in dst:
 del t[k]
-# remove copies to files that were then removed
+# remove copies to files that were then removed, i.e. case 1
+# and file 'y' in cases 3 & 4 (in case of rename)
 elif k not in dst:
 del t[k]
 



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


D6275: copies: delete a redundant cleanup step in _chain()

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14949.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6275?vs=14847=14949

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -134,10 +134,6 @@
 if t[v] != k:
 # file wasn't renamed back to itself (i.e. case 4, not 3)
 t[k] = t[v]
-if v not in dst:
-# chain was a rename, not a copy
-# this deletes the copy for 'y' in case 4
-del t[v]
 if v in src:
 # file is a copy of an existing file, i.e. case 6.
 t[k] = v



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


D6256: copies: inline _computenonoverlap() in mergecopies()

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14944.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6256?vs=14810=14944

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

AFFECTED FILES
  hgext/remotefilelog/__init__.py
  mercurial/copies.py
  tests/test-remotefilelog-sparse.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-sparse.t 
b/tests/test-remotefilelog-sparse.t
--- a/tests/test-remotefilelog-sparse.t
+++ b/tests/test-remotefilelog-sparse.t
@@ -98,12 +98,5 @@
   $ clearcache
   $ hg prefetch -r '. + .^' -I x -I z
   4 files fetched over 1 fetches - (4 misses, 0.00% hit ratio) over * (glob)
-Originally this was testing that the rebase doesn't fetch pointless
-blobs. Right now it fails because core's sparse can't load a spec from
-the working directory. Presumably there's a fix, but I'm not sure what it is.
   $ hg rebase -d 2 --keep
   rebasing 1:876b1317060d "x2" (foo)
-  transaction abort!
-  rollback completed
-  abort: cannot parse sparse patterns from working directory
-  [255]
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -353,26 +353,6 @@
 return _chain(x, y, _backwardrenames(x, a, match=match),
   _forwardcopies(a, y, match=match))
 
-def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, debug=True):
-"""Computes, based on addedinm1 and addedinm2, the files exclusive to c1
-and c2. This is its own function so extensions can easily wrap this call
-to see what files mergecopies is about to process.
-
-Even though c1 and c2 are not used in this function, they are useful in
-other extensions for being able to read the file nodes of the changed 
files.
-"""
-u1 = sorted(addedinm1 - addedinm2)
-u2 = sorted(addedinm2 - addedinm1)
-
-if debug:
-header = "  unmatched files in %s"
-if u1:
-repo.ui.debug("%s:\n   %s\n" % (header % 'local', "\n   
".join(u1)))
-if u2:
-repo.ui.debug("%s:\n   %s\n" % (header % 'other', "\n   
".join(u2)))
-
-return u1, u2
-
 def mergecopies(repo, c1, c2, base):
 """
 Finds moves and copies between context c1 and c2 that are relevant for
@@ -550,7 +530,14 @@
 # find interesting file sets from manifests
 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
-u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
+u1 = sorted(addedinm1 - addedinm2)
+u2 = sorted(addedinm2 - addedinm1)
+
+header = "  unmatched files in %s"
+if u1:
+repo.ui.debug("%s:\n   %s\n" % (header % 'local', "\n   ".join(u1)))
+if u2:
+repo.ui.debug("%s:\n   %s\n" % (header % 'other', "\n   ".join(u2)))
 
 fullcopy = copies1.copy()
 fullcopy.update(copies2)
diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py
+++ b/hgext/remotefilelog/__init__.py
@@ -487,37 +487,6 @@
 return orig(repo, matcher, added, removed, *args, **kwargs)
 extensions.wrapfunction(scmutil, '_findrenames', findrenames)
 
-# prefetch files before mergecopies check
-def computenonoverlap(orig, repo, c1, c2, *args, **kwargs):
-u1, u2 = orig(repo, c1, c2, *args, **kwargs)
-if isenabled(repo):
-m1 = c1.manifest()
-m2 = c2.manifest()
-files = []
-
-sparsematch1 = repo.maybesparsematch(c1.rev())
-if sparsematch1:
-sparseu1 = set()
-for f in u1:
-if sparsematch1(f):
-files.append((f, hex(m1[f])))
-sparseu1.add(f)
-u1 = sparseu1
-
-sparsematch2 = repo.maybesparsematch(c2.rev())
-if sparsematch2:
-sparseu2 = set()
-for f in u2:
-if sparsematch2(f):
-files.append((f, hex(m2[f])))
-sparseu2.add(f)
-u2 = sparseu2
-
-# batch fetch the needed files from the server
-repo.fileservice.prefetch(files)
-return u1, u2
-extensions.wrapfunction(copies, '_computenonoverlap', computenonoverlap)
-
 # prefetch files before pathcopies check
 def computeforwardmissing(orig, a, b, match=None):
 missing = orig(a, b, match=match)



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


D6269: copies: ignore heuristics copytracing when using changeset-centric algos

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14947.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6269?vs=14813=14947

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -415,6 +415,10 @@
 # value, so we should rely on making sure copytracing is on such cases
 return {}, {}, {}, {}, {}
 
+if usechangesetcentricalgo(repo):
+# The heuristics don't make sense when we need changeset-centric algos
+return _fullcopytracing(repo, c1, c2, base)
+
 # Copy trace disabling is explicitly below the node == p1 logic above
 # because the logic above is required for a simple copy to be kept across a
 # rebase.



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


D6266: copies: replace .items() by .values() where appropriate

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14945.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6266?vs=14811=14945

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -522,9 +522,9 @@
 
 renamedeleteset = set()
 divergeset = set()
-for src, dsts in diverge.items():
+for dsts in diverge.values():
 divergeset.update(dsts)
-for src, dsts in renamedelete.items():
+for dsts in renamedelete.values():
 renamedeleteset.update(dsts)
 
 # find interesting file sets from manifests



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


D6268: copies: move check for experimental.copytrace== earlier

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14946.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6268?vs=14812=14946

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -410,7 +410,10 @@
 return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {}
 
 copytracing = repo.ui.config('experimental', 'copytrace')
-boolctrace = stringutil.parsebool(copytracing)
+if stringutil.parsebool(copytracing) is False:
+# stringutil.parsebool() returns None when it is unable to parse the
+# value, so we should rely on making sure copytracing is on such cases
+return {}, {}, {}, {}, {}
 
 # Copy trace disabling is explicitly below the node == p1 logic above
 # because the logic above is required for a simple copy to be kept across a
@@ -422,10 +425,6 @@
 if _isfullcopytraceable(repo, c1, base):
 return _fullcopytracing(repo, c1, c2, base)
 return _heuristicscopytracing(repo, c1, c2, base)
-elif boolctrace is False:
-# stringutil.parsebool() returns None when it is unable to parse the
-# value, so we should rely on making sure copytracing is on such cases
-return {}, {}, {}, {}, {}
 else:
 return _fullcopytracing(repo, c1, c2, base)
 



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


D6323: tests: demonstrate that rename is followed to wrong parent from merge

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This test case shows another way that copies are handled differently
  between `hg st` (pathcopies()) and `hg co -m` (mergecopies). The
  reason is that pathcopies() calls _tracefiles(), which checks that the
  file nodeid of an ancestor matches the file nodeid in the base
  commit. mergecopies() should probably be doing the same.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-commit-amend.t

CHANGE DETAILS

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -783,6 +783,21 @@
   
   $ hg debugrename aaa
   aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
+
+Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' 
exists
+in p1 too, but it was recorded as copied from p2.
+  $ echo modified >> aaa
+BROKEN: should not be follow the rename back to 'aa' here, since the rename
+happened compared to p2
+  $ hg co -m '.^' -t :merge3
+  merging aaa and aa to aa
+  warning: conflicts while merging aa! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 1 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+  $ hg co -C tip
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
   $ hg mv aaa aa
   $ hg ci --amend -m 'merge bar again (undo rename)'
   $ hg log --config diff.git=1 -pr .



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


D6322: test: demonstrate failure to follow rename with shadowed linkrev

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This shows a difference in handling of copies between `hg st`
  (pathcopies()) and `hg co -m`. The issue here is that mergecopies()
  uses the unadjusted linkrev() for determining when to stop walking
  ancestors.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-mv-cp-st-diff.t

CHANGE DETAILS

diff --git a/tests/test-mv-cp-st-diff.t b/tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t
+++ b/tests/test-mv-cp-st-diff.t
@@ -1685,4 +1685,16 @@
 f
   R f
 
+Check that merging across the rename works
+
+  $ echo modified >> renamed
+BROKEN: This should propagate the change to 'f'
+  $ hg co -m 4
+  file 'renamed' was deleted in other [destination] but was modified in local 
[working copy].
+  What do you want to do?
+  use (c)hanged version, (d)elete, or leave (u)nresolved? u
+  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]
+
   $ cd ..



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


D6321: tests: slightly modify a linkrev test to prepare for expanding it

2019-04-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The test case checks that the copy tracing code doesn't get confused
  by linkrevs when walking a file's ancestors. This patch chnages the
  test slightly so a second commit is grafted, thus producing a second
  "bad" linkrev. I'll use this in the next patch to demonstrate a bug.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-mv-cp-st-diff.t

CHANGE DETAILS

diff --git a/tests/test-mv-cp-st-diff.t b/tests/test-mv-cp-st-diff.t
--- a/tests/test-mv-cp-st-diff.t
+++ b/tests/test-mv-cp-st-diff.t
@@ -1624,38 +1624,42 @@
   $ echo change > f
   $ hg ci -m 'change f'
 
+Make a rename because we want to track renames. It is also important that the
+faulty linkrev is not only the "start" commit to ensure the linkrev will be
+used.
+
+  $ hg mv f renamed
+  $ hg ci -m renamed
+
 Make a second branch, we use a named branch to create a simple commit
 that does not touch f.
 
   $ hg up -qr 'desc(empty)'
   $ hg branch -q dev
   $ hg ci -Aqm dev
 
-Graft the initial change, as f was untouched, we reuse the same entry and the
-linkrev point to the older branch.
+Graft the initial change and the rename. As f was untouched, we reuse the same
+entry and the linkrev point to the older branch.
 
   $ hg graft -q 'desc(change)'
-
-Make a rename because we want to track renames. It is also important that the
-faulty linkrev is not the "start" commit to ensure the linkrev will be used.
-
-  $ hg mv f renamed
-  $ hg ci -m renamed
+  $ hg graft -q 'desc(renamed)'
 
   $ hg log -G -T '{rev} {desc}'
-  @  4 renamed
+  @  5 renamed
+  |
+  o  4 change f
   |
-  o  3 change f
+  o  3 dev
   |
-  o  2 dev
-  |
+  | o  2 renamed
+  | |
   | o  1 change f
   |/
   o  0 empty f
   
 
-The copy tracking should still reach rev 2 (branch creation).
-accessing the parent of 4 (renamed) should not jump use to revision 1.
+The copy tracking should still reach rev 3 (branch creation).
+accessing the parent of 5 (renamed) should not jump use to revision 1.
 
   $ hg diff --git -r 'desc(dev)' -r .
   diff --git a/f b/renamed
@@ -1669,11 +1673,11 @@
 Check debug output for copy tracing
 
   $ hg status --copies --rev 'desc(dev)' --rev . --config 
devel.debug.copies=yes --debug
-  debug.copies: searching copies from a51f36ab1704 to 7935fd48a8f9
+  debug.copies: searching copies from a51f36ab1704 to 1f4aa1fd627b
   debug.copies: search mode: forward
-  debug.copies:looking into rename from a51f36ab1704 to 7935fd48a8f9
-  debug.copies:  search limit: 2
-  debug.copies:  missing file to search: 1
+  debug.copies:looking into rename from a51f36ab1704 to 1f4aa1fd627b
+  debug.copies:  search limit: 3
+  debug.copies:  missing files to search: 1
   debug.copies:tracing file: renamed
   debug.copies:  rename of: f
   debug.copies:  time: * seconds (glob)



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