[Bug 6086] New: In-memory rebase still calls update hooks, but not preupdate hooks

2019-02-20 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6086

Bug ID: 6086
   Summary: In-memory rebase still calls update hooks, but not
preupdate hooks
   Product: Mercurial
   Version: unspecified
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: rebase
  Assignee: bugzi...@mercurial-scm.org
  Reporter: h...@pewpew.net
CC: mercurial-devel@mercurial-scm.org

Here's a .t file showing the issue; the in-memory rebase runs update hooks (not
sure why), but doesn't run preupdate hooks.  It should probably run both or
neither?

  $ cat > preupdate.sh < #!/bin/bash
  > echo preupdate >> $TESTTMP/update_hooks.txt
  > EOF
  $ cat > update.sh < #!/bin/bash
  > echo update >> $TESTTMP/update_hooks.txt
  > EOF
  $ chmod +x preupdate.sh update.sh

  $ cat >> $HGRCPATH < [experimental]
  > evolution.createmarkers=True
  > evolution.allowunstable=True
  > [extensions]
  > rebase=
  > [hooks]
  > preupdate.does_it_work=$TESTTMP/preupdate.sh
  > update.does_it_work=$TESTTMP/update.sh
  > EOF
  $ hg init a
  $ cd a
  $ echo r0 > file.txt
  $ hg ci -qAm 'r0'
  $ echo r1 > file.txt
  $ hg ci -qAm 'r1'
  $ echo r2 > file.txt
  $ hg ci -qAm 'r2'
  $ hg co -qr 0

no inmemory rebase:
  $ hg commit -q --amend -m 'r0_amended' 're:^$'
  2 new orphan changesets
  $ rm $TESTTMP/update_hooks.txt
  $ hg rebase -qr 1::2 -d .
  $ cat $TESTTMP/update_hooks.txt
  preupdate
  update
  preupdate
  update
  preupdate
  update

with inmemory rebase:
  $ hg commit -q --amend -m 'r0_amended_again' 're:^$'
  2 new orphan changesets
  $ rm $TESTTMP/update_hooks.txt
  $ hg --config rebase.experimental.inmemory=1 rebase -qr 4::5 -d .
  $ cat $TESTTMP/update_hooks.txt
  update
  update

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


mercurial@41726: 2 new changesets (2 on stable)

2019-02-20 Thread Mercurial Commits
2 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/ffbf742bfe1f
changeset:   41725:ffbf742bfe1f
branch:  stable
parent:  41614:f2f538725d07
user:Yuya Nishihara 
date:Thu Feb 07 20:50:41 2019 +0900
summary: subrepo: add test for Windows relative-ish path with drive letter

https://www.mercurial-scm.org/repo/hg/rev/a62690659d6b
changeset:   41726:a62690659d6b
branch:  stable
tag: tip
user:Matt Harbison 
date:Wed Feb 20 20:57:58 2019 -0500
summary: tests: add a missing abort exit code on Windows in 
test-audit-subrepo.t

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


Re: [PATCH STABLE] tests: add a missing abort exit code on Windows in test-audit-subrepo.t

2019-02-20 Thread Yuya Nishihara
On Wed, 20 Feb 2019 20:59:25 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1550714278 18000
> #  Wed Feb 20 20:57:58 2019 -0500
> # Branch stable
> # Node ID a62690659d6bbe5abd4bb1a45248b0c760cb9188
> # Parent  ffbf742bfe1fea23931c13fd53ab5d03838d97eb
> tests: add a missing abort exit code on Windows in test-audit-subrepo.t

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


