Re: [PATCH] obsolete: drop the legacy `_enabled` variable

2019-04-29 Thread Yuya Nishihara
On Mon, 29 Apr 2019 23:09:20 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1556593242 14400
> #  Mon Apr 29 23:00:42 2019 -0400
> # Node ID ca762c2bbe6b00a4af999eb77a3f6daf48acb0cd
> # Parent  d0e773ad907784c0479499e3a33e93d746d42e7a
> obsolete: drop the legacy `_enabled` variable

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


Re: Changing the wdir() {rev} and {node} output

2019-04-29 Thread Yuya Nishihara
On Mon, 29 Apr 2019 11:37:02 -0400, Jordi Gutiérrez Hermoso wrote:
> On Wed, 2019-04-17 at 08:29 +0900, Yuya Nishihara wrote:
> > On Tue, 16 Apr 2019 10:14:53 -0400, Jordi Gutiérrez Hermoso wrote:
> > > While I think it might be okay to keep the iternal values,
> > > 
> > > https://www.mercurial-scm.org/repo/hg/file/967c098eed33/mercurial/node.py#l39
> > > 
> > > I think it's far too confusing to expose them in the user interface.
> > > 
> > > A particular inconsistency I see is that we already have a way to show
> > > wdir(), for example. In a way, `hg id -T` is kind of an alias for `hg
> > > log -r 'wdir()' -T ... ` in a way that is not obvious. But trying to
> > > use '{node}' or '{rev}' in `hg id` results in exposing the internal
> > > revision and node magic numbers, which is very confusing behaviour,
> > > since the default behaviour of `hg id` is to show `{p1.rev}+` instead
> > > if there are changes in the wdir.
> > > 
> > > Another instance in which this happens is `hg annotate -r 'wdir()'`,
> > > which also shows plusses to indicate that the changes are only in the
> > > working directory.
> > > 
> > > I think we should keep this behaviour throughout, for consistency.
> > > Since `wdir()` is still marked as experimental, we can change its
> > > current behaviour. I propose consistency with `hg id` as follows:
> > 
> > First, I'm okay to change the output of "hg whatever -r 'wdir()'" if that
> > makes things more consistent. However, {rev}/{node} keywords should still
> > return wdirrev/wdirhex since they are valid identifiers whereas "+"
> > isn't.
> 
> But this is the problem that we currently have. It's difficult to
> produce the default template of `hg id` unless you dig deeper into
> template syntax.

Isn't it just -T "{id}"?
(CC Matt Harbison as he is the expert of the id template.)

> Maybe we should just make the `+` part of the syntax
> for parsing revnums... but that conflicts with revset syntax, oh
> bother.
> 
> Could we add a unary postfix `+` operator to revsets?

No. It would make revset parsing more ambiguous, and the idea was rejected
a few years ago.

> > > * If the working directory is clean, the following are equivalent:
> > > 
> > >   hg log -r 'wdir()' -T '{rev}:{node}'
> > >   hg log -r . -T '{rev}:{node}'
> > 
> > Do you mean `hg log -r 'wdir()'` should fall back to '.' if wdir is clean?
> > I believe it'll be way complicated.
> 
> Maybe yes? Conceptually, showing the log for the wdir doesn't seem to
> be that useful of an operation. The only reason I can see for doing
> that is to get the current time and the current user, but that would
> probably be better done with dedicated template keywords.

Querying changesets is one use case of "hg log". For instance,
"hg log -r 'null:wdir() and file("b")' -T '{rev}'" will list any
(possibly-pseudo) revisions touching the file "b", and the frontend script
can fetch each revision data subsequently by "hg  -r " so
long as '{rev}' is a valid identifier.

> > If clean "wdir()" == ".", "hg status --change 'wdir()'" would have to
> > show the changes in "." as well, which makes no sense.
> 
> Hm, okay, I see the complication here. So maybe let's not do this
> except for display purpose of the {rev} and {node} template keywords.

That seems worse. "hg log -pr 'wdir()'" would show p1 rev/node plus
wdir diff.

I think the identify command is special in that "id -r 'wdir()'" works as
if it fell back to "id -r .". That's fine for id, which is pretty simple
command, but the other commands can produce various data in various ways.
Making everything consistent wouldn't be easy if we'd take the id command
way of wdir handling.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH evolve-ext] legacy: drop the check for `obsolete._enabled`

2019-04-29 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1556594189 14400
#  Mon Apr 29 23:16:29 2019 -0400
# Node ID 6ee8b75ac34337d13309044cd1fd6cbf13de0ff1
# Parent  5c913f7081b36f71c3678f3686f89d5365e7bdeb
legacy: drop the check for `obsolete._enabled`

This looks like an ancient version check, and presumably `minimumhgversion` will
do the same thing.

diff --git a/hgext3rd/evolve/legacy.py b/hgext3rd/evolve/legacy.py
--- a/hgext3rd/evolve/legacy.py
+++ b/hgext3rd/evolve/legacy.py
@@ -15,12 +15,6 @@
 
 from mercurial import error
 
-try:
-from mercurial import obsolete
-obsolete._enabled
-except ImportError:
-raise error.Abort('Obsolete extension requires Mercurial 2.3 (or later)')
-
 import sys
 import json
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] obsolete: drop the legacy `_enabled` variable

2019-04-29 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1556593242 14400
#  Mon Apr 29 23:00:42 2019 -0400
# Node ID ca762c2bbe6b00a4af999eb77a3f6daf48acb0cd
# Parent  d0e773ad907784c0479499e3a33e93d746d42e7a
obsolete: drop the legacy `_enabled` variable

Evolve 8.5.0 stopped setting this, and it would have been easier to figure out
why TortoiseHg stopped allowing amends if it would have crashed on the missing
variable.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -93,10 +93,6 @@ parsers = policy.importmod(r'parsers')
 _calcsize = struct.calcsize
 propertycache = util.propertycache
 
-# the obsolete feature is not mature enough to be enabled by default.
-# you have to rely on third party extension extension to enable this.
-_enabled = False
-
 # Options for obsolescence
 createmarkersopt = 'createmarkers'
 allowunstableopt = 'allowunstable'
@@ -124,11 +120,6 @@ def _getoptionvalue(repo, option):
 if 'all' in result:
 return True
 
-# For migration purposes, temporarily return true if the config hasn't
-# been set but _enabled is true.
-if len(result) == 0 and _enabled:
-return True
-
 # Temporary hack for next check
 newconfig = repo.ui.config('experimental', 'evolution.createmarkers')
 if newconfig:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6314: discovery: only calculate closed branches if required