D5990: context: introduce p[12]copies() methods and debugp[12]copies commands

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG456ad0fd8e18: context: introduce p[12]copies() methods and 
debugp[12]copies commands (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5990?vs=14160=14170

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

AFFECTED FILES
  mercurial/context.py
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-copies.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1011,6 +1011,10 @@
debugoptADV   (no help text available)
debugoptDEP   (no help text available)
debugoptEXP   (no help text available)
+   debugp1copies
+ dump copy information compared to p1
+   debugp2copies
+ dump copy information compared to p2
debugpathcomplete
  complete part or all of a tracked path
debugpathcopies
diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -17,12 +17,17 @@
   $ echo x > x
   $ hg ci -Aqm 'add x'
   $ hg mv x y
+  $ hg debugp1copies
+  x -> y
+  $ hg debugp2copies
   $ hg ci -m 'rename x to y'
   $ hg l
   @  1 rename x to y
   |  x y
   o  0 add x
  x
+  $ hg debugp1copies -r 1
+  x -> y
   $ hg debugpathcopies 0 1
   x -> y
   $ hg debugpathcopies 1 0
@@ -41,12 +46,17 @@
   $ echo y > y
   $ hg ci -Aqm 'add x and y'
   $ hg cp -f x y
+  $ hg debugp1copies
+  x -> y
+  $ hg debugp2copies
   $ hg ci -m 'copy x onto y'
   $ hg l
   @  1 copy x onto y
   |  y
   o  0 add x and y
  x y
+  $ hg debugp1copies -r 1
+  x -> y
 Incorrectly doesn't show the rename
   $ hg debugpathcopies 0 1
 
@@ -63,6 +73,8 @@
   |  x2
   o  0 add x and x2 with same content
  x x2
+  $ hg debugp1copies -r 1
+  x -> x2
 Incorrectly doesn't show the rename
   $ hg debugpathcopies 0 1
 
@@ -85,14 +97,19 @@
   |  y
   o  0 add x
  x
+  $ hg debugp1copies -r 3
+  x -> y
   $ hg debugpathcopies 0 3
   x -> y
 
 Rename file in a loop: x->y->z->x
   $ newrepo
   $ echo x > x
   $ hg ci -Aqm 'add x'
   $ hg mv x y
+  $ hg debugp1copies
+  x -> y
+  $ hg debugp2copies
   $ hg ci -m 'rename x to y'
   $ hg mv y z
   $ hg ci -m 'rename y to z'
@@ -129,6 +146,7 @@
   |  x y
   o  0 add x
  x
+  $ hg debugp1copies -r 3
   $ hg debugpathcopies 0 3
 
 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy 
metadata in the
@@ -153,6 +171,8 @@
   |  z
   o  0 add x and x2 with same content
  x x2
+  $ hg debugp1copies -r 3
+  x2 -> z
   $ hg debugpathcopies 0 3
   x2 -> z
 
@@ -225,6 +245,8 @@
   $ echo z > z
   $ hg ci -Aqm 'add z'
   $ hg merge -q 1
+  $ hg debugp1copies
+  $ hg debugp2copies
   $ hg ci -m 'merge rename from p2'
   $ hg l
   @3 merge rename from p2
@@ -237,6 +259,8 @@
  x
 Perhaps we should indicate the rename here, but `hg status` is documented to 
be weird during
 merges, so...
+  $ hg debugp1copies -r 3
+  $ hg debugp2copies -r 3
   $ hg debugpathcopies 0 3
   x -> y
   $ hg debugpathcopies 1 2
@@ -254,10 +278,16 @@
   $ hg ci -Aqm 'add y'
   $ hg merge -q 0
   $ hg cp y z
+  $ hg debugp1copies
+  y -> z
+  $ hg debugp2copies
   $ hg ci -m 'copy file from p1 in merge'
   $ hg co -q 1
   $ hg merge -q 0
   $ hg cp x z
+  $ hg debugp1copies
+  $ hg debugp2copies
+  x -> z
   $ hg ci -qm 'copy file from p2 in merge'
   $ hg l
   @3 copy file from p2 in merge
@@ -268,9 +298,15 @@
   |y
   o  0 add x
  x
+  $ hg debugp1copies -r 2
+  y -> z
+  $ hg debugp2copies -r 2
   $ hg debugpathcopies 1 2
   y -> z
   $ hg debugpathcopies 0 2
+  $ hg debugp1copies -r 3
+  $ hg debugp2copies -r 3
+  x -> z
   $ hg debugpathcopies 1 3
   $ hg debugpathcopies 0 3
   x -> z
@@ -284,14 +320,20 @@
   $ hg ci -Aqm 'add x on branch 2'
   $ hg merge -q 0
   $ hg cp x z
+  $ hg debugp1copies
+  x -> z
+  $ hg debugp2copies
   $ hg ci -qm 'merge'
   $ hg l
   @2 merge
   |\   z
   | o  1 add x on branch 2
   |x
   o  0 add x on branch 1
  x
+  $ hg debugp1copies -r 2
+  x -> z
+  $ hg debugp2copies -r 2
 It's a little weird that it shows up on both sides
   $ hg debugpathcopies 1 2
   x -> z
@@ -312,14 +354,20 @@
   $ hg resolve -m x
   (no more unresolved files)
   $ hg cp x z
+  $ hg debugp1copies
+  x -> z
+  $ hg debugp2copies
   $ hg ci -qm 'merge'
   $ hg l
   @2 merge
   |\   x z
   | o  1 add x on branch 2
   |x
   o  0 add x on branch 1
  x
+  $ hg debugp1copies -r 2
+  $ hg debugp2copies -r 2
+  x -> z
   $ hg debugpathcopies 1 2
   $ hg debugpathcopies 0 2
   x -> z
@@ -345,6 +393,8 @@
   |/   y
   o  0 add x
  x
+  $ hg debugp1copies -r 3
+  $ hg debugp2copies -r 3
   $ hg debugpathcopies 2 3
   x -> y
   $ hg debugpathcopies 1 3
@@ -375,6 +425,9 @@
   |/   y
   o  0 add x
  x
+  $ hg debugp1copies -r 3
+  y -> z
+  $ hg debugp2copies -r 3
   $ hg 

D5991: copies: do copy tracing based on ctx.p[12]copies() if configured

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2d562af6014b: copies: do copy tracing based on 
ctx.p[12]copies() if configured (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5991?vs=14161=14171

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,9 +1,17 @@
+#testcases filelog compatibility
 
   $ cat >> $HGRCPATH << EOF
   > [alias]
   > l = log -G -T '{rev} {desc}\n{files}\n'
   > EOF
 
+#if compatibility
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > copies.read-from = compatibility
+  > EOF
+#endif
+
   $ REPONUM=0
   $ newrepo() {
   > cd $TESTTMP
@@ -338,7 +346,7 @@
   $ hg debugpathcopies 1 2
   x -> z
   $ hg debugpathcopies 0 2
-  x -> z
+  x -> z (filelog !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -476,7 +484,8 @@
   $ hg debugpathcopies 1 4
   $ hg debugpathcopies 2 4
   $ hg debugpathcopies 0 4
-  x -> z
+  x -> z (filelog !)
+  y -> z (compatibility !)
   $ hg debugpathcopies 1 5
   $ hg debugpathcopies 2 5
   $ hg debugpathcopies 0 5
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -166,6 +166,10 @@
 # files might have to be traced back to the fctx parent of the last
 # one-side-only changeset, but not further back than that
 repo = a._repo
+
+if repo.ui.config('experimental', 'copies.read-from') == 'compatibility':
+return _changesetforwardcopies(a, b, match)
+
 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
 dbg = repo.ui.debug
 if debug:
@@ -216,6 +220,76 @@
 % (util.timer() - start))
 return cm
 
+def _changesetforwardcopies(a, b, match):
+if a.rev() == node.nullrev:
+return {}
+
+repo = a.repo()
+children = {}
+cl = repo.changelog
+missingrevs = cl.findmissingrevs(common=[a.rev()], heads=[b.rev()])
+for r in missingrevs:
+for p in cl.parentrevs(r):
+if p == node.nullrev:
+continue
+if p not in children:
+children[p] = [r]
+else:
+children[p].append(r)
+
+roots = set(children) - set(missingrevs)
+# 'work' contains 3-tuples of a (revision number, parent number, copies).
+# The parent number is only used for knowing which parent the copies dict
+# came from.
+work = [(r, 1, {}) for r in roots]
+heapq.heapify(work)
+while work:
+r, i1, copies1 = heapq.heappop(work)
+if work and work[0][0] == r:
+# We are tracing copies from both parents
+r, i2, copies2 = heapq.heappop(work)
+copies = {}
+ctx = repo[r]
+p1man, p2man = ctx.p1().manifest(), ctx.p2().manifest()
+allcopies = set(copies1) | set(copies2)
+# TODO: perhaps this filtering should be done as long as ctx
+# is merge, whether or not we're tracing from both parent.
+for dst in allcopies:
+if not match(dst):
+continue
+if dst not in copies2:
+# Copied on p1 side: mark as copy from p1 side if it didn't
+# already exist on p2 side
+if dst not in p2man:
+copies[dst] = copies1[dst]
+elif dst not in copies1:
+# Copied on p2 side: mark as copy from p2 side if it didn't
+# already exist on p1 side
+if dst not in p1man:
+copies[dst] = copies2[dst]
+else:
+# Copied on both sides: mark as copy from p1 side
+copies[dst] = copies1[dst]
+else:
+copies = copies1
+if r == b.rev():
+return copies
+for c in children[r]:
+childctx = repo[c]
+if r == childctx.p1().rev():
+parent = 1
+childcopies = childctx.p1copies()
+else:
+assert r == childctx.p2().rev()
+parent = 2
+childcopies = childctx.p2copies()
+if not match.always():
+childcopies = {dst: src for dst, src in childcopies.items()
+   if match(dst)}
+childcopies = _chain(a, childctx, copies, childcopies)
+heapq.heappush(work, (c, parent, childcopies))
+assert False
+
 def _forwardcopies(a, b, match=None):
 """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- 

D5989: copies: filter out copies when target is not in destination manifest

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG58d50c697dc7: copies: filter out copies when target is not 
in destination manifest (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5989?vs=14159=14169

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -194,9 +194,7 @@
   |/   x y
   o  0 add x
  x
-BROKEN: x doesn't exist here
   $ hg debugpathcopies 1 2
-  y -> x
 
 Copies via null revision (there shouldn't be any)
   $ newrepo
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -124,10 +124,13 @@
 # file is a copy of an existing file
 t[k] = v
 
-# remove criss-crossed copies
 for k, v in list(t.items()):
+# remove criss-crossed copies
 if k in src and v in dst:
 del t[k]
+# remove copies to files that were then removed
+elif k not in dst:
+del t[k]
 
 return t
 



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


D5988: copies: make _backwardrenames() filter out copies by destination

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3f94deee167c: copies: make _backwardrenames() filter out 
copies by destination (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5988?vs=14158=14168

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -33,9 +33,7 @@
   y -> x
   $ hg debugpathcopies 0 1 y
   x -> y
-BROKEN: the following command should not include the copy
   $ hg debugpathcopies 1 0 y
-  y -> x
 
 Copy a file onto another file
   $ newrepo
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -228,16 +228,21 @@
 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
 return _committedforwardcopies(a, b, match)
 
-def _backwardrenames(a, b):
+def _backwardrenames(a, b, match):
 if a._repo.ui.config('experimental', 'copytrace') == 'off':
 return {}
 
 # Even though we're not taking copies into account, 1:n rename situations
 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
 # arbitrarily pick one of the renames.
+# We don't want to pass in "match" here, since that would filter
+# the destination by it. Since we're reversing the copies, we want
+# to filter the source instead.
 f = _forwardcopies(b, a)
 r = {}
 for k, v in sorted(f.iteritems()):
+if match and not match(v):
+continue
 # remove copies
 if v in a:
 continue
@@ -261,10 +266,10 @@
 if a == y:
 if debug:
 repo.ui.debug('debug.copies: search mode: backward\n')
-return _backwardrenames(x, y)
+return _backwardrenames(x, y, match=match)
 if debug:
 repo.ui.debug('debug.copies: search mode: combined\n')
-return _chain(x, y, _backwardrenames(x, a),
+return _chain(x, y, _backwardrenames(x, a, match=match),
   _forwardcopies(a, y, match=match))
 
 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):



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


D5986: tests: add tests of pathcopies()

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4711f3a2ca47: tests: add tests of pathcopies() (authored by 
martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5986?vs=14156=14166

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
new file mode 100644
--- /dev/null
+++ b/tests/test-copies.t
@@ -0,0 +1,435 @@
+
+  $ cat >> $HGRCPATH << EOF
+  > [alias]
+  > l = log -G -T '{rev} {desc}\n{files}\n'
+  > EOF
+
+  $ REPONUM=0
+  $ newrepo() {
+  > cd $TESTTMP
+  > REPONUM=`expr $REPONUM + 1`
+  > hg init repo-$REPONUM
+  > cd repo-$REPONUM
+  > }
+
+Simple rename case
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg l
+  @  1 rename x to y
+  |  x y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 1
+  x -> y
+  $ hg debugpathcopies 1 0
+  y -> x
+Test filtering copies by path. We do filtering by destination.
+  $ hg debugpathcopies 0 1 x
+  $ hg debugpathcopies 1 0 x
+  y -> x
+  $ hg debugpathcopies 0 1 y
+  x -> y
+BROKEN: the following command should not include the copy
+  $ hg debugpathcopies 1 0 y
+  y -> x
+
+Copy a file onto another file
+  $ newrepo
+  $ echo x > x
+  $ echo y > y
+  $ hg ci -Aqm 'add x and y'
+  $ hg cp -f x y
+  $ hg ci -m 'copy x onto y'
+  $ hg l
+  @  1 copy x onto y
+  |  y
+  o  0 add x and y
+ x y
+Incorrectly doesn't show the rename
+  $ hg debugpathcopies 0 1
+
+Copy a file onto another file with same content. If metadata is stored in 
changeset, this does not
+produce a new filelog entry. The changeset's "files" entry should still list 
the file.
+  $ newrepo
+  $ echo x > x
+  $ echo x > x2
+  $ hg ci -Aqm 'add x and x2 with same content'
+  $ hg cp -f x x2
+  $ hg ci -m 'copy x onto x2'
+  $ hg l
+  @  1 copy x onto x2
+  |  x2
+  o  0 add x and x2 with same content
+ x x2
+Incorrectly doesn't show the rename
+  $ hg debugpathcopies 0 1
+
+Copy a file, then delete destination, then copy again. This does not create a 
new filelog entry.
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg cp x y
+  $ hg ci -m 'copy x to y'
+  $ hg rm y
+  $ hg ci -m 'remove y'
+  $ hg cp -f x y
+  $ hg ci -m 'copy x onto y (again)'
+  $ hg l
+  @  3 copy x onto y (again)
+  |  y
+  o  2 remove y
+  |  y
+  o  1 copy x to y
+  |  y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 3
+  x -> y
+
+Rename file in a loop: x->y->z->x
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg mv y z
+  $ hg ci -m 'rename y to z'
+  $ hg mv z x
+  $ hg ci -m 'rename z to x'
+  $ hg l
+  @  3 rename z to x
+  |  x z
+  o  2 rename y to z
+  |  y z
+  o  1 rename x to y
+  |  x y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 3
+
+Copy x to y, then remove y, then add back y. With copy metadata in the 
changeset, this could easily
+end up reporting y as copied from x (if we don't unmark it as a copy when it's 
removed).
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg rm y
+  $ hg ci -qm 'remove y'
+  $ echo x > y
+  $ hg ci -Aqm 'add back y'
+  $ hg l
+  @  3 add back y
+  |  y
+  o  2 remove y
+  |  y
+  o  1 rename x to y
+  |  x y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 3
+
+Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy 
metadata in the
+changeset, the two copies here will have the same filelog entry, so 
ctx['z'].introrev() might point
+to the first commit that added the file. We should still report the copy as 
being from x2.
+  $ newrepo
+  $ echo x > x
+  $ echo x > x2
+  $ hg ci -Aqm 'add x and x2 with same content'
+  $ hg cp x z
+  $ hg ci -qm 'copy x to z'
+  $ hg rm z
+  $ hg ci -m 'remove z'
+  $ hg cp x2 z
+  $ hg ci -m 'copy x2 to z'
+  $ hg l
+  @  3 copy x2 to z
+  |  z
+  o  2 remove z
+  |  z
+  o  1 copy x to z
+  |  z
+  o  0 add x and x2 with same content
+ x x2
+  $ hg debugpathcopies 0 3
+  x2 -> z
+
+Create x and y, then rename them both to the same name, but on different sides 
of a fork
+  $ newrepo
+  $ echo x > x
+  $ echo y > y
+  $ hg ci -Aqm 'add x and y'
+  $ hg mv x z
+  $ hg ci -qm 'rename x to z'
+  $ hg co -q 0
+  $ hg mv y z
+  $ hg ci -qm 'rename y to z'
+  $ hg l
+  @  2 rename y to z
+  |  y z
+  | o  1 rename x to z
+  |/   x z
+  o  0 add x and y
+ x y
+  $ hg debugpathcopies 1 2
+  z -> x
+  y -> z
+
+Fork renames x to y on one side and removes x on the other
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg co -q 0
+  $ hg rm x
+  $ hg ci -m 'remove x'
+  created new head
+  $ hg l
+  @  2 remove x
+  |  x
+  | o  1 rename x to y
+  |/   x y
+  o  0 add x
+ x
+BROKEN: x doesn't exist here
+  $ hg debugpathcopies 1 2
+  y -> x
+
+Copies via 

D5987: copies: respect narrowmatcher in "parent -> working dir" case

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfd973639f5e9: copies: respect narrowmatcher in parent 
- working dir case (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5987?vs=14157=14167

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

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
@@ -141,8 +141,8 @@
 if limit >= 0 and not f.isintroducedafter(limit):
 return None
 
-def _dirstatecopies(d, match=None):
-ds = d._repo.dirstate
+def _dirstatecopies(repo, match=None):
+ds = repo.dirstate
 c = ds.copies().copy()
 for k in list(c):
 if ds[k] not in 'anm' or (match and not match(k)):
@@ -221,11 +221,11 @@
 if b.rev() is None:
 if a == b.p1():
 # short-circuit to avoid issues with merge states
-return _dirstatecopies(b, match)
+return _dirstatecopies(b._repo, match)
 
 cm = _committedforwardcopies(a, b.p1(), match)
 # combine copies from dirstate if necessary
-return _chain(a, b, cm, _dirstatecopies(b, match))
+return _chain(a, b, cm, _dirstatecopies(b._repo, match))
 return _committedforwardcopies(a, b, match)
 
 def _backwardrenames(a, b):
@@ -391,9 +391,11 @@
 if not c1 or not c2 or c1 == c2:
 return {}, {}, {}, {}, {}
 
+narrowmatch = c1.repo().narrowmatch()
+
 # avoid silly behavior for parent -> working dir
 if c2.node() is None and c1.node() == repo.dirstate.p1():
-return repo.dirstate.copies(), {}, {}, {}, {}
+return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {}
 
 copytracing = repo.ui.config('experimental', 'copytrace')
 boolctrace = stringutil.parsebool(copytracing)



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


[PATCH STABLE] tests: add a missing abort exit code on Windows in test-audit-subrepo.t

2019-02-20 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1550714278 18000
#  Wed Feb 20 20:57:58 2019 -0500
# Branch stable
# Node ID a62690659d6bbe5abd4bb1a45248b0c760cb9188
# Parent  ffbf742bfe1fea23931c13fd53ab5d03838d97eb
tests: add a missing abort exit code on Windows in test-audit-subrepo.t

diff --git a/tests/test-audit-subrepo.t b/tests/test-audit-subrepo.t
--- a/tests/test-audit-subrepo.t
+++ b/tests/test-audit-subrepo.t
@@ -693,6 +693,7 @@ on clone (and update):
 
   $ hg clone -q driveletter driveletter2
   abort: path contains illegal component: X:
+  [255]
 
 #else
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] subrepo: add test for Windows relative-ish path with drive letter

2019-02-20 Thread Yuya Nishihara
On Wed, 20 Feb 2019 20:00:48 -0500, Matt Harbison wrote:
> On Wed, 20 Feb 2019 00:56:42 -0500, Martin von Zweigbergk  
>  wrote:
> 
> > On Fri, Feb 8, 2019 at 6:42 AM Yuya Nishihara  wrote:
> >
> >> # HG changeset patch
> >> # User Yuya Nishihara 
> >> # Date 1549540241 -32400
> >> #  Thu Feb 07 20:50:41 2019 +0900
> >> # Branch stable
> >> # Node ID adf01cdceea20b5ad6dacb11dbb1d94e5055e39c
> >> # Parent  87a6e3c953e045d92147925fc71aad7c327fdbfd
> >> subrepo: add test for Windows relative-ish path with drive letter
> >>
> >
> > Queued for stable, thanks. Sorry about the delay.
> 
> Not sure what happened, but it looks like the abort is missing its exit  
> code.

Oops. Appears that I didn't simulate Windows result properly in my brain.

>  Do you want a followup, or can you amend it in place?

Can you send a follow up? It's behind a merge commit, so better to not
rewrite it.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] subrepo: add test for Windows relative-ish path with drive letter

2019-02-20 Thread Matt Harbison
On Wed, 20 Feb 2019 00:56:42 -0500, Martin von Zweigbergk  
 wrote:



On Fri, Feb 8, 2019 at 6:42 AM Yuya Nishihara  wrote:


# HG changeset patch
# User Yuya Nishihara 
# Date 1549540241 -32400
#  Thu Feb 07 20:50:41 2019 +0900
# Branch stable
# Node ID adf01cdceea20b5ad6dacb11dbb1d94e5055e39c
# Parent  87a6e3c953e045d92147925fc71aad7c327fdbfd
subrepo: add test for Windows relative-ish path with drive letter



Queued for stable, thanks. Sorry about the delay.


Not sure what happened, but it looks like the abort is missing its exit  
code.  Do you want a followup, or can you amend it in place?


https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests%20%28stable%29/builds/244/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: rust hg status

2019-02-20 Thread Augie Fackler


> On Feb 19, 2019, at 14:43, Valentin Gatien-Baron 
>  wrote:
> 
> 
> 
> On Tue, Feb 19, 2019 at 10:46 AM Augie Fackler  wrote:
> On Fri, Feb 15, 2019 at 02:39:44PM -0500, Valentin Gatien-Baron wrote:
> > Hello,
> >
> > I wrote a fraction of hg status in rust, just the minimum needed to
> > compare current revision and working copy with few of the flags and
> > config settings supported. As you can imagine, the goal was better
> > performance.  Before trying to upstream bits of this, I figured I'd
> > check there's interest for this change in particular, or this kind
> > of changes in general (I suspect rust would bring significant
> > improvements to hg cat or hg files). The rest of this mail is more
> > details.
> 
> This sounds _very_ promising and I'd love to see what you've got!
> 
> Cool!
> Seeing my mail again, it's perhaps not clearly said that what I have and what 
> I timed below is a fully rust exe that implements a fraction of hg status, 
> not a change to python hg that uses big chunks of rust some fraction of the 
> time. Though it seems that upstreaming would take the latter approach, at 
> least to start with.

I'm still interested in both - we've talked on and off about a small 
native-binary helper for things like printing information that people like in 
their shell prompt.

>  
> 
> >
> > While the implementation doesn't handle every uncommon situation right
> > and could use some serious cleanup, it's an interesting performance
> > improvement. In a repository with 100k tracked files and 500k ignored
> > files, in the best case and measuring on a good machine:
> >
> > - hg-rs st takes ~50ms
> > - hg-rs st -mard takes ~14ms
> > - hg-rs st -u takes ~39ms
> >
> > By contrast, hg+chg+fsmonitor's best case is 110ms regardless of
> > flags. Without fsmonitor, we're talking about 2.4s for hg st or hg st
> > -u, and 400ms for hg st -mard. As a baseline, hg st --syntax-error
> > takes 12ms.
> 
> Fascinating! Are you using re2 or Python's built-in re?
> 
> Definitely using re2. If I disable re2, the full status goes from 2.4s to 
> 5.7s. I didn't say how the rust implementation differs from the python 
> version, but using rust+re2 is not enough to get to 40ms for finding unknown 
> files. In addition to optimizations to the hgignore handling (mostly special 
> treatment of globs that can match exactly one file), and parallelism, and not 
> pointlessly lstat'ing untracked files in filesystems that provide the 
> filetype in readdir, there's a cache that holds a list of "this directory is 
> known to have no untracked files assuming it has this timestamp, and the 
> hgignore is bla and the dirstate is bla", which usually shortcuts the listing 
> of untracked files in most directories, and thus shortcuts applying the 
> hgignore on such files. 
> Though even when the cache fails to help, like when the hgignore changes, 
> rust status takes 300ms (and it's quite plausible there's room for 
> improvement here, I stopped optimizing when it felt like a good enough 
> replacement).

Wow, even more impressive.

>  
> 
> >
> > A ratio of x2 compared with fsmonitor+chg is nice, but while neither
> > best case is what you get all the time, fsmonitor degrades pretty
> > badly, oftentimes in hard to understand ways, making for an
> > unpredictable experience that is frequently bad.
> > Say you change the hgignore, the rust version will take 300ms, the
> > fsmonitor version will take 4.4s (I think 2s timeout + 2.4s regular
> > status).
> > Say you remove a directory at the root of the repository, 50ms rust
> > vs 4.4s fsmonitor.
> > Say you haven't used a particular share in some time, you may well see
> > 1s rust vs 4.4s fsmonitor.
> >
> > So I think there's a lot of value in having status without fsmonitor
> > going much faster:
> > - increase significantly the scale at which fsmonitor is needed
> > - improve the bad cases of fsmonitor (or even the fast path depending
> > on how things are made to work together)
> >
> > Regards,
> >
> > Valentin Gatien-Baron
> 
> > ___
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


D5994: cleanup: prefer nested context managers to \-continuations

2019-02-20 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5994#87506, @martinvonz wrote:
  
  > > I'd prefer Python accept a tuple of context managers
  >
  > I think I'd also prefer if our context managers didn't acquire the resource 
in `__init__`. That would let us write it with less indentation as:
  >
  >   wlock = wlock or util.nullcontextmanager()
  >   lock = lock or util.nullcontextmanager()
  >   trmanager = pushop.trmanager or util.nullcontextmanager()
  >   with wlock, lock, trmanager:
  >
  >
  > (In this case we probably could do that anyway since we don't seem to worry 
about the risk of exceptions from the time we take the lock until we enter the 
context manager.)
  >
  > I don't care much either way about the patch itself. I'll wait a little to 
see if someone else cares more, but otherwise I'll take.
  
  
  That sounds like a good cleanup anyway - probably taking the resource is a 
vestige of when we were on around Python 2.3 and mpm had this discipline of 
using `del` to free things like locks. It worked, but isn't idiomatic today 
(I'm honestly not sure if it was then - but mpm is where I learned it.)

REPOSITORY
  rHG Mercurial

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

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


D5994: cleanup: prefer nested context managers to \-continuations

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  > I'd prefer Python accept a tuple of context managers
  
  I think I'd also prefer if our context managers didn't acquire the resource 
in `__init__`. That would let us write it with less indentation as:
  
wlock = wlock or util.nullcontextmanager()
lock = lock or util.nullcontextmanager()
trmanager = pushop.trmanager or util.nullcontextmanager()
with wlock, lock, trmanager:
  
  (In this case we probably could do that anyway since we don't seem to worry 
about the risk of exceptions from the time we take the lock until we enter the 
context manager.)
  
  I don't care much either way about the patch itself. I'll wait a little to 
see if someone else cares more, but otherwise I'll take.

REPOSITORY
  rHG Mercurial

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

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


D5993: cleanup: use () to wrap long lines instead of \

2019-02-20 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is a little less brittle, and often helps indentation. In a
  surprising number of cases the entire cleanup was deleting the \, as
  the expression was *already* parenthesized in a workable way.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/debugshell.py
  contrib/packaging/hg-docker
  hgext/acl.py
  hgext/bugzilla.py
  hgext/convert/cvsps.py
  hgext/convert/git.py
  hgext/convert/p4.py
  hgext/convert/subversion.py
  hgext/histedit.py
  hgext/infinitepush/__init__.py
  hgext/largefiles/lfutil.py
  hgext/largefiles/reposetup.py
  hgext/record.py
  hgext/releasenotes.py
  hgext/remotefilelog/fileserverclient.py
  hgext/shelve.py
  i18n/posplit
  mercurial/branchmap.py
  mercurial/bundle2.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/debugcommands.py
  mercurial/exchange.py
  mercurial/httpconnection.py
  mercurial/merge.py
  mercurial/minirst.py
  mercurial/patch.py
  mercurial/simplemerge.py
  mercurial/sparse.py
  mercurial/subrepo.py
  mercurial/tags.py
  mercurial/ui.py
  setup.py
  tests/hghave.py
  tests/run-tests.py
  tests/test-duplicateoptions.py
  tests/test-run-tests.py
  tests/test-simplekeyvaluefile.py

CHANGE DETAILS

diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py
--- a/tests/test-simplekeyvaluefile.py
+++ b/tests/test-simplekeyvaluefile.py
@@ -82,8 +82,8 @@
 dw = {b'key1': b'value1'}
 scmutil.simplekeyvaluefile(self.vfs, b'fl').write(dw, firstline=b'1.0')
 self.assertEqual(self.vfs.read(b'fl'), b'1.0\nkey1=value1\n')
-dr = scmutil.simplekeyvaluefile(self.vfs, b'fl')\
-.read(firstlinenonkeyval=True)
+dr = scmutil.simplekeyvaluefile(
+self.vfs, b'fl').read(firstlinenonkeyval=True)
 self.assertEqual(dr, {b'__firstline': b'1.0', b'key1': b'value1'})
 
 if __name__ == "__main__":
diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py
--- a/tests/test-run-tests.py
+++ b/tests/test-run-tests.py
@@ -37,8 +37,8 @@
 """
 assert (expected.endswith(b'\n')
 and output.endswith(b'\n')), 'missing newline'
-assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \
-   b'single backslash or unknown char'
+assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), (
+   b'single backslash or unknown char')
 test = run_tests.TTest(b'test-run-test.t', b'.', b'.')
 match, exact = test.linematch(expected, output)
 if isinstance(match, str):
diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py
--- a/tests/test-duplicateoptions.py
+++ b/tests/test-duplicateoptions.py
@@ -41,8 +41,8 @@
 seenshort = globalshort.copy()
 seenlong = globallong.copy()
 for option in entry[1]:
-if (option[0] and option[0] in seenshort) or \
-   (option[1] and option[1] in seenlong):
+if ((option[0] and option[0] in seenshort) or
+(option[1] and option[1] in seenlong)):
 print("command '" + cmd + "' has duplicate option " + str(option))
 seenshort.add(option[0])
 seenlong.add(option[1])
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -929,8 +929,8 @@
 self.fail('no result code from test')
 elif out != self._refout:
 # Diff generation may rely on written .err file.
-if (ret != 0 or out != self._refout) and not self._skipped \
-and not self._debug:
+if ((ret != 0 or out != self._refout) and not self._skipped
+and not self._debug):
 with open(self.errpath, 'wb') as f:
 for line in out:
 f.write(line)
@@ -978,8 +978,8 @@
 # files are deleted
 shutil.rmtree(self._chgsockdir, True)
 
-if (self._ret != 0 or self._out != self._refout) and not self._skipped 
\
-and not self._debug and self._out:
+if ((self._ret != 0 or self._out != self._refout) and not self._skipped
+and not self._debug and self._out):
 with open(self.errpath, 'wb') as f:
 for line in self._out:
 f.write(line)
@@ -1105,8 +1105,8 @@
 if 'HGTESTCATAPULTSERVERPIPE' not in env:
 # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull 
the
 # non-test one in as a default, otherwise set to devnull
-env['HGTESTCATAPULTSERVERPIPE'] = \
-env.get('HGCATAPULTSERVERPIPE', os.devnull)
+env['HGTESTCATAPULTSERVERPIPE'] = env.get(
+'HGCATAPULTSERVERPIPE', os.devnull)
 
 extraextensions = []
 for opt in self._extraconfigopts:
diff --git 

D5994: cleanup: prefer nested context managers to \-continuations

2019-02-20 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'd prefer Python accept a tuple of context managers, but alas it
  isn't meant to be. This will have to suffice.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/largefiles/overrides.py
  hgext/narrow/narrowcommands.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -556,18 +556,18 @@
% stringutil.forcebytestr(err))
 pushop.ui.debug(msg)
 
-with wlock or util.nullcontextmanager(), \
-lock or util.nullcontextmanager(), \
-pushop.trmanager or util.nullcontextmanager():
-pushop.repo.checkpush(pushop)
-_checkpublish(pushop)
-_pushdiscovery(pushop)
-if not _forcebundle1(pushop):
-_pushbundle2(pushop)
-_pushchangeset(pushop)
-_pushsyncphase(pushop)
-_pushobsolete(pushop)
-_pushbookmark(pushop)
+with wlock or util.nullcontextmanager():
+with lock or util.nullcontextmanager():
+with pushop.trmanager or util.nullcontextmanager():
+pushop.repo.checkpush(pushop)
+_checkpublish(pushop)
+_pushdiscovery(pushop)
+if not _forcebundle1(pushop):
+_pushbundle2(pushop)
+_pushchangeset(pushop)
+_pushsyncphase(pushop)
+_pushobsolete(pushop)
+_pushbookmark(pushop)
 
 if repo.ui.configbool('experimental', 'remotenames'):
 logexchange.pullremotenames(repo, remote)
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -278,9 +278,9 @@
 p1, p2 = ds.p1(), ds.p2()
 with ds.parentchange():
 ds.setparents(node.nullid, node.nullid)
-with wrappedextraprepare,\
- repo.ui.configoverride(overrides, 'widen'):
-exchange.pull(repo, remote, heads=common)
+with wrappedextraprepare:
+with repo.ui.configoverride(overrides, 'widen'):
+exchange.pull(repo, remote, heads=common)
 with ds.parentchange():
 ds.setparents(p1, p2)
 else:
@@ -296,11 +296,11 @@
 'ellipses': False,
 }).result()
 
-with repo.transaction('widening') as tr,\
- repo.ui.configoverride(overrides, 'widen'):
-tgetter = lambda: tr
-bundle2.processbundle(repo, bundle,
-transactiongetter=tgetter)
+with repo.transaction('widening') as tr:
+with repo.ui.configoverride(overrides, 'widen'):
+tgetter = lambda: tr
+bundle2.processbundle(repo, bundle,
+transactiongetter=tgetter)
 
 with repo.transaction('widening'):
 repo.setnewnarrowpats()
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -664,9 +664,9 @@
   _('destination largefile already exists'))
 copiedfiles.append((src, dest))
 orig(src, dest, *args, **kwargs)
-with extensions.wrappedfunction(util, 'copyfile', overridecopyfile), \
- extensions.wrappedfunction(scmutil, 'match', overridematch):
-result += orig(ui, repo, listpats, opts, rename)
+with extensions.wrappedfunction(util, 'copyfile', overridecopyfile):
+with extensions.wrappedfunction(scmutil, 'match', overridematch):
+result += orig(ui, repo, listpats, opts, rename)
 
 lfdirstate = lfutil.openlfdirstate(ui, repo)
 for (src, dest) in copiedfiles:



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


D5995: contrib: enforce wrapping too-long lines with () instead of \