2019-04-29 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd0e773ad9077: discovery: only calculate closed branches if 
required (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6314?vs=14931=14973

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

AFFECTED FILES
  mercurial/discovery.py

CHANGE DETAILS

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -340,15 +340,15 @@
 pushop.pushbranchmap = headssum
 newbranches = [branch for branch, heads in headssum.iteritems()
if heads[0] is None]
-# Makes a set of closed branches
-closedbranches = set()
-for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
-if isclosed:
-closedbranches.add(tag)
-closedbranches = (closedbranches & set(newbranches))
 # 1. Check for new branches on the remote.
 if newbranches and not newbranch:  # new branch requires --new-branch
 branchnames = ', '.join(sorted(newbranches))
+# Calculate how many of the new branches are closed branches
+closedbranches = set()
+for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
+if isclosed:
+closedbranches.add(tag)
+closedbranches = (closedbranches & set(newbranches))
 if closedbranches:
 errmsg = (_("push creates new remote branches: %s (%d closed)!")
 % (branchnames, len(closedbranches)))



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


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

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


  In https://phab.mercurial-scm.org/D6255#91965, @martinvonz wrote:
  
  > 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.
  
  
  The biggest difference turned out to come from the `isintruducedafter()` that 
I mentioned earlier. I'd be fine with removing that, but we can discuss that 
after this patch is landed. I think it's an improvement to make pathcopies() 
and mergecopies() more consistent anyway.
  
  While investigating differences between pathcopies() and mergecopies(), I 
noticed some other differences and I've added tests for them. As you can see in 
this patch, some of them are now fixed.

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-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14964.
martinvonz edited the summary of this revision.

REPOSITORY
  rHG Mercurial

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

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 

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

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

REPOSITORY
  rHG Mercurial

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

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


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

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

REPOSITORY
  rHG Mercurial

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

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


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

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

REPOSITORY
  rHG Mercurial

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

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-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14965.

REPOSITORY
  rHG Mercurial

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

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
@@ -555,7 +535,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


D6274: copies: document cases in _chain()

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

REPOSITORY
  rHG Mercurial

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

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


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

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

REPOSITORY
  rHG Mercurial

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

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


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

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

REPOSITORY
  rHG Mercurial

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

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


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

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

REPOSITORY
  rHG Mercurial

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

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
@@ -527,9 +527,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


D6330: tests: add test where copy source is deleted and added back

2019-04-29 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 another difference between pathcopies() and mergecopies():
  mergecopies() considers files that have been deleted and then added
  back as different files, but pathcopies() does not.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-rename-merge1.t

CHANGE DETAILS

diff --git a/tests/test-rename-merge1.t b/tests/test-rename-merge1.t
--- a/tests/test-rename-merge1.t
+++ b/tests/test-rename-merge1.t
@@ -184,3 +184,52 @@
   $ hg status
   M newfile
   $ cd ..
+
+Check that file is considered unrelated when deleted and recreated
+
+  $ hg init unrelated
+  $ cd unrelated
+  $ echo foo > file
+  $ hg add file
+  $ hg commit -m "added file"
+  $ hg cp file newfile
+  $ hg commit -m "copy file"
+  $ hg update 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg rm file
+  $ hg commit -m "deleted file"
+  created new head
+  $ echo bar > file
+  $ hg add file
+  $ hg ci -m 'recreate file'
+  $ hg log -G -T '{rev} {desc}\n'
+  @  3 recreate file
+  |
+  o  2 deleted file
+  |
+  | o  1 copy file
+  |/
+  o  0 added file
+  
+BROKEN: this is inconsistent with `hg merge` (below), which doesn't consider
+'file' renamed same since it was deleted for a while
+  $ hg st --copies --rev 3 --rev 1
+  M file
+  A newfile
+file
+  $ hg merge --debug 1
+unmatched files in other:
+ newfile
+all copies found (* = to merge, ! = divergent, % = renamed and deleted):
+ src: 'file' -> dst: 'newfile' 
+checking for directory renames
+  resolving manifests
+   branchmerge: True, force: False, partial: False
+   ancestor: 19d7f95df299, local: 4e4a42b1cbdf+, remote: 45b14aae7432
+   newfile: remote created -> g
+  getting newfile
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg status
+  M newfile
+  $ 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


Re: Changing the wdir() {rev} and {node} output

2019-04-29 Thread Jordi Gutiérrez Hermoso
On Wed, 2019-04-17 at 08:29 +0900, Yuya Nishihara wrote:
> On Tue, 16 Apr 2019 10:14:53 -0400, Jordi Gutiérrez Hermoso wrote:
> > While I think it might be okay to keep the iternal values,
> > 
> > https://www.mercurial-scm.org/repo/hg/file/967c098eed33/mercurial/node.py#l39
> > 
> > I think it's far too confusing to expose them in the user interface.
> > 
> > A particular inconsistency I see is that we already have a way to show
> > wdir(), for example. In a way, `hg id -T` is kind of an alias for `hg
> > log -r 'wdir()' -T ... ` in a way that is not obvious. But trying to
> > use '{node}' or '{rev}' in `hg id` results in exposing the internal
> > revision and node magic numbers, which is very confusing behaviour,
> > since the default behaviour of `hg id` is to show `{p1.rev}+` instead
> > if there are changes in the wdir.
> > 
> > Another instance in which this happens is `hg annotate -r 'wdir()'`,
> > which also shows plusses to indicate that the changes are only in the
> > working directory.
> > 
> > I think we should keep this behaviour throughout, for consistency.
> > Since `wdir()` is still marked as experimental, we can change its
> > current behaviour. I propose consistency with `hg id` as follows:
> 
> First, I'm okay to change the output of "hg whatever -r 'wdir()'" if that
> makes things more consistent. However, {rev}/{node} keywords should still
> return wdirrev/wdirhex since they are valid identifiers whereas "+"
> isn't.

But this is the problem that we currently have. It's difficult to
produce the default template of `hg id` unless you dig deeper into
template syntax. Maybe we should just make the `+` part of the syntax
for parsing revnums... but that conflicts with revset syntax, oh
bother.

Could we add a unary postfix `+` operator to revsets?

> > * If the working directory is clean, the following are equivalent:
> > 
> >   hg log -r 'wdir()' -T '{rev}:{node}'
> >   hg log -r . -T '{rev}:{node}'
> 
> Do you mean `hg log -r 'wdir()'` should fall back to '.' if wdir is clean?
> I believe it'll be way complicated.

Maybe yes? Conceptually, showing the log for the wdir doesn't seem to
be that useful of an operation. The only reason I can see for doing
that is to get the current time and the current user, but that would
probably be better done with dedicated template keywords.

> If clean "wdir()" == ".", "hg status --change 'wdir()'" would have to
> show the changes in "." as well, which makes no sense.

Hm, okay, I see the complication here. So maybe let's not do this
except for display purpose of the {rev} and {node} template keywords.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Man page: grouping commands by topic (patch in Phabricator)

2019-04-29 Thread Sietse Brouwer

Dear all,
(CC: Frederick)

Just over a month ago, a personal called Frederick suggested to the 
general Mercurial mailing list that the hg(1) man page could present its 
commands in a learning-friendly order, rather than in alphabetical 
order. This seemed like a sensible and useful suggestion, and `hg help` 
already groups commands by category and defines a useful category order, 
so I have prepared a patch stack and submitted that to Phabricator.


In summary: this patch stack makes the man page group commands by the 
same categories used in `hg help`, that is "Repository creation", 
"Remote repository management", "Change creation", et cetera.


- The first patch in the stack is https://phab.mercurial-scm.org/D6324
  "help: register the 'gpg' command category and give it a description"

- The last patch in the stack is https://phab.mercurial-scm.org/D6329
  "gendoc: nest command headers under category headers"

- A comment on that last patch links to the original and changed output 
of `hg.1` and `hg.1.html`, so you can examine the result.


I hope that this patch looks interesting enough to review. Some final 
remarks:


- The command headers get pushed one level down by the appearance of the 
command category headers. In the HTML this works. In the man page, 
though, there are not enough section levels so both levels get rendered 
as .SS headers. In practice, you still get the effect of category 
headers, because those are sentence-case phrases whereas the commands 
are lowercase words.


- The output of hgignore.5, hgrc.5, hg-ssh.8, and their HTML 
counterparts remains unchanged. They, too, are generated by 
`doc/gendoc.py`, but the changes don't affect their output.


Kind regards,

Sietse
Sietse Brouwer

PS: In general, how does one present such a patch stack in Phabricator 
to the mailing list? Does one link to the first patch in the stack, or 
to the last one, or to every patch? Should I mail a list of patches, 
instead?

___
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-29 Thread Sietse (Sietse Brouwer)
Sietse added a comment.


  Changing this script affects hg.1 and hg.1.html. I have uploaded the original 
output, and the output after this patch stack; links below.
  
  hg.1:
  
  - (original) F286175: 1-original-hg.1 
  - (by category, with nested headers) F286176: 6-nestedheaders-hg.1 

  
  hg.1.html:
  
  - (original) F286177: 1-original-hg.1.html 
 (original)
  - (by category, with nested headers) F286178: 6-nestedheaders-hg.1.html 


REPOSITORY
  rHG Mercurial

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

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