2019-02-20 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is the style I prefer, and an anecdotal exploration of styles
  recommended in style guides etc. Further, to quote pep8:
  
  > The preferred way of wrapping long lines is by using Python's implied
  >  line continuation inside parentheses, brackets and braces. Long lines
  >  can be broken over multiple lines by wrapping expressions in
  >  parentheses. These should be used in preference to using a backslash
  >  for line continuation.
  
  So I think this is a virtuous change.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/check-code.py
  tests/test-contrib-check-code.t

CHANGE DETAILS

diff --git a/tests/test-contrib-check-code.t b/tests/test-contrib-check-code.t
--- a/tests/test-contrib-check-code.t
+++ b/tests/test-contrib-check-code.t
@@ -7,6 +7,9 @@
   > def toto( arg1, arg2):
   > del(arg2)
   > return ( 5+6, 9)
+  > def badwrap():
+  > return 1 + \\
+  >2
   > NO_CHECK_EOF
   $ cat > quote.py < # let's use quote in comments
@@ -42,6 +45,9 @@
> return ( 5+6, 9)
gratuitous whitespace in () or []
missing whitespace in expression
+  ./wrong.py:5:
+   > return 1 + \
+   Use () to wrap long lines in Python, not \
   ./quote.py:5:
> '"""', 42+1, """and
missing whitespace in expression
diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -233,6 +233,7 @@
 
 pypats = [
   [
+(r'\\$', 'Use () to wrap long lines in Python, not \\'),
 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
  "tuple parameter unpacking not available in Python 3+"),
 (r'lambda\s*\(.*,.*\)',



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


D5992: tests: use () instead of \ to wrap lines

2019-02-20 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This should auto-format more consistently, and is slightly more
  typical Python.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1408,8 +1408,8 @@
 session = str(uuid.uuid4())
 if PYTHON3:
 session = session.encode('ascii')
-hgcatapult = os.getenv('HGTESTCATAPULTSERVERPIPE') or \
-os.getenv('HGCATAPULTSERVERPIPE')
+hgcatapult = (os.getenv('HGTESTCATAPULTSERVERPIPE') or
+  os.getenv('HGCATAPULTSERVERPIPE'))
 def toggletrace(cmd=None):
 if not hgcatapult or hgcatapult == os.devnull:
 return



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


D5990: context: introduce p[12]copies() methods and debugp[12]copies commands

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

REVISION SUMMARY
  As mentioned earlier, I'm working on support for storing copy metadata
  in the changeset instead of in the filelog.
  
  In order to transition a repo from storing metadata in filelogs to
  storing it in the changeset, I'm going to provide a config option for
  reading the metadata from the changeset, but falling back to getting
  it from the filelog if it's not in the changeset. In this compatiblity
  mode, the changeset-optmized algorithms will be used. We will then
  need to convert the filelog copy metadata to look like that provided
  by changeset copy metadata. This patch introduces methods that do just
  that.
  
  By having these methods here, we can start writing changeset-optimized
  algorithms that should work already before we add any support for
  storing the metadata in the changesets.
  
  This commit also includes new debugp[12]copies commands and exercises
  them in test-copies.t.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-copies.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1011,6 +1011,10 @@
debugoptADV   (no help text available)
debugoptDEP   (no help text available)
debugoptEXP   (no help text available)
+   debugp1copies
+ dump copy information compared to p1
+   debugp2copies
+ dump copy information compared to p2
debugpathcomplete
  complete part or all of a tracked path
debugpathcopies
diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -17,12 +17,17 @@
   $ echo x > x
   $ hg ci -Aqm 'add x'
   $ hg mv x y
+  $ hg debugp1copies
+  x -> y
+  $ hg debugp2copies
   $ hg ci -m 'rename x to y'
   $ hg l
   @  1 rename x to y
   |  x y
   o  0 add x
  x
+  $ hg debugp1copies -r 1
+  x -> y
   $ hg debugpathcopies 0 1
   x -> y
   $ hg debugpathcopies 1 0
@@ -41,12 +46,17 @@
   $ echo y > y
   $ hg ci -Aqm 'add x and y'
   $ hg cp -f x y
+  $ hg debugp1copies
+  x -> y
+  $ hg debugp2copies
   $ hg ci -m 'copy x onto y'
   $ hg l
   @  1 copy x onto y
   |  y
   o  0 add x and y
  x y
+  $ hg debugp1copies -r 1
+  x -> y
 Incorrectly doesn't show the rename
   $ hg debugpathcopies 0 1
 
@@ -63,6 +73,8 @@
   |  x2
   o  0 add x and x2 with same content
  x x2
+  $ hg debugp1copies -r 1
+  x -> x2
 Incorrectly doesn't show the rename
   $ hg debugpathcopies 0 1
 
@@ -85,14 +97,19 @@
   |  y
   o  0 add x
  x
+  $ hg debugp1copies -r 3
+  x -> y
   $ hg debugpathcopies 0 3
   x -> y
 
 Rename file in a loop: x->y->z->x
   $ newrepo
   $ echo x > x
   $ hg ci -Aqm 'add x'
   $ hg mv x y
+  $ hg debugp1copies
+  x -> y
+  $ hg debugp2copies
   $ hg ci -m 'rename x to y'
   $ hg mv y z
   $ hg ci -m 'rename y to z'
@@ -129,6 +146,7 @@
   |  x y
   o  0 add x
  x
+  $ hg debugp1copies -r 3
   $ hg debugpathcopies 0 3
 
 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy 
metadata in the
@@ -153,6 +171,8 @@
   |  z
   o  0 add x and x2 with same content
  x x2
+  $ hg debugp1copies -r 3
+  x2 -> z
   $ hg debugpathcopies 0 3
   x2 -> z
 
@@ -225,6 +245,8 @@
   $ echo z > z
   $ hg ci -Aqm 'add z'
   $ hg merge -q 1
+  $ hg debugp1copies
+  $ hg debugp2copies
   $ hg ci -m 'merge rename from p2'
   $ hg l
   @3 merge rename from p2
@@ -237,6 +259,8 @@
  x
 Perhaps we should indicate the rename here, but `hg status` is documented to 
be weird during
 merges, so...
+  $ hg debugp1copies -r 3
+  $ hg debugp2copies -r 3
   $ hg debugpathcopies 0 3
   x -> y
   $ hg debugpathcopies 1 2
@@ -254,10 +278,16 @@
   $ hg ci -Aqm 'add y'
   $ hg merge -q 0
   $ hg cp y z
+  $ hg debugp1copies
+  y -> z
+  $ hg debugp2copies
   $ hg ci -m 'copy file from p1 in merge'
   $ hg co -q 1
   $ hg merge -q 0
   $ hg cp x z
+  $ hg debugp1copies
+  $ hg debugp2copies
+  x -> z
   $ hg ci -qm 'copy file from p2 in merge'
   $ hg l
   @3 copy file from p2 in merge
@@ -268,9 +298,15 @@
   |y
   o  0 add x
  x
+  $ hg debugp1copies -r 2
+  y -> z
+  $ hg debugp2copies -r 2
   $ hg debugpathcopies 1 2
   y -> z
   $ hg debugpathcopies 0 2
+  $ hg debugp1copies -r 3
+  $ hg debugp2copies -r 3
+  x -> z
   $ hg debugpathcopies 1 3
   $ hg debugpathcopies 0 3
   x -> z
@@ -284,14 +320,20 @@
   $ hg ci -Aqm 'add x on branch 2'
   $ hg merge -q 0
   $ hg cp x z
+  $ hg debugp1copies
+  x -> z
+  $ hg debugp2copies
   $ hg ci -qm 'merge'
   $ hg l
   @2 merge
   |\   z
   | o  1 add x on branch 2
   |x
   o  0 add x on branch 1
  x
+  $ hg debugp1copies -r 2
+  x -> z
+  $ hg debugp2copies -r 2
 It's a little weird that it shows up on both sides
   

D5991: copies: do copy tracing based on ctx.p[12]copies() if configured

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

REVISION SUMMARY
  This adds an option to do copy tracing in a changeset-optimized
  way. If the metadata is stored in filelogs, this is obviously going to
  be suboptimal. The point is that it provides a way of transitioning to
  changeset-stored metadata.
  
  Some of the tests behave a little differently, but they all seem
  resonable to me.
  
  The config option may very well be renamed later when it's clearer
  what options we want and how they will behave.
  
  When the test suite is run with --extra-config-opt to use the new copy
  tracing, all tests pass, besides test-copies.t (which fails in the
  same way as you can see in this patch).
  
  `hg debugpathcopies 4.0 4.8` reports 82 copies. With this option
  enabled, the only difference is this:
  
-mercurial/pure/bdiff.py -> mercurial/cffi/bdiff.py
+setup_bdiff_cffi.py -> mercurial/cffi/bdiff.py
  
  I believe that happened because it was renamed in different ways on
  different sides of a merge and the new algorithm arbitrarily prefers
  copies that happened on p1. The runtime is about 0.85 seconds with the
  old copy tracing and 5.7 seconds with the new copy tracing. That's
  kind of slow, but actually better than I had expected.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -1,9 +1,17 @@
+#testcases filelog compatibility
 
   $ cat >> $HGRCPATH << EOF
   > [alias]
   > l = log -G -T '{rev} {desc}\n{files}\n'
   > EOF
 
+#if compatibility
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > copies.read-from = compatibility
+  > EOF
+#endif
+
   $ REPONUM=0
   $ newrepo() {
   > cd $TESTTMP
@@ -338,7 +346,7 @@
   $ hg debugpathcopies 1 2
   x -> z
   $ hg debugpathcopies 0 2
-  x -> z
+  x -> z (filelog !)
 
 Copy file that exists on both sides of the merge, different content
   $ newrepo
@@ -476,7 +484,8 @@
   $ hg debugpathcopies 1 4
   $ hg debugpathcopies 2 4
   $ hg debugpathcopies 0 4
-  x -> z
+  x -> z (filelog !)
+  y -> z (compatibility !)
   $ hg debugpathcopies 1 5
   $ hg debugpathcopies 2 5
   $ hg debugpathcopies 0 5
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -166,6 +166,10 @@
 # files might have to be traced back to the fctx parent of the last
 # one-side-only changeset, but not further back than that
 repo = a._repo
+
+if repo.ui.config('experimental', 'copies.read-from') == 'compatibility':
+return _changesetforwardcopies(a, b, match)
+
 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
 dbg = repo.ui.debug
 if debug:
@@ -216,6 +220,76 @@
 % (util.timer() - start))
 return cm
 
+def _changesetforwardcopies(a, b, match):
+if a.rev() == node.nullrev:
+return {}
+
+repo = a.repo()
+children = {}
+cl = repo.changelog
+missingrevs = cl.findmissingrevs(common=[a.rev()], heads=[b.rev()])
+for r in missingrevs:
+for p in cl.parentrevs(r):
+if p == node.nullrev:
+continue
+if p not in children:
+children[p] = [r]
+else:
+children[p].append(r)
+
+roots = set(children) - set(missingrevs)
+# 'work' contains 3-tuples of a (revision number, parent number, copies).
+# The parent number is only used for knowing which parent the copies dict
+# came from.
+work = [(r, 1, {}) for r in roots]
+heapq.heapify(work)
+while work:
+r, i1, copies1 = heapq.heappop(work)
+if work and work[0][0] == r:
+# We are tracing copies from both parents
+r, i2, copies2 = heapq.heappop(work)
+copies = {}
+ctx = repo[r]
+p1man, p2man = ctx.p1().manifest(), ctx.p2().manifest()
+allcopies = set(copies1) | set(copies2)
+# TODO: perhaps this filtering should be done as long as ctx
+# is merge, whether or not we're tracing from both parent.
+for dst in allcopies:
+if not match(dst):
+continue
+if dst not in copies2:
+# Copied on p1 side: mark as copy from p1 side if it didn't
+# already exist on p2 side
+if dst not in p2man:
+copies[dst] = copies1[dst]
+elif dst not in copies1:
+# Copied on p2 side: mark as copy from p2 side if it didn't
+# already exist on p1 side
+if dst not in p1man:
+copies[dst] = copies2[dst]
+else:
+ 

D5989: copies: filter out copies when target is not in destination manifest

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

REVISION SUMMARY
  When chaining a series of commits that copied a file with a series
  that removed the destination file, we would still include the copy in
  the result. Similar to the previous patch, I have checked that `hg
  status --copies` is not affected by this bug, but I wouldn't be
  surprised if some commands are.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -194,9 +194,7 @@
   |/   x y
   o  0 add x
  x
-BROKEN: x doesn't exist here
   $ hg debugpathcopies 1 2
-  y -> x
 
 Copies via null revision (there shouldn't be any)
   $ newrepo
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -124,10 +124,13 @@
 # file is a copy of an existing file
 t[k] = v
 
-# remove criss-crossed copies
 for k, v in list(t.items()):
+# remove criss-crossed copies
 if k in src and v in dst:
 del t[k]
+# remove copies to files that were then removed
+elif k not in dst:
+del t[k]
 
 return t
 



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


D5988: copies: make _backwardrenames() filter out copies by destination

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

REVISION SUMMARY
  As shown by the test case, _backwardrenames() doesn't filter by the
  matcher. It doesn't show up in `hg status --copies` because that only
  prints files changed between the two commits. I wouldn't be surprised
  if some other command that replies on pathcopies() was broken before
  this patch, but I haven't bothered to check other commands.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -33,9 +33,7 @@
   y -> x
   $ hg debugpathcopies 0 1 y
   x -> y
-BROKEN: the following command should not include the copy
   $ hg debugpathcopies 1 0 y
-  y -> x
 
 Copy a file onto another file
   $ newrepo
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -228,16 +228,21 @@
 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
 return _committedforwardcopies(a, b, match)
 
-def _backwardrenames(a, b):
+def _backwardrenames(a, b, match):
 if a._repo.ui.config('experimental', 'copytrace') == 'off':
 return {}
 
 # Even though we're not taking copies into account, 1:n rename situations
 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
 # arbitrarily pick one of the renames.
+# We don't want to pass in "match" here, since that would filter
+# the destination by it. Since we're reversing the copies, we want
+# to filter the source instead.
 f = _forwardcopies(b, a)
 r = {}
 for k, v in sorted(f.iteritems()):
+if match and not match(v):
+continue
 # remove copies
 if v in a:
 continue
@@ -261,10 +266,10 @@
 if a == y:
 if debug:
 repo.ui.debug('debug.copies: search mode: backward\n')
-return _backwardrenames(x, y)
+return _backwardrenames(x, y, match=match)
 if debug:
 repo.ui.debug('debug.copies: search mode: combined\n')
-return _chain(x, y, _backwardrenames(x, a),
+return _chain(x, y, _backwardrenames(x, a, match=match),
   _forwardcopies(a, y, match=match))
 
 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, baselabel=''):



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


D5987: copies: respect narrowmatcher in "parent -> working dir" case

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

REVISION SUMMARY
  I don't know when this case happens and we don't seem to have tests
  for it, but let's fix it anyway since I happened to notice it.

REPOSITORY
  rHG Mercurial

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

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
@@ -141,8 +141,8 @@
 if limit >= 0 and not f.isintroducedafter(limit):
 return None
 
-def _dirstatecopies(d, match=None):
-ds = d._repo.dirstate
+def _dirstatecopies(repo, match=None):
+ds = repo.dirstate
 c = ds.copies().copy()
 for k in list(c):
 if ds[k] not in 'anm' or (match and not match(k)):
@@ -221,11 +221,11 @@
 if b.rev() is None:
 if a == b.p1():
 # short-circuit to avoid issues with merge states
-return _dirstatecopies(b, match)
+return _dirstatecopies(b._repo, match)
 
 cm = _committedforwardcopies(a, b.p1(), match)
 # combine copies from dirstate if necessary
-return _chain(a, b, cm, _dirstatecopies(b, match))
+return _chain(a, b, cm, _dirstatecopies(b._repo, match))
 return _committedforwardcopies(a, b, match)
 
 def _backwardrenames(a, b):
@@ -391,9 +391,11 @@
 if not c1 or not c2 or c1 == c2:
 return {}, {}, {}, {}, {}
 
+narrowmatch = c1.repo().narrowmatch()
+
 # avoid silly behavior for parent -> working dir
 if c2.node() is None and c1.node() == repo.dirstate.p1():
-return repo.dirstate.copies(), {}, {}, {}, {}
+return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {}
 
 copytracing = repo.ui.config('experimental', 'copytrace')
 boolctrace = stringutil.parsebool(copytracing)



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


D5986: tests: add tests of pathcopies()

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

REVISION SUMMARY
  I'm working on support for storing copy metadata in the changeset
  instead of in the filelog. When storing it in the changeset, it will
  obviously be efficient to get the copy metadata for all files in a
  single changeset, but it will be more expensive to get the copy
  metadata all revisions of a single file. Some algorithms will then
  need to be optimized differently. The first method I'm going to
  rewrite is pathcopies().
  
  This commit adds many tests for pathcopies(), so we can run the tests
  with both old and new versions of the code, as well as with metadata
  stored in filelog or in changeset (later). They use the
  debugpathcopies command I recently added (with no tests when it was
  added). They show a few bugs and few cases of slightly weird
  behavior. I'll fix the bugs in the next few commits.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
new file mode 100644
--- /dev/null
+++ b/tests/test-copies.t
@@ -0,0 +1,435 @@
+
+  $ cat >> $HGRCPATH << EOF
+  > [alias]
+  > l = log -G -T '{rev} {desc}\n{files}\n'
+  > EOF
+
+  $ REPONUM=0
+  $ newrepo() {
+  > cd $TESTTMP
+  > REPONUM=`expr $REPONUM + 1`
+  > hg init repo-$REPONUM
+  > cd repo-$REPONUM
+  > }
+
+Simple rename case
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg l
+  @  1 rename x to y
+  |  x y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 1
+  x -> y
+  $ hg debugpathcopies 1 0
+  y -> x
+Test filtering copies by path. We do filtering by destination.
+  $ hg debugpathcopies 0 1 x
+  $ hg debugpathcopies 1 0 x
+  y -> x
+  $ hg debugpathcopies 0 1 y
+  x -> y
+BROKEN: the following command should not include the copy
+  $ hg debugpathcopies 1 0 y
+  y -> x
+
+Copy a file onto another file
+  $ newrepo
+  $ echo x > x
+  $ echo y > y
+  $ hg ci -Aqm 'add x and y'
+  $ hg cp -f x y
+  $ hg ci -m 'copy x onto y'
+  $ hg l
+  @  1 copy x onto y
+  |  y
+  o  0 add x and y
+ x y
+Incorrectly doesn't show the rename
+  $ hg debugpathcopies 0 1
+
+Copy a file onto another file with same content. If metadata is stored in 
changeset, this does not
+produce a new filelog entry. The changeset's "files" entry should still list 
the file.
+  $ newrepo
+  $ echo x > x
+  $ echo x > x2
+  $ hg ci -Aqm 'add x and x2 with same content'
+  $ hg cp -f x x2
+  $ hg ci -m 'copy x onto x2'
+  $ hg l
+  @  1 copy x onto x2
+  |  x2
+  o  0 add x and x2 with same content
+ x x2
+Incorrectly doesn't show the rename
+  $ hg debugpathcopies 0 1
+
+Copy a file, then delete destination, then copy again. This does not create a 
new filelog entry.
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg cp x y
+  $ hg ci -m 'copy x to y'
+  $ hg rm y
+  $ hg ci -m 'remove y'
+  $ hg cp -f x y
+  $ hg ci -m 'copy x onto y (again)'
+  $ hg l
+  @  3 copy x onto y (again)
+  |  y
+  o  2 remove y
+  |  y
+  o  1 copy x to y
+  |  y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 3
+  x -> y
+
+Rename file in a loop: x->y->z->x
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg mv y z
+  $ hg ci -m 'rename y to z'
+  $ hg mv z x
+  $ hg ci -m 'rename z to x'
+  $ hg l
+  @  3 rename z to x
+  |  x z
+  o  2 rename y to z
+  |  y z
+  o  1 rename x to y
+  |  x y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 3
+
+Copy x to y, then remove y, then add back y. With copy metadata in the 
changeset, this could easily
+end up reporting y as copied from x (if we don't unmark it as a copy when it's 
removed).
+  $ newrepo
+  $ echo x > x
+  $ hg ci -Aqm 'add x'
+  $ hg mv x y
+  $ hg ci -m 'rename x to y'
+  $ hg rm y
+  $ hg ci -qm 'remove y'
+  $ echo x > y
+  $ hg ci -Aqm 'add back y'
+  $ hg l
+  @  3 add back y
+  |  y
+  o  2 remove y
+  |  y
+  o  1 rename x to y
+  |  x y
+  o  0 add x
+ x
+  $ hg debugpathcopies 0 3
+
+Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy 
metadata in the
+changeset, the two copies here will have the same filelog entry, so 
ctx['z'].introrev() might point
+to the first commit that added the file. We should still report the copy as 
being from x2.
+  $ newrepo
+  $ echo x > x
+  $ echo x > x2
+  $ hg ci -Aqm 'add x and x2 with same content'
+  $ hg cp x z
+  $ hg ci -qm 'copy x to z'
+  $ hg rm z
+  $ hg ci -m 'remove z'
+  $ hg cp x2 z
+  $ hg ci -m 'copy x2 to z'
+  $ hg l
+  @  3 copy x2 to z
+  |  z
+  o  2 remove z
+  |  z
+  o  1 copy x to z
+  |  z
+  o  0 add x and x2 with same content
+ x x2
+  $ hg debugpathcopies 0 3
+  x2 -> z
+
+Create x and y, then rename them both to the same name, but on different sides 
of a fork
+  $ newrepo
+  $ echo x > x
+  $ echo y > y
+  

D5985: bundle2: don't send "shared" requirement when cloning from a share

2019-02-20 Thread mplamann (Mitchell Plamann)
mplamann 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/D5985

AFFECTED FILES
  mercurial/bundle2.py
  tests/test-share.t

CHANGE DETAILS

diff --git a/tests/test-share.t b/tests/test-share.t
--- a/tests/test-share.t
+++ b/tests/test-share.t
@@ -124,15 +124,14 @@
   -rw-r--r-- 2 b
   
   
-Cloning a shared repo via bundle2 wrongly adds "shared" to the clone's 
requirements
+Cloning a shared repo via bundle2 results in a non-shared clone
 
   $ cd ..
   $ hg clone -q --stream --config ui.ssh="$PYTHON \"$TESTDIR/dummyssh\"" 
ssh://user@dummy/`pwd`/repo2 cloned-via-bundle2
   $ cat ./cloned-via-bundle2/.hg/requires | grep "shared"
-  shared
+  [1]
   $ hg id --cwd cloned-via-bundle2 -r tip
-  abort: $ENOENT$: '$TESTTMP/cloned-via-bundle2/.hg/sharedpath'
-  [255]
+  c2e0ac586386 tip
   $ cd repo2
 
 test unshare command
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1664,6 +1664,7 @@
 mandatory=False)
 
 def _formatrequirementsspec(requirements):
+requirements = [req for req in requirements if req != "shared"]
 return urlreq.quote(','.join(sorted(requirements)))
 
 def _formatrequirementsparams(requirements):



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


D5984: tests: demonstrate failure when cloning from a share via bundle2

2019-02-20 Thread mplamann (Mitchell Plamann)
mplamann 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/D5984

AFFECTED FILES
  tests/test-share.t

CHANGE DETAILS

diff --git a/tests/test-share.t b/tests/test-share.t
--- a/tests/test-share.t
+++ b/tests/test-share.t
@@ -124,6 +124,16 @@
   -rw-r--r-- 2 b
   
   
+Cloning a shared repo via bundle2 wrongly adds "shared" to the clone's 
requirements
+
+  $ cd ..
+  $ hg clone -q --stream --config ui.ssh="$PYTHON \"$TESTDIR/dummyssh\"" 
ssh://user@dummy/`pwd`/repo2 cloned-via-bundle2
+  $ cat ./cloned-via-bundle2/.hg/requires | grep "shared"
+  shared
+  $ hg id --cwd cloned-via-bundle2 -r tip
+  abort: $ENOENT$: '$TESTTMP/cloned-via-bundle2/.hg/sharedpath'
+  [255]
+  $ cd repo2
 
 test unshare command
 



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


D5978: subrepo: use root-repo-relative path from `hg files` with ui.relative-paths=no

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4fecf4f6524f: subrepo: use root-repo-relative path from `hg 
files` with ui.relative-paths=no (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5978?vs=14135=14151

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/subrepo.py
  tests/test-subrepo.t

CHANGE DETAILS

diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -36,7 +36,7 @@
   $ hg files -S --config ui.relative-paths=no
   .hgsub
   a
-  a
+  s/a
 
   $ hg -R s ci -Ams0
   $ hg sum
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -325,7 +325,7 @@
 """Resolve the fileset expression for this repo"""
 return matchmod.never(badfn=badfn)
 
-def printfiles(self, ui, m, fm, fmt, subrepos):
+def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos):
 """handle the files command for this subrepo"""
 return 1
 
@@ -795,15 +795,15 @@
 return ctx.flags(name)
 
 @annotatesubrepoerror
-def printfiles(self, ui, m, fm, fmt, subrepos):
+def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos):
 # If the parent context is a workingctx, use the workingctx here for
 # consistency.
 if self._ctx.rev() is None:
 ctx = self._repo[None]
 else:
 rev = self._state[1]
 ctx = self._repo[rev]
-return cmdutil.files(ui, ctx, m, fm, fmt, subrepos)
+return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt, subrepos)
 
 @annotatesubrepoerror
 def matchfileset(self, expr, badfn=None):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2213,8 +2213,10 @@
 
 m = scmutil.match(ctx, pats, opts)
 ui.pager('files')
+uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True)
 with ui.formatter('files', opts) as fm:
-return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos'))
+return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt,
+ opts.get('subrepos'))
 
 @command(
 'forget',
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2171,11 +2171,10 @@
 forgot.extend(f for f in forget if f not in rejected)
 return bad, forgot
 
-def files(ui, ctx, m, fm, fmt, subrepos):
+def files(ui, ctx, m, uipathfn, fm, fmt, subrepos):
 ret = 1
 
 needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint()
-uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True)
 for f in ctx.matches(m):
 fm.startitem()
 fm.context(ctx=ctx)
@@ -2188,11 +2187,13 @@
 
 for subpath in sorted(ctx.substate):
 submatch = matchmod.subdirmatcher(subpath, m)
+subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn)
 if (subrepos or m.exact(subpath) or any(submatch.files())):
 sub = ctx.sub(subpath)
 try:
 recurse = m.exact(subpath) or subrepos
-if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0:
+if sub.printfiles(ui, submatch, subuipathfn, fm, fmt,
+  recurse) == 0:
 ret = 0
 except error.LookupError:
 ui.status(_("skipping missing subrepository: %s\n")



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


D5983: debugpathcopies: sort output so it's deterministic

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf044d7832e10: debugpathcopies: sort output so its 
deterministic (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5983?vs=14143=14152

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1815,7 +1815,7 @@
 ctx1 = scmutil.revsingle(repo, rev1)
 ctx2 = scmutil.revsingle(repo, rev2)
 m = scmutil.match(ctx1, pats, opts)
-for dst, src in copies.pathcopies(ctx1, ctx2, m).items():
+for dst, src in sorted(copies.pathcopies(ctx1, ctx2, m).items()):
 ui.write('%s -> %s\n' % (src, dst))
 
 @command('debugpeer', [], _('PATH'), norepo=True)



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


D5970: uncommit: add config option to keep commit by default

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8980b5d6d9d9: uncommit: add config option to keep commit by 
default (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5970?vs=14148=14153

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

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

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -308,7 +308,7 @@
   $ hg phase -r ".^"
   12: public
 
-Uncommit leaving an empty changeset
+Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset
 
   $ cd $TESTTMP
   $ hg init repo1
@@ -328,9 +328,31 @@
   |/
   o  P FILES: P
   
+  $ cat >> .hg/hgrc < [experimental]
+  > uncommit.keep=True
+  > EOF
+  $ hg ci --amend
+  $ hg uncommit
+  note: keeping empty commit
+  $ hg log -G -T '{desc} FILES: {files}'
+  @  Q FILES:
+  |
+  | x  Q FILES: Q
+  |/
+  o  P FILES: P
+  
   $ hg status
   A Q
-
+  $ hg ci --amend
+  $ hg uncommit --no-keep
+  $ hg log -G -T '{desc} FILES: {files}'
+  x  Q FILES: Q
+  |
+  @  P FILES: P
+  
+  $ hg status
+  A Q
   $ cd ..
   $ rm -rf repo1
 
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -47,6 +47,9 @@
 configitem('experimental', 'uncommitondirtywdir',
 default=False,
 )
+configitem('experimental', 'uncommit.keep',
+default=False,
+)
 
 stringio = util.stringio
 
@@ -240,7 +243,7 @@
 
 @command('uncommit',
 [('i', 'interactive', False, _('interactive mode to uncommit')),
-('', 'keep', False, _('allow an empty commit after uncommiting')),
+('', 'keep', None, _('allow an empty commit after uncommiting')),
 ] + commands.walkopts,
 _('[OPTION]... [FILE]...'),
 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -270,7 +273,12 @@
 
 with repo.transaction('uncommit'):
 match = scmutil.match(old, pats, opts)
-keepcommit = opts.get('keep') or pats
+keepcommit = pats
+if not keepcommit:
+if opts.get('keep') is not None:
+keepcommit = opts.get('keep')
+else:
+keepcommit = ui.configbool('experimental', 'uncommit.keep')
 newid = _commitfiltered(repo, old, match, keepcommit)
 if interactive:
 match = scmutil.match(old, pats, opts)



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


D5977: subrepo: demonstrate broken `hg files` with ui.relative-paths=no

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG61cb59d0ddc8: subrepo: demonstrate broken `hg files` with 
ui.relative-paths=no (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5977?vs=14134=14150

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

AFFECTED FILES
  tests/test-subrepo.t

CHANGE DETAILS

diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -31,6 +31,13 @@
   a
   s/a
 
+`hg files` respects ui.relative-paths
+BROKEN: shows subrepo paths relative to the subrepo
+  $ hg files -S --config ui.relative-paths=no
+  .hgsub
+  a
+  a
+
   $ hg -R s ci -Ams0
   $ hg sum
   parent: 0:f7b1eb17ad24 tip



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


D5979: py3: whitelist 5 new passing tests caught by buildbot

2019-02-20 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5f522c8daf8d: py3: whitelist 5 new passing tests caught by 
buildbot (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5979?vs=14136=14149

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -310,6 +310,7 @@
 test-http-clone-r.t
 test-http-permissions.t
 test-http-protocol.t
+test-http-proxy.t
 test-http.t
 test-https.t
 test-hybridencode.py
@@ -366,6 +367,7 @@
 test-lfs-bundle.t
 test-lfs-largefiles.t
 test-lfs-pointer.py
+test-lfs-serve.t
 test-lfs-test-server.t
 test-lfs.t
 test-linelog.py
@@ -607,13 +609,15 @@
 test-remotefilelog-histpack.py
 test-remotefilelog-http.t
 test-remotefilelog-keepset.t
+test-remotefilelog-linknodes.t
 test-remotefilelog-local.t
 test-remotefilelog-log.t
 test-remotefilelog-partial-shallow.t
 test-remotefilelog-permissions.t
 test-remotefilelog-permisssions.t
 test-remotefilelog-prefetch.t
 test-remotefilelog-pull-noshallow.t
+test-remotefilelog-push-pull.t
 test-remotefilelog-repack-fast.t
 test-remotefilelog-repack.t
 test-remotefilelog-share.t
@@ -646,6 +650,7 @@
 test-revset-dirstate-parents.t
 test-revset-legacy-lookup.t
 test-revset-outgoing.t
+test-revset.t
 test-revset2.t
 test-rollback.t
 test-run-tests.py



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


D5970: uncommit: add config option to keep commit by default

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 14148.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5970?vs=14109=14148

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

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

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -308,7 +308,7 @@
   $ hg phase -r ".^"
   12: public
 
-Uncommit leaving an empty changeset
+Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset
 
   $ cd $TESTTMP
   $ hg init repo1
@@ -328,9 +328,31 @@
   |/
   o  P FILES: P
   
+  $ cat >> .hg/hgrc < [experimental]
+  > uncommit.keep=True
+  > EOF
+  $ hg ci --amend
+  $ hg uncommit
+  note: keeping empty commit
+  $ hg log -G -T '{desc} FILES: {files}'
+  @  Q FILES:
+  |
+  | x  Q FILES: Q
+  |/
+  o  P FILES: P
+  
   $ hg status
   A Q
-
+  $ hg ci --amend
+  $ hg uncommit --no-keep
+  $ hg log -G -T '{desc} FILES: {files}'
+  x  Q FILES: Q
+  |
+  @  P FILES: P
+  
+  $ hg status
+  A Q
   $ cd ..
   $ rm -rf repo1
 
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -47,6 +47,9 @@
 configitem('experimental', 'uncommitondirtywdir',
 default=False,
 )
+configitem('experimental', 'uncommit.keep',
+default=False,
+)
 
 stringio = util.stringio
 
@@ -240,7 +243,7 @@
 
 @command('uncommit',
 [('i', 'interactive', False, _('interactive mode to uncommit')),
-('', 'keep', False, _('allow an empty commit after uncommiting')),
+('', 'keep', None, _('allow an empty commit after uncommiting')),
 ] + commands.walkopts,
 _('[OPTION]... [FILE]...'),
 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -270,7 +273,12 @@
 
 with repo.transaction('uncommit'):
 match = scmutil.match(old, pats, opts)
-keepcommit = opts.get('keep') or pats
+keepcommit = pats
+if not keepcommit:
+if opts.get('keep') is not None:
+keepcommit = opts.get('keep')
+else:
+keepcommit = ui.configbool('experimental', 'uncommit.keep')
 newid = _commitfiltered(repo, old, match, keepcommit)
 if interactive:
 match = scmutil.match(old, pats, opts)



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


D5514: test: change test's diff generation to use mdiff for nicer output

2019-02-20 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  (moving this off the dashboard until it gets updated)

REPOSITORY
  rHG Mercurial

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

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


D5792: uncommit: added interactive mode(issue6062)

2019-02-20 Thread taapas1128 (Taapas Agrawal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGedd5c8dc812e: uncommit: added interactive mode(issue6062) 
(authored by taapas1128, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5792?vs=14139=14144

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

AFFECTED FILES
  hgext/uncommit.py
  tests/test-uncommit-interactive.t
  tests/test-uncommit.t

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -34,6 +34,7 @@
   
   options ([+] can be repeated):
   
+   -i --interactive interactive mode to uncommit
   --keepallow an empty commit after uncommiting
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
diff --git a/tests/test-uncommit-interactive.t 
b/tests/test-uncommit-interactive.t
new file mode 100644
--- /dev/null
+++ b/tests/test-uncommit-interactive.t
@@ -0,0 +1,969 @@
+
+||  The test for `hg uncommit --interactive`  ||
+
+
+Repo Setup
+
+
+  $ cat >> $HGRCPATH < [ui]
+  > interactive = true
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > uncommitondirtywdir = true
+  > [extensions]
+  > uncommit =
+  > amend =
+  > drawdag=$TESTDIR/drawdag.py
+  > EOF
+  $ glog() {
+  >   hg log -G --template '{rev}:{node|short}@{branch}({separate("/", 
obsolete, phase)}) {desc|firstline}\n' "$@"
+  > }
+
+  $ hg init repo
+  $ cd repo
+
+  $ touch a
+  $ cat >> a << EOF
+  > 1
+  > 2
+  > 3
+  > 4
+  > 5
+  > EOF
+
+  $ hg add a
+  $ hg ci -m "The base commit"
+
+Make sure aborting the interactive selection does no magic
+--
+
+  $ hg status
+  $ hg uncommit -i< q
+  > EOF
+  diff --git a/a b/a
+  new file mode 100644
+  examine changes to 'a'? [Ynesfdaq?] q
+  
+  abort: user quit
+  [255]
+  $ hg status
+
+Make a commit with multiple hunks
+-
+
+  $ cat > a << EOF
+  > -2
+  > -1
+  > 0
+  > 1
+  > 2
+  > 3
+  > foo
+  > bar
+  > 4
+  > 5
+  > babar
+  > EOF
+
+  $ hg diff
+  diff -r 7733902a8d94 a
+  --- a/a  Thu Jan 01 00:00:00 1970 +
+  +++ b/a  Thu Jan 01 00:00:00 1970 +
+  @@ -1,5 +1,11 @@
+  +-2
+  +-1
+  +0
+   1
+   2
+   3
+  +foo
+  +bar
+   4
+   5
+  +babar
+
+  $ hg ci -m "another one"
+
+Not selecting anything to uncommit
+==
+
+  $ hg uncommit -i< y
+  > n
+  > n
+  > n
+  > EOF
+  diff --git a/a b/a
+  3 hunks, 6 lines changed
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -1,3 +1,6 @@
+  +-2
+  +-1
+  +0
+   1
+   2
+   3
+  discard change 1/3 to 'a'? [Ynesfdaq?] n
+  
+  @@ -1,5 +4,7 @@
+   1
+   2
+   3
+  +foo
+  +bar
+   4
+   5
+  discard change 2/3 to 'a'? [Ynesfdaq?] n
+  
+  @@ -4,2 +9,3 @@
+   4
+   5
+  +babar
+  discard change 3/3 to 'a'? [Ynesfdaq?] n
+  
+  abort: nothing selected to uncommit
+  [255]
+  $ hg status
+
+Uncommit a chunk
+
+
+  $ hg uncommit -i< y
+  > y
+  > n
+  > n
+  > EOF
+  diff --git a/a b/a
+  3 hunks, 6 lines changed
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -1,3 +1,6 @@
+  +-2
+  +-1
+  +0
+   1
+   2
+   3
+  discard change 1/3 to 'a'? [Ynesfdaq?] y
+  
+  @@ -1,5 +4,7 @@
+   1
+   2
+   3
+  +foo
+  +bar
+   4
+   5
+  discard change 2/3 to 'a'? [Ynesfdaq?] n
+  
+  @@ -4,2 +9,3 @@
+   4
+   5
+  +babar
+  discard change 3/3 to 'a'? [Ynesfdaq?] n
+  
+
+  $ hg log -G --hidden
+  @  changeset:   3:678a59e5ff90
+  |  tag: tip
+  |  parent:  0:7733902a8d94
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: another one
+  |
+  | x  changeset:   2:e9635f4beaf1
+  |/   parent:  0:7733902a8d94
+  |user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |obsolete:pruned using uncommit
+  |summary: temporary commit for uncommiting f70fb463d5bf
+  |
+  | x  changeset:   1:f70fb463d5bf
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |obsolete:rewritten using uncommit as 3:678a59e5ff90
+  |summary: another one
+  |
+  o  changeset:   0:7733902a8d94
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: The base commit
+  
+The unselected part should be in the diff
+-
+
+  $ hg diff
+  diff -r 678a59e5ff90 a
+  --- a/a  Thu Jan 01 00:00:00 1970 +
+  +++ b/a  Thu Jan 01 00:00:00 1970 +
+  @@ -1,3 +1,6 @@
+  +-2
+  +-1
+  +0
+   1
+   2
+   3
+
+The commit should contain the rest of part
+--
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #  Thu Jan 01 

D5969: uncommit: inform user if the commit is empty after uncommit

2019-02-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG949c4a3b7373: uncommit: inform user if the commit is empty 
after uncommit (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5969?vs=14108=14147

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

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

CHANGE DETAILS

diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -159,6 +159,7 @@
   abort: uncommitted changes
   [255]
   $ hg uncommit files
+  note: keeping empty commit
   $ cat files
   abcde
   foo
@@ -282,6 +283,7 @@
 Phase is preserved
 
   $ hg uncommit --keep --config phases.new-commit=secret
+  note: keeping empty commit
   $ hg phase -r .
   15: draft
   $ hg commit --amend -m 'update ab again'
@@ -318,6 +320,7 @@
   > EOS
   $ hg up Q -q
   $ hg uncommit --keep
+  note: keeping empty commit
   $ hg log -G -T '{desc} FILES: {files}'
   @  Q FILES:
   |
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -69,11 +69,11 @@
 if not exclude:
 return None
 
-files = (initialfiles - exclude)
 # return the p1 so that we don't create an obsmarker later
 if not keepcommit:
 return ctx.p1().node()
 
+files = (initialfiles - exclude)
 # Filter copies
 copied = copiesmod.pathcopies(base, ctx)
 copied = dict((dst, src) for dst, src in copied.iteritems()
@@ -88,6 +88,9 @@
   copied=copied.get(path))
 return mctx
 
+if not files:
+repo.ui.status(_("note: keeping empty commit\n"))
+
 new = context.memctx(repo,
  parents=[base.node(), node.nullid],
  text=ctx.description(),



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


D5966: test: stabilize test-run-tests.t output

2019-02-20 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4618bdf75d8a: test: stabilize test-run-tests.t output 
(authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5966?vs=14095=14146

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

AFFECTED FILES
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1174,31 +1174,31 @@
   $ cat report.json
   testreport ={
   "test-failure.t": [\{] (re)
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "---.+\+\+\+.+", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "failure", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }, ? (re)
   "test-skip.t": {
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "skip", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }, ? (re)
   "test-success.t": [\{] (re)
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "success", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }
   } (no-eol)
 --json with --outputdir
@@ -1231,31 +1231,31 @@
   $ cat output/report.json
   testreport ={
   "test-failure.t": [\{] (re)
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "---.+\+\+\+.+", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "failure", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }, ? (re)
   "test-skip.t": {
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "skip", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }, ? (re)
   "test-success.t": [\{] (re)
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "success", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }
   } (no-eol)
   $ ls -a output
@@ -1287,31 +1287,31 @@
   $ cat report.json
   testreport ={
   "test-failure.t": [\{] (re)
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+  "end": "\s*\d+\.\d{3,4}", ? (re)
   "result": "success", ? (re)
-  "start": "\s*[\d\.]{4,5}", ? (re)
-  "time": "\s*[\d\.]{4,5}" (re)
+  "start": "\s*\d+\.\d{3,4}", ? (re)
+  "time": "\s*\d+\.\d{3,4}" (re)
   }, ? (re)
   "test-skip.t": {
-  "csys": "\s*[\d\.]{4,5}", ? (re)
-  "cuser": "\s*[\d\.]{4,5}", ? (re)
+  "csys": "\s*\d+\.\d{3,4}", ? (re)
+  "cuser": "\s*\d+\.\d{3,4}", ? (re)
   "diff": "", ? (re)
-  "end": "\s*[\d\.]{4,5}", ? (re)
+

D5960: test: stabilize test-remotefilelog-bgprefetch.t flaky output

2019-02-20 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5b6ee1b16f9a: test: stabilize 
test-remotefilelog-bgprefetch.t flaky output (authored by lothiraldan, 
committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5960?vs=14089=14145

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

AFFECTED FILES
  tests/test-remotefilelog-bgprefetch.t

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-bgprefetch.t 
b/tests/test-remotefilelog-bgprefetch.t
--- a/tests/test-remotefilelog-bgprefetch.t
+++ b/tests/test-remotefilelog-bgprefetch.t
@@ -105,6 +105,7 @@
   $ hg debugwaitonprefetch >/dev/null 2>%1
   $ sleep 0.5
   $ hg debugwaitonrepack >/dev/null 2>%1
+  $ sleep 0.5
   $ find $CACHEDIR -type f | sort
   
$TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histidx
   
$TESTTMP/hgcache/master/packs/6e8633deba6e544e5f8edbd7b996d6e31a2c42ae.histpack
@@ -193,6 +194,7 @@
   $ hg debugwaitonprefetch >/dev/null 2>%1
   $ sleep 1
   $ hg debugwaitonrepack >/dev/null 2>%1
+  $ sleep 1
   $ find $CACHEDIR -type f | sort
   
$TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histidx
   
$TESTTMP/hgcache/master/packs/8f1443d44e57fec96f72fb2412e01d2818767ef2.histpack
@@ -243,6 +245,7 @@
   $ hg debugwaitonprefetch >/dev/null 2>%1
   $ sleep 1
   $ hg debugwaitonrepack >/dev/null 2>%1
+  $ sleep 1
 
 # Ensure that file 'y' was prefetched - it was not part of the rebase 
operation and therefore
 # could only be downloaded by the background prefetch



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


mercurial@41724: 6 new changesets

2019-02-20 Thread Mercurial Commits
6 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/5f9d057ba28c
changeset:   41719:5f9d057ba28c
user:Pulkit Goyal 
date:Thu Jan 31 20:11:16 2019 +0300
summary: changegroup: don't try to prune manifest nodes if not ellipses

https://www.mercurial-scm.org/repo/hg/rev/6704696141b8
changeset:   41720:6704696141b8
user:rdama...@google.com
date:Wed Feb 13 18:34:08 2019 -0800
summary: templates: adding a config() function for template customization

https://www.mercurial-scm.org/repo/hg/rev/eb8a8af4cbd0
changeset:   41721:eb8a8af4cbd0
user:Matt Harbison 
date:Sun Feb 17 22:39:12 2019 -0500
summary: tests: correct the remaining fallout from recent path style 
changes on Windows

https://www.mercurial-scm.org/repo/hg/rev/37b33c34bf4f
changeset:   41722:37b33c34bf4f
user:Jordi Gutiérrez Hermoso 
date:Fri Feb 15 14:43:31 2019 -0500
summary: templatekw: add a {negrev} keyword

https://www.mercurial-scm.org/repo/hg/rev/ebbc4e70ebd1
changeset:   41723:ebbc4e70ebd1
user:Pulkit Goyal 
date:Mon Feb 11 19:41:37 2019 +0300
summary: narrow: fix command name in error messsage

https://www.mercurial-scm.org/repo/hg/rev/35158796f52f
changeset:   41724:35158796f52f
bookmark:@
tag: tip
user:Sushil khanchi 
date:Thu Feb 14 18:28:27 2019 +0530
summary: copies: return True instead of filename as it is expected to 
return boolean

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


D5966: test: stabilize test-run-tests.t output

2019-02-20 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> lothiraldan wrote in test-run-tests.t:1177
> I think it's the case, the first part of the regex `\d+` will match any 
> amount of seconds and the remaining part `\.\d{3,4}` should match as long the 
> precision doesn't change.

Ah I see, I wasn't reading the change in regular expression quite right the 
first few times. Ugh.

REPOSITORY
  rHG Mercurial

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

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


[Bug 6085] New: Exception AttributeError presumably from largefiles

2019-02-20 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6085

Bug ID: 6085
   Summary: Exception AttributeError presumably from largefiles
   Product: Mercurial
   Version: 4.9
  Hardware: Macintosh
OS: Mac OS
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: largefiles
  Assignee: bugzi...@mercurial-scm.org
  Reporter: peter.vi...@uni-siegen.de
CC: mercurial-devel@mercurial-scm.org, nato...@gmail.com

Since several days I get this error message:


Exception AttributeError: "'NoneType' object has no attribute 'close'" in
> ignored


The message is only shown when doing a hg operation that reaches for a remote
repository, e.g. `push` or `pull` or `out`, but not `update`. The first time I
saw this was with 4.7.2, but it also occurs with 4.9.

I'm a little helpless here. I tried to dig a little into largefiles extension
to get an idea of what could cause this error, but it seems this problem to
require a deeper understanding of mercurial's internals and/or python than I
can provide.

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


D5955: watchman: ignore some of watchman errors

2019-02-20 Thread lothiraldan (Boris Feld)
lothiraldan added a subscriber: indygreg.
lothiraldan added a comment.


  @indygreg I've update the patchs with your reviews.

REPOSITORY
  rHG Mercurial

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

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


Re: Auto-formatting code with black - object now if you have a strong opinion

2019-02-20 Thread Boris FELD
On 19/02/2019 16:28, Augie Fackler wrote:
> On Wed, Feb 13, 2019 at 10:33:15AM +0100, Boris FELD wrote:
>> On 01/12/2018 02:35, Matt Harbison wrote:
>>> On Fri, 30 Nov 2018 07:25:04 -0500, Boris FELD
>>>  wrote:
>>>
 I think using automatic formatting is a great idea and we should move
 forward with this plan. Black seems a good option. I share other's
 concerns about the formatting of import. I also wonder if this also
 applies to list and dict formatting that we tend to express with one
 value per line for clarity.
>>> It looks like yes, unfortunately, if it fits on one line:
>>>
>>> diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
>>> --- a/hgext/lfs/blobstore.py
>>> +++ b/hgext/lfs/blobstore.py
>>> @@ -289,50 +289,47 @@ class _gitlfsremote(object):
>>>  Return decoded JSON object like {'objects': [{'oid': '',
>>> 'size': 1}]}
>>>  See
>>> https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
>>>  """
>>> -    objects = [{'oid': p.oid(), 'size': p.size()} for p in pointers]
>>> -    requestdata = json.dumps({
>>> -    'objects': objects,
>>> -    'operation': action,
>>> -    })
>>> -    url = '%s/objects/batch' % self.baseurl
>>> +    objects = [{"oid": p.oid(), "size": p.size()} for p in pointers]
>>> +    requestdata = json.dumps({"objects": objects, "operation":
>>> action})
>>> +    url = "%s/objects/batch" % self.baseurl
>>>  batchreq = util.urlreq.request(url, data=requestdata)
>>> ...
>> We have been discussing with the Black author about how we could handle
>> those cases and we found a `hack` which is adding an empty comment on
>> the first line of a list, dict, multi-line construction:
> If you're talking to Łukasz, could you float the way clang-format
> works by him? That is, if a trailing comma is present in the literal
> it's formatted one element per line, but if there's no trailing comma
> it's formatted compactly. I've found that to be a good tradeoff. It'd
> also make our import blocks format correctly without modification.
He is quite aware of that option and seems to have decided against it
for good. He pointed us toward the # hack instead saying it works but
finding it inelegant. (So we seems to be in a case of "Ĺukasz doesn't
want people to use this hack, but he seems to be even less willing to
offer a cleaner alternative")
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel