D4361: zsh_completion: complete hg files

2018-08-29 Thread av6 (Anton Shestakov)
av6 added inline comments.

INLINE COMMENTS

> pulkit wrote in zsh_completion:636
> I changed "revision" to "REV" in flight.

What is REV? It's a metavariable used in hg help output. It makes sense if you 
look at the help output while typing up hg files, but zsh's completion is 
supposed to help users to not constantly look at help/info/man, and here and 
throughout the completion file the metavariable is "revision".

Actually, looks like even hg help output most of the time spells out "revision" 
or "changeset" instead of using metavariables.

REPOSITORY
  rHG Mercurial

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

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


D4362: zsh_completion: complete merge tools for -t/--tool

2018-08-29 Thread av6 (Anton Shestakov)
av6 added inline comments.

INLINE COMMENTS

> spectral wrote in zsh_completion:292
> I'm slightly concerned this might give a false impression of what's 
> available, listing things that I don't have installed, but I think this might 
> be the best we can do at the moment - there doesn't appear to be a way to 
> convince filemerge.py's _picktool to dump a list of them.

zsh will uniquify this, yes.

This seems to be the best way to do it so far, but maybe there needs to be a 
debugmergetool command or something. This is, by the way, a port of 
fish-shell's way to get the list of merge tools.

REPOSITORY
  rHG Mercurial

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

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


[PATCH] run-tests: conditionalize HGCATAPULTSERVERPIPE for Windows

2018-08-29 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1535600398 14400
#  Wed Aug 29 23:39:58 2018 -0400
# Node ID cf1e74e80f0123f9a9fc4876035474d6dc525a3b
# Parent  6827d3f47d4f1bab01a0cc92d7d9bfc52ee9f535
run-tests: conditionalize HGCATAPULTSERVERPIPE for Windows

Many of the *.py tests were dying on:

File "c:\Users\Matt\projects\hg\hgdemandimport\tracing.py", line 27, in log
  _pipe = open(os.environ['HGCATAPULTSERVERPIPE'], 'w', 1)
  IOError: [Errno 2] $ENOENT$: '/dev/null'

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1072,7 +1072,10 @@ class Test(unittest.TestCase):
 env["HGHOSTNAME"] = "test-hostname"
 env['HGIPV6'] = str(int(self._useipv6))
 if 'HGCATAPULTSERVERPIPE' not in env:
-env['HGCATAPULTSERVERPIPE'] = '/dev/null'
+if os.name == 'nt':
+env['HGCATAPULTSERVERPIPE'] = 'NUL'
+else:
+env['HGCATAPULTSERVERPIPE'] = '/dev/null'
 
 extraextensions = []
 for opt in self._extraconfigopts:
@@ -1390,7 +1393,7 @@ class TTest(Test):
 script.append(b'alias pwd="pwd -W"\n')
 
 hgcatapult = os.getenv('HGCATAPULTSERVERPIPE')
-if hgcatapult and hgcatapult != '/dev/null':
+if hgcatapult and hgcatapult not in ['/dev/null', 'NUL']:
 # Kludge: use a while loop to keep the pipe from getting
 # closed by our echo commands. The still-running file gets
 # reaped at the end of the script, which causes the while
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] lfs: add a progress bar when searching for blobs to upload

2018-08-29 Thread Matt Harbison
On Fri, 24 Aug 2018 18:18:32 -0400, Matt Harbison   
wrote:



# HG changeset patch
# User Matt Harbison 
# Date 1535147146 14400
#  Fri Aug 24 17:45:46 2018 -0400
# Node ID 76eca3ae345b261c0049d16269cdf991a31af21a
# Parent  c9a3f7f5c0235e3ae35135818c48ec5ea006de37
lfs: add a progress bar when searching for blobs to upload

The search itself can take an extreme amount of time if there are a lot  
of
revisions involved.  I've got a local repo that took 6 minutes to push  
1850

commits, and 60% of that time was spent here (there are ~70K files):

 \ 58.1%  wrapper.py: extractpointers  line 297:  pointers =  
extractpointers(...
   | 57.7%  wrapper.py: pointersfromctxline 352:  for p in  
pointersfromctx(ct...
   | 57.4%  wrapper.py: pointerfromctx line 397:  p =  
pointerfromctx(ctx, f, ...
 \ 38.7%  context.py: __contains__ line 368:  if f not  
in ctx:
   | 38.7%  util.py:__get__line 82:  return key  
in self._manifest
   | 38.7%  context.py: _manifest  line 1416:  result =  
self.func(obj)
   | 38.7%  manifest.py:read   line 472:  return  
self._manifestctx.re...
 \ 25.6%  revlog.py:  revision line 1562:  text =  
rl.revision(self._node)
   \ 12.8%  revlog.py:  _chunksline 2217:  bins =  
self._chunks(chain, ...
 | 12.0%  revlog.py:  decompressline 2112:   
ladd(decomp(buffer(data, ch...
   \  7.8%  revlog.py:  checkhash  line 2232:   
self.checkhash(text, node, ...
 |  7.8%  revlog.py:  hash line 2315:  if node  
!= self.hash(text, ...
 |  7.8%  revlog.py:  hash line 2242:  return  
hash(text, p1, p2)
 \ 12.0%  manifest.py:__init__ line 1565:   
self._data = manifestdict(t...
 \ 16.8%  context.py: filenode line 378:  if not  
_islfs(fctx.filelog(...
   | 15.7%  util.py:__get__line 706:  return  
self._filelog
   | 14.8%  context.py: _filelog   line 1416:  result =  
self.func(obj)
   | 14.8%  localrepo.py:   file   line 629:  return  
self._repo.file(self...
   | 14.8%  filelog.py: __init__   line 1134:  return  
filelog.filelog(self...
   | 14.5%  revlog.py:  __init__   line 24:   
censorable=True)


Any ideas how to trim down some of this overhead?  revset._matchfiles()  
has a comment about reading the changelog directly because of the overhead  
of creating changectx[1].  I think that could work here too, but falls  
apart because of the need to access the filelogs too.  It seems like  
reading the changelog and accessing the filelogs directly here is too low  
level, especially with @indygreg trying to add support for non-filelog  
storage.


[1]  
https://www.mercurial-scm.org/repo/hg/file/6f38284b23f4/mercurial/revset.py#l1113

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


[PATCH] filemerge: fix an i18n comment typo

2018-08-29 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1535597624 14400
#  Wed Aug 29 22:53:44 2018 -0400
# Node ID 6827d3f47d4f1bab01a0cc92d7d9bfc52ee9f535
# Parent  8ff329f68f9a1b11eb877eafc4a539dce7096199
filemerge: fix an i18n comment typo

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -998,7 +998,7 @@ def loadinternalmerge(ui, extname, regis
 
 # to put i18n comments into hg.pot for automatically generated texts
 
-# i18n: "binary" and "symlik" are keywords
+# i18n: "binary" and "symlink" are keywords
 # i18n: this text is added automatically
 _("(actual capabilities: binary, symlink)")
 # i18n: "binary" is keyword
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4421: tests: use {rev} instead of {node|short} and (glob) in narrow tests

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think we used {node|short} because they were first written for only
  flat manifests and we didn't think to change the format when we
  started testing tree manifests.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-narrow-widen-non-ellipsis.t
  tests/test-narrow-widen.t
  tests/test-narrow.t

CHANGE DETAILS

diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -22,18 +22,18 @@
   >   hg add d$x/f
   >   hg commit -m "add d$x/f"
   > done
-  $ hg log -T "{node|short}: {desc}\n"
-  *: add d10/f (glob)
-  *: add d9/f (glob)
-  *: add d8/f (glob)
-  *: add d7/f (glob)
-  *: add d6/f (glob)
-  *: add d5/f (glob)
-  *: add d4/f (glob)
-  *: add d3/f (glob)
-  *: add d2/f (glob)
-  *: add d1/f (glob)
-  *: add d0/f (glob)
+  $ hg log -T "{rev}: {desc}\n"
+  10: add d10/f
+  9: add d9/f
+  8: add d8/f
+  7: add d7/f
+  6: add d6/f
+  5: add d5/f
+  4: add d4/f
+  3: add d3/f
+  2: add d2/f
+  1: add d1/f
+  0: add d0/f
   $ cd ..
 
 Error if '.' or '..' are in the directory to track.
@@ -111,15 +111,15 @@
   d6/f
   $ hg verify -q
 Force deletion of local changes
-  $ hg log -T "{node|short}: {desc} {outsidenarrow}\n"
-  *: local change to d3  (glob)
-  *: local change to d0  (glob)
-  *: add d10/f outsidenarrow (glob)
-  *: add d6/f  (glob)
-  *: add d5/f outsidenarrow (glob)
-  *: add d3/f  (glob)
-  *: add d2/f outsidenarrow (glob)
-  *: add d0/f  (glob)
+  $ hg log -T "{rev}: {desc} {outsidenarrow}\n"
+  8: local change to d3 
+  6: local change to d0 
+  5: add d10/f outsidenarrow
+  4: add d6/f 
+  3: add d5/f outsidenarrow
+  2: add d3/f 
+  1: add d2/f outsidenarrow
+  0: add d0/f 
   $ hg tracked --removeinclude d0 --force-delete-local-changes
   comparing with ssh://user@dummy/master
   searching for changes
@@ -133,14 +133,14 @@
   deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore 
!)
   deleting data/d0/f/index (reposimplestore !)
 
-  $ hg log -T "{node|short}: {desc} {outsidenarrow}\n"
-  *: local change to d3  (glob)
-  *: add d10/f outsidenarrow (glob)
-  *: add d6/f  (glob)
-  *: add d5/f outsidenarrow (glob)
-  *: add d3/f  (glob)
-  *: add d2/f outsidenarrow (glob)
-  *: add d0/f outsidenarrow (glob)
+  $ hg log -T "{rev}: {desc} {outsidenarrow}\n"
+  7: local change to d3 
+  5: add d10/f outsidenarrow
+  4: add d6/f 
+  3: add d5/f outsidenarrow
+  2: add d3/f 
+  1: add d2/f outsidenarrow
+  0: add d0/f outsidenarrow
 Can restore stripped local changes after widening
   $ hg tracked --addinclude d0 -q
   $ hg unbundle .hg/strip-backup/*-narrow.hg -q
diff --git a/tests/test-narrow-widen.t b/tests/test-narrow-widen.t
--- a/tests/test-narrow-widen.t
+++ b/tests/test-narrow-widen.t
@@ -76,15 +76,15 @@
   $ echo 'widest v4' > widest/f
   $ hg commit -m 'update widest v4'
 
-  $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  *: update widest v4 (glob)
-  *: add outside2 (glob)
-  *: update inside (glob)
-  *: update widest v3 (glob)
-  *: add wider, update widest (glob)
-  *: add outside (glob)
-  *: add widest (glob)
-  *: add inside (glob)
+  $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
+  7: update widest v4
+  6: add outside2
+  5: update inside
+  4: update widest v3
+  3: add wider, update widest
+  2: add outside
+  1: add widest
+  0: add inside
 
   $ cd ..
 
@@ -129,13 +129,13 @@
   $ cat inside/f
   inside v2
 
-  $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  ...*: update widest v4 (glob)
-  *: update inside (glob)
-  ...*: update widest v3 (glob)
-  *: add wider, update widest (glob)
-  ...*: add outside (glob)
-  *: add inside (glob)
+  $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
+  ...5: update widest v4
+  4: update inside
+  ...3: update widest v3
+  2: add wider, update widest
+  ...1: add outside
+  0: add inside
 
 Check that widening with a newline fails
 
@@ -179,15 +179,15 @@
   $ cat widest/f
   widest v4
 
-  $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  *: update widest v4 (glob)
-  ...*: add outside2 (glob)
-  *: update inside (glob)
-  *: update widest v3 (glob)
-  *: add wider, update widest (glob)
-  ...*: add outside (glob)
-  *: add widest (glob)
-  *: add inside (glob)
+  $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
+  7: update widest v4
+  ...6: add outside2
+  5: update inside
+  4: update widest v3
+  3: add wider, update widest
+  ...2: add outside
+  1: add widest
+  0: add inside
 
 separate suite of tests: files from 0-10 modified in changes 0-10. This allows
 more obvious precise tests tickling particular corner cases.
@@ -206,18 +206,18 @@
   >   hg add d$x/f
   >   hg commit -m "add d$x/f"
   > done
-  $ hg log -T "{node|short}: {desc}\n"
-  *: add d10/f (glob)
-  *: add d9/f 

D4382: tests: add test to show widening is broken without ellipsis

2018-08-29 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbca0546a44bf: tests: add test to show widening is broken 
without ellipsis (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4382?vs=10580=10661

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

AFFECTED FILES
  tests/test-narrow-widen-non-ellipsis.t
  tests/test-narrow-widen.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen.t b/tests/test-narrow-widen-non-ellipsis.t
copy from tests/test-narrow-widen.t
copy to tests/test-narrow-widen-non-ellipsis.t
--- a/tests/test-narrow-widen.t
+++ b/tests/test-narrow-widen-non-ellipsis.t
@@ -1,19 +1,12 @@
-#testcases flat tree
   $ . "$TESTDIR/narrow-library.sh"
 
-#if tree
   $ cat << EOF >> $HGRCPATH
   > [experimental]
   > treemanifest = 1
   > EOF
-#endif
 
   $ hg init master
   $ cd master
-  $ cat >> .hg/hgrc < [narrow]
-  > serveellipses=True
-  > EOF
 
   $ mkdir inside
   $ echo 'inside' > inside/f
@@ -39,7 +32,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 1 changes to 1 files
+  added 3 changesets with 1 changes to 1 files
   new changesets *:* (glob)
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -96,15 +89,9 @@
   comparing with ssh://user@dummy/master
   searching for changes
   no changes found
-  saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
-  adding changesets
-  adding manifests
-  adding file changes
-  added 2 changesets with 1 changes to 1 files
-  new changesets *:* (glob)
+  3 local changesets published
   $ hg tracked
   I path:inside
-  I path:wider/f
 
 Pull down the newly added upstream revision.
 
@@ -114,27 +101,31 @@
   adding changesets
   adding manifests
   adding file changes
-  added 4 changesets with 2 changes to 2 files
+  added 5 changesets with 1 changes to 1 files
   new changesets *:* (glob)
   (run 'hg update' to get a working copy)
   $ hg update -r 'desc("add wider")'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat wider/f
-  wider
+  cat: wider/f: $ENOENT$
+  [1]
 
   $ hg update -r 'desc("update inside")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat wider/f
-  wider
+  cat: wider/f: $ENOENT$
+  [1]
   $ cat inside/f
   inside v2
 
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  ...*: update widest v4 (glob)
+  45662f0793c7: update widest v4
+  1dd1364b566e: add outside2
   *: update inside (glob)
-  ...*: update widest v3 (glob)
+  be0600e3ccba: update widest v3
   *: add wider, update widest (glob)
-  ...*: add outside (glob)
+  4922ea71b958: add outside
+  40e0ea6c8cd7: add widest
   *: add inside (glob)
 
 Check that widening with a newline fails
@@ -150,42 +141,42 @@
   comparing with ssh://user@dummy/master
   searching for changes
   no changes found
-  saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
-  adding changesets
-  adding manifests
-  adding file changes
-  added 8 changesets with 7 changes to 3 files
-  new changesets *:* (glob)
+  5 local changesets published
+  abort: path ends in directory separator: widest/
+  [255]
   $ hg tracked
   I path:inside
-  I path:wider/f
-  I path:widest
   $ hg update 'desc("add widest")'
-  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ cat widest/f
-  widest
-  $ hg update 'desc("add wider, update widest")'
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat wider/f
-  wider
-  $ cat widest/f
-  widest v2
-  $ hg update 'desc("update widest v3")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat widest/f
-  widest v3
+  cat: widest/f: $ENOENT$
+  [1]
+  $ hg update 'desc("add wider, update widest")'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat wider/f
+  cat: wider/f: $ENOENT$
+  [1]
+  $ cat widest/f
+  cat: widest/f: $ENOENT$
+  [1]
+  $ hg update 'desc("update widest v3")'
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat widest/f
+  cat: widest/f: $ENOENT$
+  [1]
   $ hg update 'desc("update widest v4")'
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat widest/f
-  widest v4
+  cat: widest/f: $ENOENT$
+  [1]
 
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
   *: update widest v4 (glob)
-  ...*: add outside2 (glob)
+  1dd1364b566e: add outside2
   *: update inside (glob)
   *: update widest v3 (glob)
   *: add wider, update widest (glob)
-  ...*: add outside (glob)
+  4922ea71b958: add outside
   *: add widest (glob)
   *: add inside (glob)
 
@@ -195,10 +186,6 @@
   $ cd ..
   $ hg init upstream
   $ cd 

D4383: narrow: add server logic to send cg while widening without ellipsis

2018-08-29 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc8e4eae84808: narrow: add server logic to send cg while 
widening without ellipsis (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4383?vs=10581=10662

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowcommands.py
  tests/test-narrow-widen-non-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-non-ellipsis.t 
b/tests/test-narrow-widen-non-ellipsis.t
--- a/tests/test-narrow-widen-non-ellipsis.t
+++ b/tests/test-narrow-widen-non-ellipsis.t
@@ -89,6 +89,10 @@
   comparing with ssh://user@dummy/master
   searching for changes
   no changes found
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 0 changes to 1 files
   3 local changesets published
   $ hg tracked
   I path:inside
@@ -141,6 +145,10 @@
   comparing with ssh://user@dummy/master
   searching for changes
   no changes found
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 4 changes to 2 files
   5 local changesets published
   abort: path ends in directory separator: widest/
   [255]
@@ -247,6 +255,10 @@
   comparing with ssh://user@dummy/upstream
   searching for changes
   no changes found
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 1 changes to 5 files
   11 local changesets published
   abort: path ends in directory separator: d1/
   [255]
@@ -274,9 +286,12 @@
   checking changesets
   checking manifests
   checking directory manifests
+  warning: orphan data file 'meta/d1/00manifest.i'
   crosschecking files in changesets and manifests
   checking files
+  warning: orphan data file 'data/d1/f.i'
   4 files, 11 changesets, 4 total revisions
+  2 warnings encountered!
 
 Widening preserves parent of local commit
 
@@ -340,6 +355,10 @@
   comparing with ssh://user@dummy/upstream
   searching for changes
   no changes found
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 1 changes to 2 files
   11 local changesets published
   abort: path ends in directory separator: d1/
   [255]
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -286,6 +286,7 @@
 # The old{in,ex}cludepats have already been set by orig()
 kwargs['includepats'] = newincludes
 kwargs['excludepats'] = newexcludes
+kwargs['widen'] = True
 wrappedextraprepare = extensions.wrappedfunction(exchange,
 '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
 
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -50,6 +50,50 @@
 caps[NARROWCAP] = ['v0']
 return caps
 
+def getbundlechangegrouppart_nonellipsis(bundler, repo, source, 
bundlecaps=None,
+ b2caps=None, heads=None, common=None,
+ **kwargs):
+"""Handling changegroup changegroup generation on the server when user
+is widening their narrowspec"""
+
+cgversions = b2caps.get('changegroup')
+if cgversions:  # 3.1 and 3.2 ship with an empty value
+cgversions = [v for v in cgversions
+  if v in changegroup.supportedoutgoingversions(repo)]
+if not cgversions:
+raise ValueError(_('no common changegroup version'))
+version = max(cgversions)
+else:
+raise ValueError(_("server does not advertise changegroup version,"
+   " can't negotiate support for ellipsis nodes"))
+
+include = sorted(filter(bool, kwargs.get(r'includepats', [])))
+exclude = sorted(filter(bool, kwargs.get(r'excludepats', [])))
+newmatch = narrowspec.match(repo.root, include=include, exclude=exclude)
+oldinclude = sorted(filter(bool, kwargs.get(r'oldincludepats', [])))
+oldexclude = sorted(filter(bool, kwargs.get(r'oldexcludepats', [])))
+common = set(common or [nullid])
+
+if (oldinclude != include or oldexclude != exclude):
+common = repo.revs("::%ln", common)
+commonnodes = set()
+cl = repo.changelog
+for c in common:
+commonnodes.add(cl.node(c))
+if commonnodes:
+# XXX: we should only send the filelogs (and treemanifest). user
+# already has the changelog and manifest
+packer = changegroup.getbundler(version, repo,
+filematcher=newmatch,
+fullnodes=commonnodes)
+cgdata = packer.generate(set([nullid]), list(commonnodes), False,
+source)
+
+part = 

D4385: tests: add flat manifest case in test-narrow-widen-non-ellipsis.t

2018-08-29 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG57b2a02420cd: tests: add flat manifest case in 
test-narrow-widen-non-ellipsis.t (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4385?vs=10583=10664

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

AFFECTED FILES
  tests/test-narrow-widen-non-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-non-ellipsis.t 
b/tests/test-narrow-widen-non-ellipsis.t
--- a/tests/test-narrow-widen-non-ellipsis.t
+++ b/tests/test-narrow-widen-non-ellipsis.t
@@ -1,9 +1,12 @@
+#testcases tree flat
   $ . "$TESTDIR/narrow-library.sh"
 
+#if tree
   $ cat << EOF >> $HGRCPATH
   > [experimental]
   > treemanifest = 1
   > EOF
+#endif
 
   $ hg init master
   $ cd master
@@ -122,13 +125,13 @@
   inside v2
 
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  45662f0793c7: update widest v4
-  1dd1364b566e: add outside2
+  *: update widest v4 (glob)
+  *: add outside2 (glob)
   *: update inside (glob)
-  be0600e3ccba: update widest v3
+  *: update widest v3 (glob)
   *: add wider, update widest (glob)
-  4922ea71b958: add outside
-  40e0ea6c8cd7: add widest
+  *: add outside (glob)
+  *: add widest (glob)
   *: add inside (glob)
 
 Check that widening with a newline fails
@@ -174,11 +177,11 @@
 
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
   *: update widest v4 (glob)
-  1dd1364b566e: add outside2
+  *: add outside2 (glob)
   *: update inside (glob)
   *: update widest v3 (glob)
   *: add wider, update widest (glob)
-  4922ea71b958: add outside
+  *: add outside (glob)
   *: add widest (glob)
   *: add inside (glob)
 
@@ -229,21 +232,21 @@
   $ hg verify
   checking changesets
   checking manifests
-  checking directory manifests
+  checking directory manifests (tree !)
   crosschecking files in changesets and manifests
   checking files
   4 files, 11 changesets, 4 total revisions
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  5dcf948d1e26: add d10/f
+  *: add d10/f (glob)
   *: add d9/f (glob)
-  ed07d334af10: add d8/f
-  472749d2eed8: add d7/f
+  *: add d8/f (glob)
+  *: add d7/f (glob)
   *: add d6/f (glob)
-  47c482f555ec: add d5/f
-  3c6772db7d10: add d4/f
+  *: add d5/f (glob)
+  *: add d4/f (glob)
   *: add d3/f (glob)
-  a68ce05aaaed: add d2/f
-  5934322a52dd: add d1/f
+  *: add d2/f (glob)
+  *: add d1/f (glob)
   *: add d0/f (glob)
   $ hg tracked --addinclude d1
   comparing with ssh://user@dummy/upstream
@@ -261,24 +264,24 @@
   I path:d6
   I path:d9
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
-  5dcf948d1e26: add d10/f
+  *: add d10/f (glob)
   *: add d9/f (glob)
-  ed07d334af10: add d8/f
-  472749d2eed8: add d7/f
+  *: add d8/f (glob)
+  *: add d7/f (glob)
   *: add d6/f (glob)
-  47c482f555ec: add d5/f
-  3c6772db7d10: add d4/f
+  *: add d5/f (glob)
+  *: add d4/f (glob)
   *: add d3/f (glob)
-  a68ce05aaaed: add d2/f
+  *: add d2/f (glob)
   *: add d1/f (glob)
   *: add d0/f (glob)
 
 Verify shouldn't claim the repo is corrupt after a widen.
 
   $ hg verify
   checking changesets
   checking manifests
-  checking directory manifests
+  checking directory manifests (tree !)
   crosschecking files in changesets and manifests
   checking files
   5 files, 11 changesets, 5 total revisions
@@ -290,8 +293,8 @@
   $ cd narrow3
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
   *: add d2/f (glob)
-  5934322a52dd: add d1/f
-  44d97ac7c511: add d0/f
+  *: add d1/f (glob)
+  *: add d0/f (glob)
   $ hg pull -q -r 3
   $ hg co -q tip
   $ hg pull -q -r 4
@@ -309,10 +312,10 @@
   $ hg ci -m local
   $ hg bookmarks bookmark
   $ hg bookmarks
-   * bookmark  11:42aed9c63197
+   * bookmark  11:* (glob)
   $ hg -q tracked --addinclude d2
   $ hg bookmarks
-   * bookmark  11:42aed9c63197
+   * bookmark  11:* (glob)
   $ hg log -r bookmark -T '{desc}\n'
   local
 
@@ -360,7 +363,7 @@
   1: add d1/f
   0: add d0/f
   $ hg bookmarks
-   * bookmark  11:b7ce3df41eca
+   * bookmark  11:* (glob)
   $ hg unbundle .hg/strip-backup/*-widen.hg
   abort: $ENOENT$: .hg/strip-backup/*-widen.hg
   [255]
@@ -378,4 +381,4 @@
   1: add d1/f
   0: add d0/f
   $ hg bookmarks
-   * bookmark  11:b7ce3df41eca
+   * bookmark  11:* (glob)



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


D4384: narrow: update the narrowspecs to new ones after pulling when widening

2018-08-29 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2b8adb7ca39a: narrow: update the narrowspecs to new ones 
after pulling when widening (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4384?vs=10582=10663

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  tests/test-narrow-widen-non-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-non-ellipsis.t 
b/tests/test-narrow-widen-non-ellipsis.t
--- a/tests/test-narrow-widen-non-ellipsis.t
+++ b/tests/test-narrow-widen-non-ellipsis.t
@@ -96,6 +96,7 @@
   3 local changesets published
   $ hg tracked
   I path:inside
+  I path:wider/f
 
 Pull down the newly added upstream revision.
 
@@ -105,20 +106,18 @@
   adding changesets
   adding manifests
   adding file changes
-  added 5 changesets with 1 changes to 1 files
+  added 5 changesets with 2 changes to 2 files
   new changesets *:* (glob)
   (run 'hg update' to get a working copy)
   $ hg update -r 'desc("add wider")'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat wider/f
-  cat: wider/f: $ENOENT$
-  [1]
+  wider
 
   $ hg update -r 'desc("update inside")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat wider/f
-  cat: wider/f: $ENOENT$
-  [1]
+  wider
   $ cat inside/f
   inside v2
 
@@ -148,35 +147,30 @@
   adding changesets
   adding manifests
   adding file changes
-  added 0 changesets with 4 changes to 2 files
+  added 0 changesets with 4 changes to 3 files
   5 local changesets published
-  abort: path ends in directory separator: widest/
-  [255]
   $ hg tracked
   I path:inside
+  I path:wider/f
+  I path:widest
   $ hg update 'desc("add widest")'
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ cat widest/f
+  widest
+  $ hg update 'desc("add wider, update widest")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat wider/f
+  wider
+  $ cat widest/f
+  widest v2
+  $ hg update 'desc("update widest v3")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
-  $ hg update 'desc("add wider, update widest")'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat wider/f
-  cat: wider/f: $ENOENT$
-  [1]
+  widest v3
+  $ hg update 'desc("update widest v4")'
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
-  $ hg update 'desc("update widest v3")'
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
-  $ hg update 'desc("update widest v4")'
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat widest/f
-  cat: widest/f: $ENOENT$
-  [1]
+  widest v4
 
   $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
   *: update widest v4 (glob)
@@ -260,10 +254,9 @@
   adding file changes
   added 0 changesets with 1 changes to 5 files
   11 local changesets published
-  abort: path ends in directory separator: d1/
-  [255]
   $ hg tracked
   I path:d0
+  I path:d1
   I path:d3
   I path:d6
   I path:d9
@@ -286,12 +279,9 @@
   checking changesets
   checking manifests
   checking directory manifests
-  warning: orphan data file 'meta/d1/00manifest.i'
   crosschecking files in changesets and manifests
   checking files
-  warning: orphan data file 'data/d1/f.i'
-  4 files, 11 changesets, 4 total revisions
-  2 warnings encountered!
+  5 files, 11 changesets, 5 total revisions
 
 Widening preserves parent of local commit
 
@@ -309,8 +299,6 @@
   $ hg ci -m local
   created new head
   $ hg tracked -q --addinclude d0 --addinclude d9
-  abort: path ends in directory separator: d0/
-  [255]
 
 Widening preserves bookmarks
 
@@ -323,8 +311,6 @@
   $ hg bookmarks
* bookmark  11:42aed9c63197
   $ hg -q tracked --addinclude d2
-  abort: path ends in directory separator: d2/
-  [255]
   $ hg bookmarks
* bookmark  11:42aed9c63197
   $ hg log -r bookmark -T '{desc}\n'
@@ -360,8 +346,6 @@
   adding file changes
   added 0 changesets with 1 changes to 2 files
   11 local changesets published
-  abort: path ends in directory separator: d1/
-  [255]
   $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
   11: local
   10: add d10/f
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -307,6 +307,7 @@
 with ds.parentchange():
 ds.setparents(p1, p2)
 
+repo.setnewnarrowpats()
 actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()}
 addgaction = actions['g'].append
 



To: pulkit, 

D4385: tests: add flat manifest case in test-narrow-widen-non-ellipsis.t

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> test-narrow-widen-non-ellipsis.t:127
>  
>$ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
> +  *: update widest v4 (glob)

I know that you're just copying this from other test, but I wonder why we 
didn't just use `{rev}` instead of `{node|short}` so we didn't have to glob it 
out. It makes more sense to fix that in all the tests after this series, of 
course.

REPOSITORY
  rHG Mercurial

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

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


D4384: narrow: update the narrowspecs to new ones after pulling when widening

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> narrowcommands.py:310
>  
> +repo.setnewnarrowpats()
>  actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p 
> pr'.split()}

This means we're now setting it twice in some cases, but that's probably okay. 
We can always improve it later.

REPOSITORY
  rHG Mercurial

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

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


D4383: narrow: add server logic to send cg while widening without ellipsis

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> pulkit wrote in narrowbundle2.py:319
> I tried that but test-narrow-acl.t fails. Also, this is the error trying to 
> prevent which I added the `widen` kwarg to make sure clone operations does 
> not go through that.
> 
> But, clones with narrowhgacl set will go through this code path.
> 
> I looked into fixing this traceback in past but was unable to fix it. Any 
> pointer will be appreciated.
> 
>   --- /storage/pulkit/hg-committed/tests/test-narrow-acl.t
>   +++ /storage/pulkit/hg-committed/tests/test-narrow-acl.t.err
>   @@ -22,21 +22,98 @@
>  adding changesets
>  adding manifests
>  adding file changes
>   -  added 3 changesets with 2 changes to 2 files
>   -  new changesets * (glob)
>   -  updating to branch default
>   -  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
>   +  added 0 changesets with 0 changes to 0 files
>   +  transaction abort!
>   +  rollback completed
>   +  Traceback (most recent call last):
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/scmutil.py", line 
> 164, in callcatch
>   +  return func()
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
> 350, in _runcatchfunc
>   +  return _dispatch(req)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
> 987, in _dispatch
>   +  cmdpats, cmdoptions)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
> 733, in runcommand
>   +  ret = _runcommand(ui, options, cmd, d)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
> 995, in _runcommand
>   +  return cmdfunc()
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
> 984, in 
>   +  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/util.py", line 
> 1532, in check
>   +  return func(*args, **kwargs)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/util.py", line 
> 1532, in check
>   +  return func(*args, **kwargs)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/hgext/narrow/narrowcommands.py",
>  line 137, in clonenarrowcmd
>   +  return orig(ui, repo, *args, **pycompat.strkwargs(opts))
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/util.py", line 
> 1532, in check
>   +  return func(*args, **kwargs)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/commands.py", line 
> 1475, in clone
>   +  shareopts=opts.get('shareopts'))
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/hg.py", line 710, 
> in clone
>   +  streamclonerequested=stream)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/hgext/narrow/narrowcommands.py",
>  line 132, in pullnarrow
>   +  return orig(repo, *args, **kwargs)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/exchange.py", line 
> 1494, in pull
>   +  _fullpullbundle2(repo, pullop)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/exchange.py", line 
> 1434, in _fullpullbundle2
>   +  _pullbundle2(pullop)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/exchange.py", line 
> 1677, in _pullbundle2
>   +  bundle2.processbundle(pullop.repo, bundle, op=op)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
> 460, in processbundle
>   +  processparts(repo, op, unbundler)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
> 467, in processparts
>   +  _processpart(op, part)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
> 534, in _processpart
>   +  handler(op, part)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
> 2138, in handlephases
>   +  phases.updatephases(op.repo.unfiltered(), op.gettransaction, 
> headsbyphase)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/phases.py", line 
> 603, in updatephases
>   +  heads = [c.node() for c in repo.set(revset, headsbyphase[phase])]
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/localrepo.py", 
> line 916, in set
>   +  for r in self.revs(expr, *args):
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/localrepo.py", 
> line 905, in revs
>   +  return m(self)
>   +File 
> "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/revset.py", line 
> 2273, in mfunc
>   +  return getset(repo, subset, tree, order)
>   +File 
> 

D4420: shortest: fix an off-by-1 when disambiguating against revnums

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Revision "5" is an unambiguous hex prefix in a repo with 5 revisions;
  it's only "4" and lower that are ambiguous.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -475,7 +475,7 @@
 # if we are a pure int, then starting with zero will not be
 # confused as a rev; or, obviously, if the int is larger
 # than the value of the tip rev
-if prefix[0:1] == b'0' or i > len(repo):
+if prefix[0:1] == b'0' or i >= len(repo):
 return False
 return True
 except ValueError:



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


Re: D4351: match: improve includematcher.visitchildrenset to be much faster and cached

2018-08-29 Thread Yuya Nishihara
Can't apply. Can you rebase?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D4416: copies: improve logic of deciding copytracing on based of config options

2018-08-29 Thread Yuya Nishihara
check-config complains about bool vs str. parsebool() might help.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4351: match: improve includematcher.visitchildrenset to be much faster and cached

2018-08-29 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Can't apply. Can you rebase?

REPOSITORY
  rHG Mercurial

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

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


D4416: copies: improve logic of deciding copytracing on based of config options

2018-08-29 Thread yuja (Yuya Nishihara)
yuja added a comment.


  check-config complains about bool vs str. parsebool() might help.

REPOSITORY
  rHG Mercurial

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

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


D4378: resolve: add a flag for the default behavior of re-merging

2018-08-29 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron added a comment.


  Thanks for accepting (some of) my other changes.
  I added a couple of simple tests. I could add one for the hint, but I figured 
it's probably not worth it?

REPOSITORY
  rHG Mercurial

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

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


D4378: resolve: add a flag for the default behavior of re-merging

2018-08-29 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron updated this revision to Diff 10658.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4378?vs=10576=10658

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-completion.t
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -442,6 +442,18 @@
   $ hg resolve -l
   R file1
   R file2
+Testing the --re-merge flag
+  $ hg resolve --unmark file1
+  $ hg resolve -l
+  U file1
+  R file2
+  $ hg resolve --mark --re-merge
+  abort: too many options specified
+  [255]
+  $ hg resolve --re-merge --all
+  merging file1
+  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
+  [1]
 
   $ cd ..
 
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -331,7 +331,7 @@
   phase: public, draft, secret, force, rev
   recover: 
   rename: after, force, include, exclude, dry-run
-  resolve: all, list, mark, unmark, no-status, tool, include, exclude, template
+  resolve: all, list, mark, unmark, no-status, re-merge, tool, include, 
exclude, template
   revert: all, date, rev, no-backup, interactive, include, exclude, dry-run
   rollback: dry-run, force
   root: 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4506,7 +4506,8 @@
 ('l', 'list', None, _('list state of files needing merge')),
 ('m', 'mark', None, _('mark files as resolved')),
 ('u', 'unmark', None, _('mark files as unresolved')),
-('n', 'no-status', None, _('hide status prefix'))]
+('n', 'no-status', None, _('hide status prefix')),
+('', 're-merge', None, _('re-merge files'))]
 + mergetoolopts + walkopts + formatteropts,
 _('[OPTION]... [FILE]...'),
 inferrepo=True)
@@ -4523,9 +4524,9 @@
 
 The resolve command can be used in the following ways:
 
-- :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified
-  files, discarding any previous merge attempts. Re-merging is not
-  performed for files already marked as resolved. Use ``--all/-a``
+- :hg:`resolve [--re-merge] [--tool TOOL] FILE...`: attempt to re-merge
+  the specified files, discarding any previous merge attempts. Re-merging
+  is not performed for files already marked as resolved. Use ``--all/-a``
   to select all unresolved files. ``--tool`` can be used to specify
   the merge tool used for the given files. It overrides the HGMERGE
   environment variable and your configuration files.  Previous file
@@ -4554,11 +4555,11 @@
 
 opts = pycompat.byteskwargs(opts)
 confirm = ui.configbool('commands', 'resolve.confirm')
-flaglist = 'all mark unmark list no_status'.split()
-all, mark, unmark, show, nostatus = \
+flaglist = 'all mark unmark list no_status re_merge'.split()
+all, mark, unmark, show, nostatus, remerge = \
 [opts.get(o) for o in flaglist]
 
-if len(list(filter(None, [show, mark, unmark]))) > 1:
+if len(list(filter(None, [show, mark, unmark, remerge]))) > 1:
 raise error.Abort(_("too many options specified"))
 if pats and all:
 raise error.Abort(_("can't specify --all and patterns"))
@@ -4752,8 +4753,11 @@
 for f in ms:
 if not m(f):
 continue
-flags = ''.join(['-%s ' % o[0:1] for o in flaglist
-   if opts.get(o)])
+def flag(o):
+if o == 're_merge':
+return '--re-merge '
+return '-%s ' % o[0:1]
+flags = ''.join([flag(o) for o in flaglist if opts.get(o)])
 hint = _("(try: hg resolve %s%s)\n") % (
  flags,
  ' '.join(pats))



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


D4379: resolve: add config to make hg resolve not re-merge by default

2018-08-29 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron updated this revision to Diff 10659.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4379?vs=10577=10659

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/help/config.txt
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -448,12 +448,22 @@
   U file1
   R file2
   $ hg resolve --mark --re-merge
-  abort: too many options specified
+  abort: too many actions specified
   [255]
   $ hg resolve --re-merge --all
   merging file1
   warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
   [1]
+Explicit re-merge
+  $ hg resolve --unmark file1
+  $ hg resolve --config commands.resolve.explicit-re-merge=1 --all
+  abort: no action specified
+  (use --mark, --unmark, --list or --re-merge)
+  [255]
+  $ hg resolve --config commands.resolve.explicit-re-merge=1 --re-merge --all
+  merging file1
+  warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
+  [1]
 
   $ cd ..
 
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -442,6 +442,11 @@
 Confirm before performing action if no filename is passed.
 (default: False)
 
+``resolve.explicit-re-merge``
+Require uses of ``hg resolve`` to specify which action it should perform,
+instead of re-merging files by default.
+(default: False)
+
 ``resolve.mark-check``
 Determines what level of checking :hg:`resolve --mark` will perform before
 marking files as resolved. Valid values are ``none`, ``warn``, and
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -193,6 +193,9 @@
 coreconfigitem('commands', 'resolve.confirm',
 default=False,
 )
+coreconfigitem('commands', 'resolve.explicit-re-merge',
+default=False,
+)
 coreconfigitem('commands', 'resolve.mark-check',
 default='none',
 )
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4559,8 +4559,13 @@
 all, mark, unmark, show, nostatus, remerge = \
 [opts.get(o) for o in flaglist]
 
-if len(list(filter(None, [show, mark, unmark, remerge]))) > 1:
-raise error.Abort(_("too many options specified"))
+actioncount = len(list(filter(None, [show, mark, unmark, remerge])))
+if actioncount > 1:
+raise error.Abort(_("too many actions specified"))
+elif (actioncount == 0
+  and ui.config('commands', 'resolve.explicit-re-merge')):
+hint = _('use --mark, --unmark, --list or --re-merge')
+raise error.Abort(_('no action specified'), hint=hint)
 if pats and all:
 raise error.Abort(_("can't specify --all and patterns"))
 if not (all or pats or show or mark or unmark):



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


D4398: stringutil: emit multiple chunks when pretty printing

2018-08-29 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5ed7c6caf24d: stringutil: emit multiple chunks when pretty 
printing (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4398?vs=10599=10657

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

AFFECTED FILES
  mercurial/utils/stringutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py
+++ b/mercurial/utils/stringutil.py
@@ -60,19 +60,97 @@
 # without coercion.
 yield "bytearray['%s']" % escapestr(bytes(o))
 elif isinstance(o, list):
-yield '[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
+if not o:
+yield '[]'
+return
+
+yield '['
+
+for i, a in enumerate(o):
+for chunk in pprintgen(a, bprefix=bprefix):
+yield chunk
+
+if i + 1 < len(o):
+yield ', '
+
+yield ']'
 elif isinstance(o, dict):
-yield '{%s}' % (b', '.join(
-'%s: %s' % (pprint(k, bprefix=bprefix),
-pprint(v, bprefix=bprefix))
-for k, v in sorted(o.items(
+if not o:
+yield '{}'
+return
+
+yield '{'
+
+for i, (k, v) in enumerate(sorted(o.items())):
+for chunk in pprintgen(k, bprefix=bprefix):
+yield chunk
+
+yield ': '
+
+for chunk in pprintgen(v, bprefix=bprefix):
+yield chunk
+
+if i + 1 < len(o):
+yield ', '
+
+yield '}'
 elif isinstance(o, set):
-yield 'set([%s])' % (b', '.join(
-pprint(k, bprefix=bprefix) for k in sorted(o)))
+if not o:
+yield 'set([])'
+return
+
+yield 'set(['
+
+for i, k in enumerate(sorted(o)):
+for chunk in pprintgen(k, bprefix=bprefix):
+yield chunk
+
+if i + 1 < len(o):
+yield ', '
+
+yield '])'
 elif isinstance(o, tuple):
-yield '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
+if not o:
+yield '()'
+return
+
+yield '('
+
+for i, a in enumerate(o):
+for chunk in pprintgen(a, bprefix=bprefix):
+yield chunk
+
+if i + 1 < len(o):
+yield ', '
+
+yield ')'
 elif isinstance(o, types.GeneratorType):
-yield 'gen[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
+# Special case of empty generator.
+try:
+nextitem = next(o)
+except StopIteration:
+yield 'gen[]'
+return
+
+yield 'gen['
+
+last = False
+
+while not last:
+current = nextitem
+
+try:
+nextitem = next(o)
+except StopIteration:
+last = True
+
+for chunk in pprintgen(current, bprefix=bprefix):
+yield chunk
+
+if not last:
+yield ', '
+
+yield ']'
 else:
 yield pycompat.byterepr(o)
 



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


D4397: stringutil: refactor core of pprint so it emits chunks

2018-08-29 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0d21b1f1722c: stringutil: refactor core of pprint so it 
emits chunks (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4397?vs=10598=10656

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

AFFECTED FILES
  mercurial/utils/stringutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py
+++ b/mercurial/utils/stringutil.py
@@ -45,30 +45,36 @@
 
 def pprint(o, bprefix=False):
 """Pretty print an object."""
+return b''.join(pprintgen(o, bprefix=bprefix))
+
+def pprintgen(o, bprefix=False):
+"""Pretty print an object to a generator of atoms."""
+
 if isinstance(o, bytes):
 if bprefix:
-return "b'%s'" % escapestr(o)
-return "'%s'" % escapestr(o)
+yield "b'%s'" % escapestr(o)
+else:
+yield "'%s'" % escapestr(o)
 elif isinstance(o, bytearray):
 # codecs.escape_encode() can't handle bytearray, so escapestr fails
 # without coercion.
-return "bytearray['%s']" % escapestr(bytes(o))
+yield "bytearray['%s']" % escapestr(bytes(o))
 elif isinstance(o, list):
-return '[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
+yield '[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
 elif isinstance(o, dict):
-return '{%s}' % (b', '.join(
+yield '{%s}' % (b', '.join(
 '%s: %s' % (pprint(k, bprefix=bprefix),
 pprint(v, bprefix=bprefix))
 for k, v in sorted(o.items(
 elif isinstance(o, set):
-return 'set([%s])' % (b', '.join(
+yield 'set([%s])' % (b', '.join(
 pprint(k, bprefix=bprefix) for k in sorted(o)))
 elif isinstance(o, tuple):
-return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
+yield '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
 elif isinstance(o, types.GeneratorType):
-return 'gen[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
+yield 'gen[%s]' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
 else:
-return pycompat.byterepr(o)
+yield pycompat.byterepr(o)
 
 def prettyrepr(o):
 """Pretty print a representation of a possibly-nested object"""



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


D4291: contrib: import the relnotes script from the release-tools repo

2018-08-29 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG035517d48865: contrib: import the relnotes script from the 
release-tools repo (authored by durin42, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D4291?vs=10461=10655#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4291?vs=10461=10655

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

AFFECTED FILES
  contrib/relnotes
  tests/test-contrib-relnotes.t

CHANGE DETAILS

diff --git a/tests/test-contrib-relnotes.t b/tests/test-contrib-relnotes.t
new file mode 100644
--- /dev/null
+++ b/tests/test-contrib-relnotes.t
@@ -0,0 +1,290 @@
+#require test-repo py3exe
+  $ . "$TESTDIR/helpers-testrepo.sh"
+
+  $ cd $TESTDIR/..
+  $ python3 contrib/relnotes 4.4 --stoprev 4.5
+  New Features
+  
+  
+  revert --interactive
+  
+  
+  The revert command now accepts the flag --interactive to allow reverting only
+  some of the changes to the specified files.
+  
+  Rebase with different destination per source revision
+  -
+  
+  Previously, rebase only supports one unique destination. Now "SRC" and
+  "ALLSRC" can be used in rebase destination revset to precisely define
+  destination per each individual source revision.
+  
+  For example, the following command could move some orphaned changesets to
+  reasonable new places so they become no longer orphaned:
+  
+  hg rebase   -r 'orphan()-obsolete()'   -d 'max((successors(max(roots(ALLSRC) 
&
+  ::SRC)^)-obsolete())::)'
+  
+  Accessing hidden changesets
+  ---
+  
+  Set config option 'experimental.directaccess = True' to access hidden
+  changesets from read only commands.
+  
+  githelp extension
+  -
+  
+  The "githelp" extension provides the "hg githelp" command. This command
+  attempts to convert a "git" command to its Mercurial equivalent. The 
extension
+  can be useful to Git users new to Mercurial.
+  
+  Other Changes
+  -
+  
+  * When interactive revert is run against a revision other than the working
+directory parent, the diff shown is the diff to *apply* to the working
+directory, rather than the diff to *discard* from the working copy. This is
+in line with related user experiences with 'git' and appears to be less
+confusing with 'ui.interface=curses'.
+  
+  * Let 'hg rebase' avoid content-divergence by skipping obsolete changesets
+(and their descendants) when they are present in the rebase set along with
+one of their successors but none of their successors is in destination.
+  
+  * hgweb now displays phases of non-public changesets
+  
+  * The "HGPLAINEXCEPT" environment variable can now include "color" to allow
+automatic output colorization in otherwise automated environments.
+  
+  * A new unamend command in uncommit extension which undoes the effect of the
+amend command by creating a new changeset which was there before amend and
+moving the changes that were amended to the working directory.
+  
+  * A '--abort' flag to merge command to abort the ongoing merge.
+  
+  * An experimental flag '--rev' to 'hg branch' which can be used to change
+branch of changesets.
+  
+  Backwards Compatibility Changes
+  ===
+  
+  * "log --follow-first -rREV", which is deprecated, now follows the first
+parent of merge revisions from the specified "REV" just like "log --follow
+-rREV".
+  
+  * "log --follow -rREV FILE.." now follows file history across copies and
+renames.
+  
+  Bug Fixes
+  =
+  
+  Issue 5165
+  --
+  
+  Bookmark, whose name is longer than 255, can again be exchanged again between
+  4.4+ client and servers.
+  
+  Performance Improvements
+  
+  
+  * bundle2 read I/O throughput significantly increased.
+  
+  * Significant memory use reductions when reading from bundle2 bundles.
+  
+On the BSD repository, peak RSS during changegroup application decreased by
+~185 MB from ~752 MB to ~567 MB.
+  
+  API Changes
+  ===
+  
+  * bundlerepo.bundlerepository.bundle and
+bundlerepo.bundlerepository.bundlefile are now prefixed with an underscore.
+  
+  * Rename bundlerepo.bundlerepository.bundlefilespos to _cgfilespos.
+  
+  * dirstate no longer provides a 'dirs()' method.  To test for the existence 
of
+a directory in the dirstate, use 'dirstate.hasdir(dirname)'.
+  
+  * bundle2 parts are no longer seekable by default.
+  
+  * mapping does not contain all template resources. use context.resource() in
+template functions.
+  
+  * "text=False|True" option is dropped from the vfs interface because of 
Python
+3 compatibility issue. Use "util.tonativeeol/fromnativeeol()" to convert 
EOL
+manually.
+  
+  * wireproto.streamres.__init__ no longer accepts a "reader" argument. Use 

D4290: hghave: move from requiring the PYTHON3 env var to looking for `python3`

2018-08-29 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4cfd1eebe6aa: hghave: move from requiring the PYTHON3 env 
var to looking for `python3` (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4290?vs=10368=10654

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

AFFECTED FILES
  tests/hghave.py
  tests/test-check-py3-compat.t

CHANGE DETAILS

diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -27,7 +27,7 @@
   > -X hgdemandimport/demandimportpy2.py \
   > -X hgext/fsmonitor/pywatchman \
   > -X mercurial/thirdparty/cbor \
-  > | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py \
+  > | sed 's|\\|/|g' | xargs python3 contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
   contrib/python-zstandard/setup.py not using absolute_import
   contrib/python-zstandard/setup_zstd.py not using absolute_import
@@ -48,6 +48,6 @@
 
 #if py3exe py3pygments
   $ testrepohg files 'set:(**.py) and grep(pygments)' | sed 's|\\|/|g' \
-  > | xargs $PYTHON3 contrib/check-py3-compat.py \
+  > | xargs python3 contrib/check-py3-compat.py \
   > | sed 's/[0-9][0-9]*)$/*)/'
 #endif
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -631,7 +631,7 @@
 
 @check("py3exe", "a Python 3.x interpreter is available")
 def has_python3exe():
-return 'PYTHON3' in os.environ
+return matchoutput('python3 -V', br'^Python 3.(5|6|7|8|9)')
 
 @check("py3pygments", "Pygments available on Python 3.x")
 def has_py3pygments():



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


D4291: contrib: import the relnotes script from the release-tools repo

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Amended this to make test-check* happy.
  
diff --git a/contrib/relnotes b/contrib/relnotes
--- a/contrib/relnotes
+++ b/contrib/relnotes
@@ -40,9 +40,9 @@ rules = {
 r"(typo|hint|note|style:|correct doc)": -20,
 r"_": -10,
 r"(argument|absolute_import|attribute|assignment|mutable)": -15,
-
r"(unused|useless|unnecessary|duplicate|deprecated|naming|scope|True|False)": 
-10,
+r"(unused|useless|unnecessary|duplicate|deprecated|scope|True|False)": 
-10,
 r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
-r": (drop|remove|inherit|rename|simplify|inline)": -10,
+r": (drop|remove|inherit|rename|simplify|naming|inline)": -10,
 r"(docstring|document .* method)": -20,
 r"(factor|extract|prepare|split|replace| import)": -20,
 r": add.*(function|method|implementation|test|example)": -10,
@@ -175,6 +175,5 @@ def main():
 for d in sorted(apis):
 print(" * %s" % d)
 
-
 if __name__ == "__main__":
 main()

REPOSITORY
  rHG Mercurial

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

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


D4419: rename: return error status if any rename/copy failed

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5b92a717bfc1: rename: return error status if any 
rename/copy failed (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4419?vs=10647=10653

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-copy.t
  tests/test-rename.t

CHANGE DETAILS

diff --git a/tests/test-rename.t b/tests/test-rename.t
--- a/tests/test-rename.t
+++ b/tests/test-rename.t
@@ -71,6 +71,7 @@
 
   $ hg rename --after d1/a dummy
   d1/a: not recording move - dummy does not exist
+  [1]
 
 move a single file to an existing directory
 
@@ -268,6 +269,7 @@
   d2/b: not overwriting - file already committed
   ('hg rename --force' to replace the file by recording a rename)
   moving d1/d11/a1 to d2/d11/a1
+  [1]
   $ hg status -C
   A d2/a
 d1/a
@@ -338,6 +340,7 @@
   d1/b: not recording move - d2/d21/b does not exist
   d1/ba: not recording move - d2/d21/ba does not exist
   moving d1/d11/a1 to d2/d21/a1
+  [1]
   $ hg status -C
   A d2/d21/a
 d1/a
@@ -372,6 +375,7 @@
   $ hg rename d1/ba d1/ca
   d1/ca: not overwriting - file exists
   ('hg rename --after' to record the rename)
+  [1]
   $ hg status -C
   ? d1/ca
   $ hg update -C
@@ -396,6 +400,7 @@
   $ hg rename --traceback d1/ba d1/ca
   d1/ca: not overwriting - file exists
   ('hg rename --after' to record the rename)
+  [1]
   $ hg status -C
   ? d1/ca
   $ hg update -C
@@ -421,6 +426,7 @@
   $ hg rename d1/* d2/* d3
   moving d1/d11/a1 to d3/d11/a1
   d3/b: not overwriting - d2/b collides with d1/b
+  [1]
   $ hg status -C
   A d3/a
 d1/a
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -148,6 +148,7 @@
 copy --after to a nonexistent target filename
   $ hg cp -A foo dummy
   foo: not recording copy - dummy does not exist
+  [1]
 
 dry-run; should show that foo is clean
   $ hg copy --dry-run foo bar
@@ -225,11 +226,13 @@
   $ hg copy -A bar foo
   foo: not overwriting - file already committed
   ('hg copy --after --force' to replace the file by recording a copy)
+  [1]
 same error without the --after, so the user doesn't have to go through
 two hints:
   $ hg copy bar foo
   foo: not overwriting - file already committed
   ('hg copy --force' to replace the file by recording a copy)
+  [1]
 but it's considered modified after a copy --after --force
   $ hg copy -Af bar foo
   $ hg st -AC foo
@@ -241,5 +244,6 @@
   $ hg cp bar xyzzy
   xyzzy: not overwriting - file exists
   ('hg copy --after' to record the copy)
+  [1]
 
   $ cd ..
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1184,7 +1184,7 @@
 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
 (reltarget, repo.pathto(abssrc, cwd),
  repo.pathto(prevsrc, cwd)))
-return
+return True # report a failure
 
 # check for overwrites
 exists = os.path.lexists(target)
@@ -1194,7 +1194,7 @@
 repo.dirstate.normalize(abstarget)):
 if not rename:
 ui.warn(_("%s: can't copy - same file\n") % reltarget)
-return
+return True # report a failure
 exists = False
 samefile = True
 
@@ -1220,7 +1220,7 @@
 hint = _("('hg copy --after' to record the copy)\n")
 ui.warn(msg % reltarget)
 ui.warn(hint)
-return
+return True # report a failure
 
 if after:
 if not exists:
@@ -1230,7 +1230,7 @@
 else:
 ui.warn(_('%s: not recording copy - %s does not exist\n') %
 (relsrc, reltarget))
-return
+return True # report a failure
 elif not dryrun:
 try:
 if exists:



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


D4418: rename: emit hint about using --after consistently

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG534e451b6dda: rename: emit hint about using --after 
consistently (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4418?vs=10646=10652

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1254,6 +1254,10 @@
 else:
 ui.warn(_('%s: cannot copy - %s\n') %
 (relsrc, encoding.strtolocal(inst.strerror)))
+if rename:
+hint = _("('hg rename --after' to record the 
rename)\n")
+else:
+hint = _("('hg copy --after' to record the copy)\n")
 return True # report a failure
 
 if ui.verbose or not exact:
@@ -1371,9 +1375,6 @@
 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
 errors += 1
 
-if errors:
-ui.warn(_('(consider using --after)\n'))
-
 return errors != 0
 
 ## facility to let extension process additional data into an import patch



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


D4341: sparse: add local files to temporaryfiles if they exist out of sparse

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  gentle ping for review.

REPOSITORY
  rHG Mercurial

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

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


D4417: rename: quote hg commands in warnings

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcde75233c415: rename: quote hg commands in warnings 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4417?vs=10645=10651

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-copy.t
  tests/test-rename.t

CHANGE DETAILS

diff --git a/tests/test-rename.t b/tests/test-rename.t
--- a/tests/test-rename.t
+++ b/tests/test-rename.t
@@ -266,7 +266,7 @@
 
   $ hg rename d1/* d2
   d2/b: not overwriting - file already committed
-  (hg rename --force to replace the file by recording a rename)
+  ('hg rename --force' to replace the file by recording a rename)
   moving d1/d11/a1 to d2/d11/a1
   $ hg status -C
   A d2/a
@@ -371,7 +371,7 @@
   $ echo "ca" > d1/ca
   $ hg rename d1/ba d1/ca
   d1/ca: not overwriting - file exists
-  (hg rename --after to record the rename)
+  ('hg rename --after' to record the rename)
   $ hg status -C
   ? d1/ca
   $ hg update -C
@@ -395,7 +395,7 @@
   $ ln -s ba d1/ca
   $ hg rename --traceback d1/ba d1/ca
   d1/ca: not overwriting - file exists
-  (hg rename --after to record the rename)
+  ('hg rename --after' to record the rename)
   $ hg status -C
   ? d1/ca
   $ hg update -C
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -224,12 +224,12 @@
 Trying to copy on top of an existing file fails,
   $ hg copy -A bar foo
   foo: not overwriting - file already committed
-  (hg copy --after --force to replace the file by recording a copy)
+  ('hg copy --after --force' to replace the file by recording a copy)
 same error without the --after, so the user doesn't have to go through
 two hints:
   $ hg copy bar foo
   foo: not overwriting - file already committed
-  (hg copy --force to replace the file by recording a copy)
+  ('hg copy --force' to replace the file by recording a copy)
 but it's considered modified after a copy --after --force
   $ hg copy -Af bar foo
   $ hg st -AC foo
@@ -240,6 +240,6 @@
   $ touch xyzzy
   $ hg cp bar xyzzy
   xyzzy: not overwriting - file exists
-  (hg copy --after to record the copy)
+  ('hg copy --after' to record the copy)
 
   $ cd ..
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1207,17 +1207,17 @@
 else:
 flags = '--force'
 if rename:
-hint = _('(hg rename %s to replace the file by '
+hint = _("('hg rename %s' to replace the file by "
  'recording a rename)\n') % flags
 else:
-hint = _('(hg copy %s to replace the file by '
+hint = _("('hg copy %s' to replace the file by "
  'recording a copy)\n') % flags
 else:
 msg = _('%s: not overwriting - file exists\n')
 if rename:
-hint = _('(hg rename --after to record the rename)\n')
+hint = _("('hg rename --after' to record the 
rename)\n")
 else:
-hint = _('(hg copy --after to record the copy)\n')
+hint = _("('hg copy --after' to record the copy)\n")
 ui.warn(msg % reltarget)
 ui.warn(hint)
 return



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


D4361: zsh_completion: complete hg files

2018-08-29 Thread av6 (Anton Shestakov)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGad1c6bd3c676: zsh_completion: complete hg files (authored 
by av6, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D4361?vs=10536=10650#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4361?vs=10536=10650

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

AFFECTED FILES
  contrib/zsh_completion

CHANGE DETAILS

diff --git a/contrib/zsh_completion b/contrib/zsh_completion
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -631,6 +631,13 @@
   '*:revision:_hg_labels'
 }
 
+_hg_cmd_files() {
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
+  '(--rev -r)'{-r+,--rev=}'[search the repository as it is in 
REV]:revision:_hg_labels' \
+  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
+  '*:file:_hg_files'
+}
+
 _hg_cmd_forget() {
   _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \



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


D4360: zsh_completion: adjust usage of common options

2018-08-29 Thread av6 (Anton Shestakov)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd0dfdf263a20: zsh_completion: adjust usage of common 
options (authored by av6, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4360?vs=10535=10649

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

AFFECTED FILES
  contrib/zsh_completion

CHANGE DETAILS

diff --git a/contrib/zsh_completion b/contrib/zsh_completion
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -471,7 +471,7 @@
 }
 
 _hg_cmd_addremove() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts 
$_hg_subrepos_opts \
   '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity 
(0<=s<=100)]:similarity' \
   '*:unknown or missing files:_hg_addremove'
 }
@@ -803,7 +803,7 @@
 }
 
 _hg_cmd_remove() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts 
$_hg_subrepos_opts \
   '(--after -A)'{-A,--after}'[record delete for missing files]' \
   '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \
   '*:file:_hg_files'
@@ -870,7 +870,7 @@
 }
 
 _hg_cmd_serve() {
-  _arguments -s -S : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_subrepos_opts \
   '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write 
to]:log file:_files' \
   '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log 
file:_files' \
   '(--daemon -d)'{-d,--daemon}'[run server in background]' \
@@ -1046,7 +1046,7 @@
 }
 
 _hg_cmd_qfold() {
-  _arguments -s -S : $_hg_global_opts $_h_commit_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_commit_opts \
   '(--keep -k)'{-k,--keep}'[keep folded patch files]' \
   '(--force -f)'{-f,--force}'[overwrite any local changes]' \
   '--no-backup[do not save backup copies of files]' \
@@ -1084,7 +1084,7 @@
 }
 
 _hg_cmd_qnew() {
-  _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_date_user_opts 
$_hg_gitlike_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts 
$_hg_date_user_opts $_hg_gitlike_opts \
   ':patch:'
 }
 
@@ -1118,7 +1118,7 @@
 }
 
 _hg_cmd_qrefresh() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts 
$_hg_gitlike_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts 
$_hg_date_user_opts $_hg_gitlike_opts \
   '(--short -s)'{-s,--short}'[short refresh]' \
   '*:files:_hg_files'
 }
@@ -1194,7 +1194,7 @@
 
 # Rebase
 _hg_cmd_rebase() {
-  _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts 
$_hg_dryrun_opts  \
   '*'{-r+,--rev=}'[rebase these revisions]:revision:_hg_revrange' \
   '(--source -s --base -b)'{-s+,--source=}'[rebase the specified changeset and 
descendants]:revision:_hg_labels' \
   '(--source -s --base -b)'{-b+,--base=}'[rebase everything from branching 
point of specified changeset]:revision:_hg_labels' \
@@ -1241,7 +1241,7 @@
 
 # Purge
 _hg_cmd_purge() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--abort-on-err -a)'{-a,--abort-on-err}'[abort if an error occurs]' \
   '--all[purge ignored files too]' \
   '(--print -p)'{-p,--print}'[print filenames instead of deleting them]' \



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


D4419: rename: return error status if any rename/copy failed

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit accepted this revision.
pulkit added inline comments.

INLINE COMMENTS

> test-rename.t:343
>moving d1/d11/a1 to d2/d21/a1
> +  [1]
>$ hg status -C

Not sure how I feel about this one. There are few operations which succeed and 
few which does not.

REPOSITORY
  rHG Mercurial

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

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


D4418: rename: emit hint about using --after consistently

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit accepted this revision.
pulkit added a comment.


  Strange that there are no tests for this codepath.

REPOSITORY
  rHG Mercurial

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

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


D4361: zsh_completion: complete hg files

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Queued this and https://phab.mercurial-scm.org/D4360 as per spectral review. 
Many thanks!

INLINE COMMENTS

> spectral wrote in zsh_completion:636
> This is "search the repository as it is in REV" in my version 
> (https://phab.mercurial-scm.org/rHG545a3e6650cd8f7e19c0f0256082837a33bea029) 
> and at default head 
> (https://phab.mercurial-scm.org/rHG6f38284b23f426b55d9375919f63ab4bd0fa81c0)

I changed "revision" to "REV" in flight.

REPOSITORY
  rHG Mercurial

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

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


D4362: zsh_completion: complete merge tools for -t/--tool

2018-08-29 Thread spectral (Kyle Lippincott)
spectral accepted this revision.
spectral added inline comments.

INLINE COMMENTS

> zsh_completion:292
> +  _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools
> +  external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"})
> +  (( $#external_tools )) && _describe -t external_tools 'external merge 
> tools' external_tools

I'm slightly concerned this might give a false impression of what's available, 
listing things that I don't have installed, but I think this might be the best 
we can do at the moment - there doesn't appear to be a way to convince 
filemerge.py's _picktool to dump a list of them.

> zsh_completion:292
> +  _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools
> +  external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"})
> +  (( $#external_tools )) && _describe -t external_tools 'external merge 
> tools' external_tools

Do we need to uniquify this, or is zsh smart enough to do so?

REPOSITORY
  rHG Mercurial

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

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


D4361: zsh_completion: complete hg files

2018-08-29 Thread spectral (Kyle Lippincott)
spectral accepted this revision.
spectral added a comment.


  (Accept conditional on fixing/documenting the difference I noticed)

INLINE COMMENTS

> zsh_completion:636
> +  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
> +  '(--rev -r)'{-r+,--rev=}'[search the repository as it is in 
> revision]:revision:_hg_labels' \
> +  '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' 
> \

This is "search the repository as it is in REV" in my version 
(https://phab.mercurial-scm.org/rHG545a3e6650cd8f7e19c0f0256082837a33bea029) 
and at default head 
(https://phab.mercurial-scm.org/rHG6f38284b23f426b55d9375919f63ab4bd0fa81c0)

REPOSITORY
  rHG Mercurial

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

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


D4419: rename: return error status if any rename/copy failed

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Ever since 
https://phab.mercurial-scm.org/rHG447ea621e50e3eff380e863cf7f8ff71b2b9318e 
(copy: propagate errors properly, 2007-12-06),
  we have returned an error status if the source file did not
  exist. That commit did not return error status for any other errors,
  and it's unclear if that was on purpose or not. It seems to me like we
  should return an error in the other cases to, so that's what this
  patch does.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-copy.t
  tests/test-rename.t

CHANGE DETAILS

diff --git a/tests/test-rename.t b/tests/test-rename.t
--- a/tests/test-rename.t
+++ b/tests/test-rename.t
@@ -71,6 +71,7 @@
 
   $ hg rename --after d1/a dummy
   d1/a: not recording move - dummy does not exist
+  [1]
 
 move a single file to an existing directory
 
@@ -268,6 +269,7 @@
   d2/b: not overwriting - file already committed
   ('hg rename --force' to replace the file by recording a rename)
   moving d1/d11/a1 to d2/d11/a1
+  [1]
   $ hg status -C
   A d2/a
 d1/a
@@ -338,6 +340,7 @@
   d1/b: not recording move - d2/d21/b does not exist
   d1/ba: not recording move - d2/d21/ba does not exist
   moving d1/d11/a1 to d2/d21/a1
+  [1]
   $ hg status -C
   A d2/d21/a
 d1/a
@@ -372,6 +375,7 @@
   $ hg rename d1/ba d1/ca
   d1/ca: not overwriting - file exists
   ('hg rename --after' to record the rename)
+  [1]
   $ hg status -C
   ? d1/ca
   $ hg update -C
@@ -396,6 +400,7 @@
   $ hg rename --traceback d1/ba d1/ca
   d1/ca: not overwriting - file exists
   ('hg rename --after' to record the rename)
+  [1]
   $ hg status -C
   ? d1/ca
   $ hg update -C
@@ -421,6 +426,7 @@
   $ hg rename d1/* d2/* d3
   moving d1/d11/a1 to d3/d11/a1
   d3/b: not overwriting - d2/b collides with d1/b
+  [1]
   $ hg status -C
   A d3/a
 d1/a
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -148,6 +148,7 @@
 copy --after to a nonexistent target filename
   $ hg cp -A foo dummy
   foo: not recording copy - dummy does not exist
+  [1]
 
 dry-run; should show that foo is clean
   $ hg copy --dry-run foo bar
@@ -225,11 +226,13 @@
   $ hg copy -A bar foo
   foo: not overwriting - file already committed
   ('hg copy --after --force' to replace the file by recording a copy)
+  [1]
 same error without the --after, so the user doesn't have to go through
 two hints:
   $ hg copy bar foo
   foo: not overwriting - file already committed
   ('hg copy --force' to replace the file by recording a copy)
+  [1]
 but it's considered modified after a copy --after --force
   $ hg copy -Af bar foo
   $ hg st -AC foo
@@ -241,5 +244,6 @@
   $ hg cp bar xyzzy
   xyzzy: not overwriting - file exists
   ('hg copy --after' to record the copy)
+  [1]
 
   $ cd ..
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1184,7 +1184,7 @@
 ui.warn(_('%s: not overwriting - %s collides with %s\n') %
 (reltarget, repo.pathto(abssrc, cwd),
  repo.pathto(prevsrc, cwd)))
-return
+return True # report a failure
 
 # check for overwrites
 exists = os.path.lexists(target)
@@ -1194,7 +1194,7 @@
 repo.dirstate.normalize(abstarget)):
 if not rename:
 ui.warn(_("%s: can't copy - same file\n") % reltarget)
-return
+return True # report a failure
 exists = False
 samefile = True
 
@@ -1220,7 +1220,7 @@
 hint = _("('hg copy --after' to record the copy)\n")
 ui.warn(msg % reltarget)
 ui.warn(hint)
-return
+return True # report a failure
 
 if after:
 if not exists:
@@ -1230,7 +1230,7 @@
 else:
 ui.warn(_('%s: not recording copy - %s does not exist\n') %
 (relsrc, reltarget))
-return
+return True # report a failure
 elif not dryrun:
 try:
 if exists:



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


D4417: rename: quote hg commands in warnings

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think we usally use single quotes around hg commands in messages.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-copy.t
  tests/test-rename.t

CHANGE DETAILS

diff --git a/tests/test-rename.t b/tests/test-rename.t
--- a/tests/test-rename.t
+++ b/tests/test-rename.t
@@ -266,7 +266,7 @@
 
   $ hg rename d1/* d2
   d2/b: not overwriting - file already committed
-  (hg rename --force to replace the file by recording a rename)
+  ('hg rename --force' to replace the file by recording a rename)
   moving d1/d11/a1 to d2/d11/a1
   $ hg status -C
   A d2/a
@@ -371,7 +371,7 @@
   $ echo "ca" > d1/ca
   $ hg rename d1/ba d1/ca
   d1/ca: not overwriting - file exists
-  (hg rename --after to record the rename)
+  ('hg rename --after' to record the rename)
   $ hg status -C
   ? d1/ca
   $ hg update -C
@@ -395,7 +395,7 @@
   $ ln -s ba d1/ca
   $ hg rename --traceback d1/ba d1/ca
   d1/ca: not overwriting - file exists
-  (hg rename --after to record the rename)
+  ('hg rename --after' to record the rename)
   $ hg status -C
   ? d1/ca
   $ hg update -C
diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -224,12 +224,12 @@
 Trying to copy on top of an existing file fails,
   $ hg copy -A bar foo
   foo: not overwriting - file already committed
-  (hg copy --after --force to replace the file by recording a copy)
+  ('hg copy --after --force' to replace the file by recording a copy)
 same error without the --after, so the user doesn't have to go through
 two hints:
   $ hg copy bar foo
   foo: not overwriting - file already committed
-  (hg copy --force to replace the file by recording a copy)
+  ('hg copy --force' to replace the file by recording a copy)
 but it's considered modified after a copy --after --force
   $ hg copy -Af bar foo
   $ hg st -AC foo
@@ -240,6 +240,6 @@
   $ touch xyzzy
   $ hg cp bar xyzzy
   xyzzy: not overwriting - file exists
-  (hg copy --after to record the copy)
+  ('hg copy --after' to record the copy)
 
   $ cd ..
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1207,17 +1207,17 @@
 else:
 flags = '--force'
 if rename:
-hint = _('(hg rename %s to replace the file by '
+hint = _("('hg rename %s' to replace the file by "
  'recording a rename)\n') % flags
 else:
-hint = _('(hg copy %s to replace the file by '
+hint = _("('hg copy %s' to replace the file by "
  'recording a copy)\n') % flags
 else:
 msg = _('%s: not overwriting - file exists\n')
 if rename:
-hint = _('(hg rename --after to record the rename)\n')
+hint = _("('hg rename --after' to record the 
rename)\n")
 else:
-hint = _('(hg copy --after to record the copy)\n')
+hint = _("('hg copy --after' to record the copy)\n")
 ui.warn(msg % reltarget)
 ui.warn(hint)
 return



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


D4418: rename: emit hint about using --after consistently

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Both the code and the message for the case where the source file was
  missing was inconsistent with the other similar messages.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1254,6 +1254,10 @@
 else:
 ui.warn(_('%s: cannot copy - %s\n') %
 (relsrc, encoding.strtolocal(inst.strerror)))
+if rename:
+hint = _("('hg rename --after' to record the 
rename)\n")
+else:
+hint = _("('hg copy --after' to record the copy)\n")
 return True # report a failure
 
 if ui.verbose or not exact:
@@ -1371,9 +1375,6 @@
 if copyfile(abssrc, relsrc, targetpath(abssrc), exact):
 errors += 1
 
-if errors:
-ui.warn(_('(consider using --after)\n'))
-
 return errors != 0
 
 ## facility to let extension process additional data into an import patch



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


D4378: resolve: add a flag for the default behavior of re-merging

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  This patch lacks tests. Please add some tests.

REPOSITORY
  rHG Mercurial

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

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


[Bug 5974] New: Performance regression on discovery

2018-08-29 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5974

Bug ID: 5974
   Summary: Performance regression on discovery
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: lothiral...@gmail.com
CC: mercurial-devel@mercurial-scm.org

Our performance test suite has detected a recent regression on discovery:
http://perf.octobus.net/#/regressions

basic_commands.DiscoveryTimeSuite.time_debugdiscovery('pypy-2018-08-01',
'http', 'last-thousand', None) 2018-08-20 03:538547c859..c62184c6  1.73x  
473.488ms   821.188ms   
basic_commands.DiscoveryTimeSuite.time_debugdiscovery('pypy-2018-08-01',
'local', 'last-thousand', None)2018-08-20 03:538547c859..c62184c6 
1.93x   373.854ms   722.869ms   
basic_commands.DiscoveryTimeSuite.time_debugdiscovery('pypy-2018-08-01', 'ssh',
'last-thousand', None)  2018-08-20 03:538547c859..c62184c6  1.64x  
540.545ms   887.486ms

The bisect feature detected that 71d83b31
(https://phab.mercurial-scm.org/D4322) introduced the biggest regression. It
looks like https://phab.mercurial-scm.org/D4326 may have a benefit effect, but
we are waiting on the numbers to be sure.

Numbers might be long to obtain if the beginning of the series has a quadratic
lookup, that will slow down the performance suite a lot.

Our first analysis of the data seems to indicate that it's related to the
number of heads. Pypy is our test repository with the most heads and the
regression is not visible with repositories with 10 or 100 changesets missing.
The test that show the regression is our pypy reference repository - the last
1000 changesets.

The reference repository is available here:
https://static.octobus.net/asv/pypy-2018-08-01-reference.tar and the stripped
one is available here:
https://static.octobus.net/asv/pypy-2018-08-01-partial-last-hundred.tar

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


D4383: narrow: add server logic to send cg while widening without ellipsis

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> martinvonz wrote in narrowbundle2.py:319
> Can we not infer `widen` from `oldincludepats, oldincludepats != includepats, 
> excludepats`?

I tried that but test-narrow-acl.t fails. Also, this is the error trying to 
prevent which I added the `widen` kwarg to make sure clone operations does not 
go through that.

But, clones with narrowhgacl set will go through this code path.

I looked into fixing this traceback in past but was unable to fix it. Any 
pointer will be appreciated.

  --- /storage/pulkit/hg-committed/tests/test-narrow-acl.t
  +++ /storage/pulkit/hg-committed/tests/test-narrow-acl.t.err
  @@ -22,21 +22,98 @@
 adding changesets
 adding manifests
 adding file changes
  -  added 3 changesets with 2 changes to 2 files
  -  new changesets * (glob)
  -  updating to branch default
  -  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  +  added 0 changesets with 0 changes to 0 files
  +  transaction abort!
  +  rollback completed
  +  Traceback (most recent call last):
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/scmutil.py", line 
164, in callcatch
  +  return func()
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
350, in _runcatchfunc
  +  return _dispatch(req)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
987, in _dispatch
  +  cmdpats, cmdoptions)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
733, in runcommand
  +  ret = _runcommand(ui, options, cmd, d)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
995, in _runcommand
  +  return cmdfunc()
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/dispatch.py", line 
984, in 
  +  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/util.py", line 1532, 
in check
  +  return func(*args, **kwargs)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/util.py", line 1532, 
in check
  +  return func(*args, **kwargs)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/hgext/narrow/narrowcommands.py",
 line 137, in clonenarrowcmd
  +  return orig(ui, repo, *args, **pycompat.strkwargs(opts))
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/util.py", line 1532, 
in check
  +  return func(*args, **kwargs)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/commands.py", line 
1475, in clone
  +  shareopts=opts.get('shareopts'))
  +File "/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/hg.py", 
line 710, in clone
  +  streamclonerequested=stream)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/hgext/narrow/narrowcommands.py",
 line 132, in pullnarrow
  +  return orig(repo, *args, **kwargs)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/exchange.py", line 
1494, in pull
  +  _fullpullbundle2(repo, pullop)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/exchange.py", line 
1434, in _fullpullbundle2
  +  _pullbundle2(pullop)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/exchange.py", line 
1677, in _pullbundle2
  +  bundle2.processbundle(pullop.repo, bundle, op=op)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
460, in processbundle
  +  processparts(repo, op, unbundler)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
467, in processparts
  +  _processpart(op, part)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
534, in _processpart
  +  handler(op, part)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/bundle2.py", line 
2138, in handlephases
  +  phases.updatephases(op.repo.unfiltered(), op.gettransaction, 
headsbyphase)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/phases.py", line 
603, in updatephases
  +  heads = [c.node() for c in repo.set(revset, headsbyphase[phase])]
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/localrepo.py", line 
916, in set
  +  for r in self.revs(expr, *args):
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/localrepo.py", line 
905, in revs
  +  return m(self)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/revset.py", line 
2273, in mfunc
  +  return getset(repo, subset, tree, order)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/revset.py", line 
102, in getset
  +  return methods[x[0]](repo, subset, *x[1:], order=order)
  +File 
"/place/vartmp/hgtests.Hyf1ig/install/lib/python/mercurial/revset.py", 

D4377: resolve: make condition clearer, and able to handle a new flag

2018-08-29 Thread valentin.gatienbaron (Valentin Gatien-Baron)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3fec8aa9b454: resolve: make condition clearer, and able to 
handle a new flag (authored by valentin.gatienbaron, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4377?vs=10575=10644

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4558,7 +4558,7 @@
 all, mark, unmark, show, nostatus = \
 [opts.get(o) for o in flaglist]
 
-if (show and (mark or unmark)) or (mark and unmark):
+if len(list(filter(None, [show, mark, unmark]))) > 1:
 raise error.Abort(_("too many options specified"))
 if pats and all:
 raise error.Abort(_("can't specify --all and patterns"))



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


Re: [PATCH 01 of 11 V2] revlog: split constants into a new `revlogutils.constants` module

2018-08-29 Thread Gregory Szorc
On Mon, Aug 27, 2018 at 3:06 AM Boris Feld  wrote:

> # HG changeset patch
> # User Boris Feld 
> # Date 1534378093 -7200
> #  Thu Aug 16 02:08:13 2018 +0200
> # Node ID 1e8bf2a77cbdf8634afe8b987114fb33a6d5f8bd
> # Parent  72718abe3c8a9be89e62393efc18257cc71db802
> # EXP-Topic sparse-snapshot
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 1e8bf2a77cbd
> revlog: split constants into a new `revlogutils.constants` module
>

Queued this series, thanks.

I squashed parts 2-4 together so code archeology is easier.

I performed some minor commit message rewriting. And I inserted a blank
line after a long stanza in one of the patches.

Overall a nice refactor: this makes the delta logic much easier to follow.


>
> We want to split some logic out of the main revlog file (the delta
> computing
> logic).  However, this logic needs access to multiple constants related to
> the
> revlog. So we move all revlog related constants into a new module that
> could
> be imported from multiple places.
>
> We don't copy the file (preserving blame history) because there are only a
> few
> moving lines. Also, copying the file would result in annoying merge
> conflicts
> with ongoing work from others contributors.
>
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -28,6 +28,8 @@ allowsymbolimports = (
>  'mercurial.hgweb.request',
>  'mercurial.i18n',
>  'mercurial.node',
> +# for revlog to re-export constant to extensions
> +'mercurial.revlogutils.constants',
>  # for cffi modules to re-export pure functions
>  'mercurial.pure.base85',
>  'mercurial.pure.bdiff',
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -36,6 +36,26 @@ from .node import (
>  wdirrev,
>  )
>  from .i18n import _
> +from .revlogutils.constants import (
> +FLAG_GENERALDELTA,
> +FLAG_INLINE_DATA,
> +LIMIT_DELTA2TEXT,
> +REVIDX_DEFAULT_FLAGS,
> +REVIDX_ELLIPSIS,
> +REVIDX_EXTSTORED,
> +REVIDX_FLAGS_ORDER,
> +REVIDX_ISCENSORED,
> +REVIDX_KNOWN_FLAGS,
> +REVIDX_RAWTEXT_CHANGING_FLAGS,
> +REVLOGV0,
> +REVLOGV1,
> +REVLOGV1_FLAGS,
> +REVLOGV2,
> +REVLOGV2_FLAGS,
> +REVLOG_DEFAULT_FLAGS,
> +REVLOG_DEFAULT_FORMAT,
> +REVLOG_DEFAULT_VERSION,
> +)
>  from .thirdparty import (
>  attr,
>  )
> @@ -54,40 +74,31 @@ from .utils import (
>  stringutil,
>  )
>
> +# blanked usage of all the name to prevent pyflakes constraints
> +# We need these name available in the module for extensions.
> +REVLOGV0
> +REVLOGV1
> +REVLOGV2
> +FLAG_INLINE_DATA
> +FLAG_GENERALDELTA
> +REVLOG_DEFAULT_FLAGS
> +REVLOG_DEFAULT_FORMAT
> +REVLOG_DEFAULT_VERSION
> +REVLOGV1_FLAGS
> +REVLOGV2_FLAGS
> +REVIDX_ISCENSORED
> +REVIDX_ELLIPSIS
> +REVIDX_EXTSTORED
> +REVIDX_DEFAULT_FLAGS
> +REVIDX_FLAGS_ORDER
> +REVIDX_KNOWN_FLAGS
> +REVIDX_RAWTEXT_CHANGING_FLAGS
> +
>  parsers = policy.importmod(r'parsers')
>
>  # Aliased for performance.
>  _zlibdecompress = zlib.decompress
>
> -# revlog header flags
> -REVLOGV0 = 0
> -REVLOGV1 = 1
> -# Dummy value until file format is finalized.
> -# Reminder: change the bounds check in revlog.__init__ when this is
> changed.
> -REVLOGV2 = 0xDEAD
> -FLAG_INLINE_DATA = (1 << 16)
> -FLAG_GENERALDELTA = (1 << 17)
> -REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
> -REVLOG_DEFAULT_FORMAT = REVLOGV1
> -REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
> -REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
> -REVLOGV2_FLAGS = REVLOGV1_FLAGS
> -
> -# revlog index flags
> -REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be
> verified
> -REVIDX_ELLIPSIS = (1 << 14) # revision hash does not match data (narrowhg)
> -REVIDX_EXTSTORED = (1 << 13) # revision data is stored externally
> -REVIDX_DEFAULT_FLAGS = 0
> -# stable order in which flags need to be processed and their processors
> applied
> -REVIDX_FLAGS_ORDER = [
> -REVIDX_ISCENSORED,
> -REVIDX_ELLIPSIS,
> -REVIDX_EXTSTORED,
> -]
> -REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER)
> -# bitmark for flags that could cause rawdata content change
> -REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED
> -
>  # max size of revlog with inline data
>  _maxinline = 131072
>  _chunksize = 1048576
> @@ -854,9 +865,6 @@ class revlogoldindex(list):
>  return (0, 0, 0, -1, -1, -1, -1, nullid)
>  return list.__getitem__(self, i)
>
> -# maximum / ratio
> -LIMIT_DELTA2TEXT = 2
> -
>  class revlogoldio(object):
>  def __init__(self):
>  self.size = indexformatv0.size
> diff --git a/mercurial/revlogutils/__init__.py
> b/mercurial/revlogutils/__init__.py
> new file mode 100644
> diff --git a/mercurial/revlogutils/constants.py
> b/mercurial/revlogutils/constants.py
> new file mode 

Re: [PATCH 07 of 11 V2] revlogdelta: always return a delta info object in finddeltainfo

2018-08-29 Thread Gregory Szorc
On Mon, Aug 27, 2018 at 3:06 AM Boris Feld  wrote:

> # HG changeset patch
> # User Boris Feld 
> # Date 1534387137 -7200
> #  Thu Aug 16 04:38:57 2018 +0200
> # Node ID 2c73ef87329fd8f0a515dad9e2cd6de938615aa7
> # Parent  050101b1b6db5bb9a6d6e887ec3145f8bff4188b
> # EXP-Topic sparse-snapshot
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 2c73ef87329f
> revlogdelta: always return a delta info object in finddeltainfo
>
> Previously, the method returned `None` when a full snapshot was needed. The
> caller had to determine how to produce one itself.
>
> In practice, building a `_deltainfo` object for a full snapshot is simple.
> So
> we build it at the `finddeltainfo` level and always return a `_deltainfo`
> object.
>
> The caller can now simply process the `_deltainfo` return in all cases.
>
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1967,31 +1967,23 @@ class revlog(object):
>
>  deltainfo = deltacomputer.finddeltainfo(revinfo, fh)
>
> -if deltainfo is not None:
> -base = deltainfo.base
> -chainbase = deltainfo.chainbase
> -data = deltainfo.data
> -l = deltainfo.deltalen
> -else:
> -rawtext = deltacomputer.buildtext(revinfo, fh)
> -data = self.compress(rawtext)
> -l = len(data[1]) + len(data[0])
> -base = chainbase = curr
> -
> -e = (offset_type(offset, flags), l, textlen,
> - base, link, p1r, p2r, node)
> +e = (offset_type(offset, flags), deltainfo.deltalen, textlen,
> + deltainfo.base, link, p1r, p2r, node)
>  self.index.append(e)
>  self.nodemap[node] = curr
>
>  entry = self._io.packentry(e, self.node, self.version, curr)
> -self._writeentry(transaction, ifh, dfh, entry, data, link, offset)
> +self._writeentry(transaction, ifh, dfh, entry, deltainfo.data,
> + link, offset)
> +
> +rawtext = btext[0]
>

This line gave me trouble during review. But that's only because the
existing code is hard to follow (we pass an array around then possibly
replace its first element so we can later use it in a cache). I would
happily review a follow-up patch that explicitly returns the rawtext from a
called function instead of mutating an array as a side-effect.


>
>  if alwayscache and rawtext is None:
>  rawtext = deltacomputer.buildtext(revinfo, fh)
>
>  if type(rawtext) == bytes: # only accept immutable objects
>  self._cache = (node, curr, rawtext)
> -self._chainbasecache[curr] = chainbase
> +self._chainbasecache[curr] = deltainfo.chainbase
>  return node
>
>  def _writeentry(self, transaction, ifh, dfh, entry, data, link,
> offset):
> diff --git a/mercurial/revlogutils/deltas.py
> b/mercurial/revlogutils/deltas.py
> --- a/mercurial/revlogutils/deltas.py
> +++ b/mercurial/revlogutils/deltas.py
> @@ -691,6 +691,19 @@ class deltacomputer(object):
>chainbase, chainlen, compresseddeltalen,
>snapshotdepth)
>
> +def _fullsnapshotinfo(self, fh, revinfo):
> +curr = len(self.revlog)
> +rawtext = self.buildtext(revinfo, fh)
> +data = self.revlog.compress(rawtext)
> +compresseddeltalen = deltalen = dist = len(data[1]) + len(data[0])
> +deltabase = chainbase = curr
> +snapshotdepth = 0
> +chainlen = 1
> +
> +return _deltainfo(dist, deltalen, data, deltabase,
> +  chainbase, chainlen, compresseddeltalen,
> +  snapshotdepth)
> +
>  def finddeltainfo(self, revinfo, fh):
>  """Find an acceptable delta against a candidate revision
>
> @@ -700,15 +713,18 @@ class deltacomputer(object):
>
>  Returns the first acceptable candidate revision, as ordered by
>  _getcandidaterevs
> +
> +If no suitable deltabase is found, we return delta info for a full
> +snapshot.
>  """
>  if not revinfo.textlen:
> -return None # empty file do not need delta
> +return self._fullsnapshotinfo(fh, revinfo)
>
>  # no delta for flag processor revision (see "candelta" for why)
>  # not calling candelta since only one revision needs test, also to
>  # avoid overhead fetching flags again.
>  if revinfo.flags & REVIDX_RAWTEXT_CHANGING_FLAGS:
> -return None
> +return self._fullsnapshotinfo(fh, revinfo)
>
>  cachedelta = revinfo.cachedelta
>  p1 = revinfo.p1
> @@ -743,4 +759,6 @@ class deltacomputer(object):
>  deltainfo = min(nominateddeltas, key=lambda x: x.deltalen)
>  break
>
> +if deltainfo is None:
> +deltainfo = 

Re: [PATCH 01 of 10] shelve: move createcmd next to _docreatecmd

2018-08-29 Thread Pulkit Goyal
On Wed, Aug 29, 2018 at 7:30 PM Boris Feld  wrote:

> # HG changeset patch
> # User Boris Feld 
> # Date 1534978298 -7200
> #  Thu Aug 23 00:51:38 2018 +0200
> # Node ID 2127e141f56510b109f915c2fd5eaf3b205ce037
> # Parent  7775c1fb8fa0d67f16d4b3c89ce3aacd35074506
> # EXP-Topic internal-phase.shelve
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 2127e141f565
> shelve: move createcmd next to _docreatecmd
>
> It is simpler not to have to jump around the file all the time.
>

Queued the first three patches. Many thanks!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 4] test-help: add tests showing that sections can't be filtered by dotted name

2018-08-29 Thread Pulkit Goyal
On Wed, Aug 29, 2018 at 4:43 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1533440882 -32400
> #  Sun Aug 05 12:48:02 2018 +0900
> # Node ID a43d85dc663259467d20033cd6961d6d3c20bf4d
> # Parent  94a4980695f801b62b0af4fa576230a6170d1c0e
> test-help: add tests showing that sections can't be filtered by dotted name
>

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


D4416: copies: improve logic of deciding copytracing on based of config options

2018-08-29 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Few months ago or maybe a year ago, I imported Fb's heuristics based 
copytracing
  algorithms. While importing that, I renamed `experimental.disablecopytrace` 
with
  `experimental.copytrace` and the behavior of the new config option was like
  this:
  
  - "heuristics" : Fb's heuristic copytracing algorithm
  - "off" : copytracing is turned off
  - something else: copytracing is on
  
  This is the behavior right now also and this is bad because it hardcodes the
  string 'off' to turn off the copytracing. On big repositories, copytracing is
  very slow and people wants to turn copytracing off. However if the user sets 
it
  to 'False', 'Off', '0', none of them is going to disbale copytracing while 
they
  should.
  I lacked the understanding of why this can be bad when I coded it.
  
  After this patch, the new behavior of the config option will be:
  
  - "heuristics": Fb's heuristic copytracing algorithm
  - '0', 'false', 'off', 'never', 'no', 'NO', all the values which 
repo.ui.configbool() evaluates to False: copytracing in turned off
  - something else: copytracing is on
  
  Since 'off' still evaluates to copytracing being turned off, this is not BC.
  Also the config option is experimental.

REPOSITORY
  rHG Mercurial

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

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
@@ -365,20 +365,18 @@
 if c2.node() is None and c1.node() == repo.dirstate.p1():
 return repo.dirstate.copies(), {}, {}, {}, {}
 
-copytracing = repo.ui.config('experimental', 'copytrace')
-
 # Copy trace disabling is explicitly below the node == p1 logic above
 # because the logic above is required for a simple copy to be kept across a
 # rebase.
-if copytracing == 'off':
-return {}, {}, {}, {}, {}
-elif copytracing == 'heuristics':
+if repo.ui.config('experimental', 'copytrace') == 'heuristics':
 # Do full copytracing if only non-public revisions are involved as
 # that will be fast enough and will also cover the copies which could
 # be missed by heuristics
 if _isfullcopytraceable(repo, c1, base):
 return _fullcopytracing(repo, c1, c2, base)
 return _heuristicscopytracing(repo, c1, c2, base)
+elif not repo.ui.configbool('experimental', 'copytrace'):
+return {}, {}, {}, {}, {}
 else:
 return _fullcopytracing(repo, c1, c2, base)
 
@@ -871,7 +869,8 @@
 """
 exclude = {}
 if (skiprev is not None and
-repo.ui.config('experimental', 'copytrace') != 'off'):
+(repo.ui.config('experimental', 'copytrace') == 'heuristics' or
+ repo.ui.configbool('experimental', 'copytrace'))):
 # copytrace='off' skips this line, but not the entire function because
 # the line below is O(size of the repo) during a rebase, while the rest
 # of the function is much faster (and is required for carrying copy



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


[PATCH 08 of 10] shelve: add an "internal" extra

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528242397 -7200
#  Wed Jun 06 01:46:37 2018 +0200
# Node ID 5726fcca7837180c0f25ed345236625797725aa5
# Parent  95c87531a5cc2f5ee8efad0243bdcbe9a38d883a
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
5726fcca7837
shelve: add an "internal" extra

Keeping shelve changeset around increase the risk of collision with normal
changesets. To prevent such collision and help with overall clarity, we add an
'internal' key in extra that mark the changeset as created by "shelve".

Node changes in tests are expected.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -463,7 +463,7 @@ def _docreatecmd(ui, repo, pats, opts):
 
 name = getshelvename(repo, parent, opts)
 activebookmark = _backupactivebookmark(repo)
-extra = {}
+extra = {'internal': 'shelve'}
 if includeunknown:
 _includeunknownfiles(repo, pats, opts, extra)
 
@@ -751,7 +751,8 @@ def _commitworkingcopychanges(ui, repo, 
 return tmpwctx, addedbefore
 ui.status(_("temporarily committing pending changes "
 "(restore with 'hg unshelve --abort')\n"))
-commitfunc = getcommitfunc(extra=None, interactive=False,
+extra = {'internal': 'shelve'}
+commitfunc = getcommitfunc(extra=extra, interactive=False,
editor=False)
 tempopts = {}
 tempopts['message'] = "pending changes temporary commit"
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -387,11 +387,11 @@ ensure that we have a merge with unresol
   +++ b/a/a
   @@ -1,2 +1,6 @@
a
-  +<<< shelve:   562f7831e574 - shelve: pending changes temporary 
commit
+  +<<< shelve:   2377350b6337 - shelve: pending changes temporary 
commit
c
   +===
   +a
-  +>>> working-copy: 32c69314e062 - shelve: changes to: [mq]: second.patch
+  +>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
   diff --git a/b/b b/b.rename/b
   rename from b/b
   rename to b.rename/b
@@ -809,11 +809,11 @@ unshelve and conflicts with tracked and 
   M f
   ? f.orig
   $ cat f
-  <<< shelve:   5f6b880e719b - shelve: pending changes temporary commit
+  <<< shelve:   d44eae5c3d33 - shelve: pending changes temporary commit
   g
   ===
   f
-  >>> working-copy: 81152db69da7 - shelve: changes to: commit stuff
+  >>> working-copy: aef214a5229c - shelve: changes to: commit stuff
   $ cat f.orig
   g
   $ hg unshelve --abort -t false
@@ -855,7 +855,7 @@ unshelve and conflicts with tracked and 
   g
   ===
   f
-  >>> working-copy: 81152db69da7 - shelve: changes to: commit stuff
+  >>> working-copy: aef214a5229c - shelve: changes to: commit stuff
   $ cat f.orig
   g
   $ hg unshelve --abort
@@ -1117,7 +1117,7 @@ no general delta
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg debugbundle .hg/shelved/*.hg
-  45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
+  330882a04d2ce8487636b1fb292e5beea77fa1e3
   $ cd ..
 
 with general delta
@@ -1140,7 +1140,7 @@ with general delta
   $ hg debugbundle .hg/shelved/*.hg
   Stream params: {Compression: BZ}
   changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
-  45993d65fe9dc3c6d8764b9c3b07fa831ee7d92d
+  330882a04d2ce8487636b1fb292e5beea77fa1e3
   $ cd ..
 
 Test visibility of in-memory changes inside transaction to external hook
@@ -1195,15 +1195,15 @@ Test visibility of in-memory changes ins
   temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
    preupdate:
-  VISIBLE 6:66b86db80ee4
+  VISIBLE 6:54c00d20fb3f
   ACTUAL  5:703117a2acfb
   
    preupdate:
-  VISIBLE 8:92fdbb7b4de7
+  VISIBLE 8:8efe6f7537dc
   ACTUAL  5:703117a2acfb
   
    preupdate:
-  VISIBLE 6:66b86db80ee4
+  VISIBLE 6:54c00d20fb3f
   ACTUAL  5:703117a2acfb
   
 
@@ -1239,12 +1239,12 @@ Test visibility of in-memory changes ins
   temporarily committing pending changes (restore with 'hg unshelve --abort')
   rebasing shelved changes
    update:
-  VISIBLE 6:66b86db80ee4
-  VISIBLE 7:206bf5d4f922
+  VISIBLE 6:54c00d20fb3f
+  VISIBLE 7:492ed9d705e5
   ACTUAL  5:703117a2acfb
   
    update:
-  VISIBLE 6:66b86db80ee4
+  VISIBLE 6:54c00d20fb3f
   ACTUAL  5:703117a2acfb
   
    update:
@@ -1780,8 +1780,8 @@ putting v1 shelvedstate file in place of
   > ashelve
   > 8b058dae057a5a78f393f4535d9e363dd5efac9d
   > 8b058dae057a5a78f393f4535d9e363dd5efac9d
-  > 8b058dae057a5a78f393f4535d9e363dd5efac9d 
003d2d94241cc7aff0c3a148e966d6a4a377f3a7
-  > 003d2d94241cc7aff0c3a148e966d6a4a377f3a7
+  > 8b058dae057a5a78f393f4535d9e363dd5efac9d 
f543b27db2cdb41737e2e0008dc524c471da1446
+  > 

[PATCH 07 of 10] shelve: write metadata file on the fly if they are missing

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528240201 -7200
#  Wed Jun 06 01:10:01 2018 +0200
# Node ID 95c87531a5cc2f5ee8efad0243bdcbe9a38d883a
# Parent  e56dd355b971632ef95fbbf07445547ea6d30f88
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
95c87531a5cc
shelve: write metadata file on the fly if they are missing

Keeping an explicit reference to the shelve node in order to reuse it directly
if the unshelved is repeated (eg: unshelve --keep).

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -770,6 +770,11 @@ def _unshelverestorecommit(ui, repo, bas
 with ui.configoverride({('ui', 'quiet'): True}):
 shelvedfile(repo, basename, 'hg').applybundle()
 shelvectx = repo['tip']
+# We might no strip the unbundled changeset, so we should keep track of
+# the unshelve node in case we need to reuse it (eg: unshelve --keep)
+if node is None:
+info = {'node': nodemod.hex(node)}
+shelvedfile(repo, basename, 'shelve').writeinfo(info)
 else:
 shelvectx = repo[node]
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 09 of 10] shelve: use the internal phase when possible

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1527588738 -7200
#  Tue May 29 12:12:18 2018 +0200
# Node ID ccb9572516145a1b6f11a8d199c4a7da4774898b
# Parent  5726fcca7837180c0f25ed345236625797725aa5
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
ccb957251614
shelve: use the internal phase when possible

If the repository support it, use the internal phase for all changesets
created by shelve.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -140,11 +140,14 @@ class shelvedfile(object):
 def applybundle(self):
 fp = self.opener()
 try:
+targetphase = phases.internal
+if not phases.supportinternal(self.repo):
+targetphase = phases.secret
 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs)
 bundle2.applybundle(self.repo, gen, self.repo.currenttransaction(),
 source='unshelve',
 url='bundle:' + self.vfs.join(self.fname),
-targetphase=phases.secret)
+targetphase=targetphase)
 finally:
 fp.close()
 
@@ -380,7 +383,11 @@ def getcommitfunc(extra, interactive, ed
 hasmq = util.safehasattr(repo, 'mq')
 if hasmq:
 saved, repo.mq.checkapplied = repo.mq.checkapplied, False
-overrides = {('phases', 'new-commit'): phases.secret}
+
+targetphase = phases.internal
+if not phases.supportinternal(repo):
+targetphase = phases.secret
+overrides = {('phases', 'new-commit'): targetphase}
 try:
 editor_ = False
 if editor:
@@ -702,7 +709,10 @@ def unshelvecontinue(ui, repo, state, op
 repo.setparents(state.pendingctx.node(), nodemod.nullid)
 repo.dirstate.write(repo.currenttransaction())
 
-overrides = {('phases', 'new-commit'): phases.secret}
+targetphase = phases.internal
+if not phases.supportinternal(repo):
+targetphase = phases.secret
+overrides = {('phases', 'new-commit'): targetphase}
 with repo.ui.configoverride(overrides, 'unshelve'):
 with repo.dirstate.parentchange():
 repo.setparents(state.parents[0], nodemod.nullid)
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1,3 +1,5 @@
+#testcases stripbased phasebased
+
   $ cat <> $HGRCPATH
   > [extensions]
   > mq =
@@ -9,6 +11,15 @@
   > maxbackups = 2
   > EOF
 
+#if phasebased
+
+  $ cat <> $HGRCPATH
+  > [format]
+  > internal-phase = yes
+  > EOF
+
+#endif
+
   $ hg init repo
   $ cd repo
   $ mkdir a b
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 04 of 10] shelve: store shelved node in a new data file

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1527587252 -7200
#  Tue May 29 11:47:32 2018 +0200
# Node ID 86fcd2d7daee18e9c4a515532b9e2fbfa9f16214
# Parent  3ecb8506e6cc8e411526d32888b9b4dfbdb40e04
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
86fcd2d7daee
shelve: store shelved node in a new data file

It is useful for a version of shelve not based on bundle and strip. Having
more data does not hurt the bundle based case so we introduce it in all cases
before doing more rework.

We also keep storing the patch using another method.

note: We could have this metadata file list all the file involved in the
shelve and use that for cleanup. This would be more future proof than having a
hard-coded list of file to purge. However, this is an adventure for another
series.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -79,7 +79,7 @@ configitem('shelve', 'maxbackups',
 
 backupdir = 'shelve-backup'
 shelvedir = 'shelved'
-shelvefileextensions = ['hg', 'patch']
+shelvefileextensions = ['hg', 'patch', 'shelve']
 # universal extension is present in all types of shelves
 patchextension = 'patch'
 
@@ -409,6 +409,8 @@ def _nothingtoshelvemessaging(ui, repo, 
 ui.status(_("nothing changed\n"))
 
 def _shelvecreatedcommit(repo, node, name):
+info = {'node': nodemod.hex(node)}
+shelvedfile(repo, name, 'shelve').writeinfo(info)
 bases = list(mutableancestors(repo[node]))
 shelvedfile(repo, name, 'hg').writebundle(bases, node)
 with shelvedfile(repo, name, patchextension).opener('wb') as fp:
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -102,6 +102,7 @@ make sure shelve files were backed up
   $ ls .hg/shelve-backup
   default.hg
   default.patch
+  default.shelve
 
 checks to make sure we dont create a directory or
 hidden file while choosing a new shelve name
@@ -206,8 +207,10 @@ ensure shelve backups aren't overwritten
   $ ls .hg/shelve-backup/
   default-1.hg
   default-1.patch
+  default-1.shelve
   default.hg
   default.patch
+  default.shelve
 
 local edits should not prevent a shelved change from applying
 
@@ -250,10 +253,13 @@ is difficult to decide actual order of t
   $ ls .hg/shelve-backup/
   default-01.hg
   default-01.patch
+  default-01.shelve
   default-1.hg
   default-1.patch
+  default-1.shelve
   default.hg
   default.patch
+  default.shelve
 
   $ hg unshelve
   abort: no shelved changes to apply!
@@ -314,8 +320,10 @@ ensure old shelve backups are being dele
   $ ls .hg/shelve-backup/
   default-01.hg
   default-01.patch
+  default-01.shelve
   wibble.hg
   wibble.patch
+  wibble.shelve
 
 cause unshelving to result in a merge with 'a' conflicting
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 10 of 10] shelve: no longer strip internal commit when using internal phase

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528245106 -7200
#  Wed Jun 06 02:31:46 2018 +0200
# Node ID 18e2c4986d32aed2f10948277ba5dc1133f19f00
# Parent  ccb9572516145a1b6f11a8d199c4a7da4774898b
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
18e2c4986d32
shelve: no longer strip internal commit when using internal phase

If the internal phase is available, the internal commit we create will be
automatically hidden and we don't need to strip them. Avoiding strip gives
much better performances and is less traumatic for caches.

Test changes are all related to revision number increasing more quickly since
we avoid stripping.

note: The hidden internal commit confuses rebase a bit as shown by a new test
added. This will happen when the user have shelve commits on top of a
changeset to be rebased.

As we still use a backup bundle, we could probably just let rebase strip the
internal changeset and be fine. The case will be improved in a later series.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -432,7 +432,14 @@ def _includeunknownfiles(repo, pats, opt
 repo[None].add(s.unknown)
 
 def _finishshelve(repo):
-_aborttransaction(repo)
+if phases.supportinternal(repo):
+backupname = 'dirstate.shelve'
+tr = repo.currenttransaction()
+repo.dirstate.savebackup(tr, backupname)
+tr.close()
+repo.dirstate.restorebackup(None, backupname)
+else:
+_aborttransaction(repo)
 
 def createcmd(ui, repo, pats, opts):
 """subcommand that creates a new shelve"""
@@ -650,8 +657,9 @@ def unshelveabort(ui, repo, state, opts)
 rebase.clearstatus(repo)
 
 mergefiles(ui, repo, state.wctx, state.pendingctx)
-repair.strip(ui, repo, state.nodestoremove, backup=False,
- topic='shelve')
+if not phases.supportinternal(repo):
+repair.strip(ui, repo, state.nodestoremove, backup=False,
+ topic='shelve')
 finally:
 shelvedstate.clear(repo)
 ui.warn(_("unshelve of '%s' aborted\n") % state.name)
@@ -744,8 +752,9 @@ def unshelvecontinue(ui, repo, state, op
 mergefiles(ui, repo, state.wctx, shelvectx)
 restorebranch(ui, repo, state.branchtorestore)
 
-repair.strip(ui, repo, state.nodestoremove, backup=False,
- topic='shelve')
+if not phases.supportinternal(repo):
+repair.strip(ui, repo, state.nodestoremove, backup=False,
+ topic='shelve')
 _restoreactivebookmark(repo, state.activebookmark)
 shelvedstate.clear(repo)
 unshelvecleanup(ui, repo, state.name, opts)
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -380,12 +380,24 @@ force a conflicted merge to occur
 
 ensure that we have a merge with unresolved conflicts
 
+#if phasebased
+  $ hg heads -q --template '{rev}\n'
+  8
+  5
+  $ hg parents -q --template '{rev}\n'
+  8
+  5
+#endif
+
+#if stripbased
   $ hg heads -q --template '{rev}\n'
   5
   4
   $ hg parents -q --template '{rev}\n'
   4
   5
+#endif
+
   $ hg status
   M a/a
   M b.rename/b
@@ -428,10 +440,11 @@ abort the unshelve and be happy
   $ hg unshelve -a
   unshelve of 'default' aborted
   $ hg heads -q
-  3:2e69b451d1ea
+  [37]:2e69b451d1ea (re)
   $ hg parents
-  changeset:   3:2e69b451d1ea
+  changeset:   [37]:2e69b451d1ea (re)
   tag: tip
+  parent:  3:509104101065 (?)
   user:test
   date:Thu Jan 01 00:00:00 1970 +
   summary: second
@@ -484,14 +497,15 @@ attempt to continue
 ensure the repo is as we hope
 
   $ hg parents
-  changeset:   3:2e69b451d1ea
+  changeset:   [37]:2e69b451d1ea (re)
   tag: tip
+  parent:  3:509104101065 (?)
   user:test
   date:Thu Jan 01 00:00:00 1970 +
   summary: second
   
   $ hg heads -q
-  3:2e69b451d1ea
+  [37]:2e69b451d1ea (re)
 
   $ hg status -C
   A b.rename/b
@@ -551,7 +565,7 @@ if we resolve a conflict while unshelvin
   rebasing shelved changes
   merging a/a
   $ hg parents -q
-  4:33f7f61e6c5e
+  (4|13):33f7f61e6c5e (re)
   $ hg shelve -l
   default (*)* changes to: second (glob)
   $ hg status
@@ -574,7 +588,7 @@ if we resolve a conflict while unshelvin
   merging a/a
   note: unshelved changes already existed in the working copy
   $ hg parents -q
-  4:33f7f61e6c5e
+  (4|13):33f7f61e6c5e (re)
   $ hg shelve -l
   $ hg status
   A foo/foo
@@ -611,16 +625,16 @@ test bookmarks
 
   $ hg bookmark test
   $ hg bookmark
-   * test  4:33f7f61e6c5e
+   \* test  (4|13):33f7f61e6c5e (re)
   $ hg shelve
   shelved as test
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg bookmark
-  

[PATCH 06 of 10] shelve: look for shelved not in the repository before unbundling

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528239442 -7200
#  Wed Jun 06 00:57:22 2018 +0200
# Node ID e56dd355b971632ef95fbbf07445547ea6d30f88
# Parent  a000c7acde68b242548a33f08aa7b84c303f197e
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
e56dd355b971
shelve: look for shelved not in the repository before unbundling

This prepares the version of shelve that would not strip the shelved node from
the repository. If we have the node information, search for it in the
repository and only fallback on unbundling if it is missing.

To be able to find such nodes, we operate on an unfiltered repository.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -764,9 +764,15 @@ def _commitworkingcopychanges(ui, repo, 
 def _unshelverestorecommit(ui, repo, basename):
 """Recreate commit in the repository during the unshelve"""
 repo = repo.unfiltered()
-with ui.configoverride({('ui', 'quiet'): True}):
-shelvedfile(repo, basename, 'hg').applybundle()
+if shelvedfile(repo, basename, 'shelve').exists():
+node = shelvedfile(repo, basename, 'shelve').readinfo()['node']
+if node is None or node not in repo:
+with ui.configoverride({('ui', 'quiet'): True}):
+shelvedfile(repo, basename, 'hg').applybundle()
 shelvectx = repo['tip']
+else:
+shelvectx = repo[node]
+
 return repo, shelvectx
 
 def _rebaserestoredcommit(ui, repo, opts, tr, oldtiprev, basename, pctx,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 02 of 10] shelve: rename method for data write/read

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1527586840 -7200
#  Tue May 29 11:40:40 2018 +0200
# Node ID 748143aab3d4ed04d1837a43a58f8d64e0cf6709
# Parent  2127e141f56510b109f915c2fd5eaf3b205ce037
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
748143aab3d4
shelve: rename method for data write/read

There are no user of this code nor any code related to obsshelve in the
extensions right now, so we rename the function before using them.

Note: The shelvedfile looks a bit strange. We should probably refactor it,
however, this is an adventure for another series.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -168,10 +168,10 @@ class shelvedfile(object):
 bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs,
 compression=compression)
 
-def writeobsshelveinfo(self, info):
+def writeinfo(self, info):
 scmutil.simplekeyvaluefile(self.vfs, self.fname).write(info)
 
-def readobsshelveinfo(self):
+def readinfo(self):
 return scmutil.simplekeyvaluefile(self.vfs, self.fname).read()
 
 class shelvedstate(object):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 01 of 10] shelve: move createcmd next to _docreatecmd

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1534978298 -7200
#  Thu Aug 23 00:51:38 2018 +0200
# Node ID 2127e141f56510b109f915c2fd5eaf3b205ce037
# Parent  7775c1fb8fa0d67f16d4b3c89ce3aacd35074506
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
2127e141f565
shelve: move createcmd next to _docreatecmd

It is simpler not to have to jump around the file all the time.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -323,12 +323,6 @@ def _aborttransaction(repo):
 narrowspec.restorebackup(repo, narrowspecbackupname)
 repo.dirstate.restorebackup(None, dirstatebackupname)
 
-def createcmd(ui, repo, pats, opts):
-"""subcommand that creates a new shelve"""
-with repo.wlock():
-cmdutil.checkunfinished(repo)
-return _docreatecmd(ui, repo, pats, opts)
-
 def getshelvename(repo, parent, opts):
 """Decide on the name this shelve is going to have"""
 def gennames():
@@ -430,6 +424,12 @@ def _includeunknownfiles(repo, pats, opt
 def _finishshelve(repo):
 _aborttransaction(repo)
 
+def createcmd(ui, repo, pats, opts):
+"""subcommand that creates a new shelve"""
+with repo.wlock():
+cmdutil.checkunfinished(repo)
+return _docreatecmd(ui, repo, pats, opts)
+
 def _docreatecmd(ui, repo, pats, opts):
 wctx = repo[None]
 parents = wctx.parents()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 10] shelve: drop mention of obsshelve file

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528238904 -7200
#  Wed Jun 06 00:48:24 2018 +0200
# Node ID 3ecb8506e6cc8e411526d32888b9b4dfbdb40e04
# Parent  748143aab3d4ed04d1837a43a58f8d64e0cf6709
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
3ecb8506e6cc
shelve: drop mention of obsshelve file

Core shelve extension does not use obsolescence, we clean up this unused file
before adding a new info file.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -79,7 +79,7 @@ configitem('shelve', 'maxbackups',
 
 backupdir = 'shelve-backup'
 shelvedir = 'shelved'
-shelvefileextensions = ['hg', 'patch', 'oshelve']
+shelvefileextensions = ['hg', 'patch']
 # universal extension is present in all types of shelves
 patchextension = 'patch'
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 05 of 10] shelve: handle shelved node on unfiltered repository

2018-08-29 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1528239790 -7200
#  Wed Jun 06 01:03:10 2018 +0200
# Node ID a000c7acde68b242548a33f08aa7b84c303f197e
# Parent  86fcd2d7daee18e9c4a515532b9e2fbfa9f16214
# EXP-Topic internal-phase.shelve
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
a000c7acde68
shelve: handle shelved node on unfiltered repository

To build a version of shelve that use hiding instead of stripping, we need
shelve to be able to find these revisions. This it does not hurt the bundle
version, so we introduce the necessary code in the relevant place.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -160,10 +160,11 @@ class shelvedfile(object):
 btype = 'HG20'
 compression = 'BZ'
 
-outgoing = discovery.outgoing(self.repo, missingroots=bases,
+repo = self.repo.unfiltered()
+
+outgoing = discovery.outgoing(repo, missingroots=bases,
   missingheads=[node])
-cg = changegroup.makechangegroup(self.repo, outgoing, cgversion,
- 'shelve')
+cg = changegroup.makechangegroup(repo, outgoing, cgversion, 'shelve')
 
 bundle2.writebundle(self.ui, cg, self.fname, btype, self.vfs,
 compression=compression)
@@ -762,6 +763,7 @@ def _commitworkingcopychanges(ui, repo, 
 
 def _unshelverestorecommit(ui, repo, basename):
 """Recreate commit in the repository during the unshelve"""
+repo = repo.unfiltered()
 with ui.configoverride({('ui', 'quiet'): True}):
 shelvedfile(repo, basename, 'hg').applybundle()
 shelvectx = repo['tip']
@@ -961,6 +963,7 @@ def _dounshelve(ui, repo, *shelved, **op
 if not shelvedfile(repo, basename, patchextension).exists():
 raise error.Abort(_("shelved change '%s' not found") % basename)
 
+repo = repo.unfiltered()
 lock = tr = None
 try:
 lock = repo.lock()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4409: rebase: skip *all* obsolete revisions, just warn about divergence

2018-08-29 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  Changing the behavior of `--src` to ignore obsolete and orphan unrelated to 
the destination seems like a good idea.
  
  However, this change seems to also affect `--rev`. The `--rev` allow for a 
precise selection of what the user wants to see rebased and it feels like we 
should stick to the user wishes here. Dropping explicitly selected revisions 
feels wrong and will make some use cases harder to perform.

REPOSITORY
  rHG Mercurial

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

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


[PATCH 1 of 4] test-help: add tests showing that sections can't be filtered by dotted name

2018-08-29 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1533440882 -32400
#  Sun Aug 05 12:48:02 2018 +0900
# Node ID a43d85dc663259467d20033cd6961d6d3c20bf4d
# Parent  94a4980695f801b62b0af4fa576230a6170d1c0e
test-help: add tests showing that sections can't be filtered by dotted name

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1340,6 +1340,68 @@ Test repeated config section name
   "smtp.host"
   Host name of mail server, e.g. "mail.example.com".
   
+
+Test section name with dot
+
+  $ hg help config.ui.username
+  "auth.username"
+  Optional. Username to authenticate with. If not given, and the remote
+  site requires basic or digest authentication, the user will be
+  prompted for it. Environment variables are expanded in the username
+  letting you do "foo.username = $USER". If the URI includes a 
username,
+  only "[auth]" entries with a matching username or without a username
+  will be considered.
+  
+  "smtp.username"
+  Optional. User name for authenticating with the SMTP server. 
(default:
+  None)
+  
+  "ui.username"
+  The committer of a changeset created when running "commit". Typically
+  a person's name and email address, e.g. "Fred Widget
+  ". Environment variables in the username are
+  expanded.
+  
+  (default: "$EMAIL" or "username@hostname". If the username in hgrc is
+  empty, e.g. if the system admin set "username =" in the system hgrc,
+  it has to be specified manually or in a different hgrc file)
+  
+
+  $ hg help config.annotate.git
+  "diff.git"
+  Use git extended diff format.
+  
+
+  $ hg help config.update.check
+  "merge-tools.check"
+A list of merge success-checking options:
+  
+"changed"
+  Ask whether merge was successful when the merged file shows no
+  changes.
+  
+"conflicts"
+  Check whether there are conflicts even though the tool reported
+  success.
+  
+"prompt"
+  Always prompt for merge success, regardless of success reported by
+  tool.
+  
+
+  $ hg help config.commands.update.check
+  "commands.update.check"
+  Determines what level of checking 'hg update' will perform before
+  moving to a destination revision. Valid values are "abort", "none",
+  "linear", and "noconflict". "abort" always fails if the working
+  directory has uncommitted changes. "none" performs no checking, and
+  may result in a merge with uncommitted changes. "linear" allows any
+  update as long as it follows a straight line in the revision history,
+  and may trigger a merge with uncommitted changes. "noconflict" will
+  allow any update which would not trigger a merge with uncommitted
+  changes, if any are present. (default: "linear")
+  
+
 Unrelated trailing paragraphs shouldn't be included
 
   $ hg help config.extramsg | grep '^$'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4] help: rewrite parsing of help topic to not drop section name with dots

2018-08-29 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1533440530 -32400
#  Sun Aug 05 12:42:10 2018 +0900
# Node ID 656e548c9349e1e98e166a67a7a6193e237ca613
# Parent  a43d85dc663259467d20033cd6961d6d3c20bf4d
help: rewrite parsing of help topic to not drop section name with dots

A subtopic is no longer lowercased since it should be considered a part of
a topic path, not a section filter.

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -642,8 +642,8 @@ def help_(ui, commands, name, unknowncmd
 
 return ''.join(rst)
 
-def formattedhelp(ui, commands, name, keep=None, unknowncmd=False, full=True,
-  **opts):
+def formattedhelp(ui, commands, fullname, keep=None, unknowncmd=False,
+  full=True, **opts):
 """get help for a given topic (as a dotted name) as rendered rst
 
 Either returns the rendered help text or raises an exception.
@@ -652,19 +652,17 @@ def formattedhelp(ui, commands, name, ke
 keep = []
 else:
 keep = list(keep) # make a copy so we can mutate this later
-fullname = name
-section = None
-subtopic = None
-if name and '.' in name:
-name, remaining = name.split('.', 1)
-remaining = encoding.lower(remaining)
-if '.' in remaining:
-subtopic, section = remaining.split('.', 1)
-else:
-if name in subtopics:
-subtopic = remaining
-else:
-section = remaining
+
+#  := [.]
+name = subtopic = section = None
+if fullname is not None:
+nameparts = fullname.split('.')
+name = nameparts.pop(0)
+if nameparts and name in subtopics:
+subtopic = nameparts.pop(0)
+if nameparts:
+section = encoding.lower('.'.join(nameparts))
+
 textwidth = ui.configint('ui', 'textwidth')
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1344,52 +1344,14 @@ Test repeated config section name
 Test section name with dot
 
   $ hg help config.ui.username
-  "auth.username"
-  Optional. Username to authenticate with. If not given, and the remote
-  site requires basic or digest authentication, the user will be
-  prompted for it. Environment variables are expanded in the username
-  letting you do "foo.username = $USER". If the URI includes a 
username,
-  only "[auth]" entries with a matching username or without a username
-  will be considered.
-  
-  "smtp.username"
-  Optional. User name for authenticating with the SMTP server. 
(default:
-  None)
-  
-  "ui.username"
-  The committer of a changeset created when running "commit". Typically
-  a person's name and email address, e.g. "Fred Widget
-  ". Environment variables in the username are
-  expanded.
-  
-  (default: "$EMAIL" or "username@hostname". If the username in hgrc is
-  empty, e.g. if the system admin set "username =" in the system hgrc,
-  it has to be specified manually or in a different hgrc file)
-  
+  abort: help section not found: config.ui.username
+  [255]
 
   $ hg help config.annotate.git
-  "diff.git"
-  Use git extended diff format.
-  
+  abort: help section not found: config.annotate.git
+  [255]
 
   $ hg help config.update.check
-  "merge-tools.check"
-A list of merge success-checking options:
-  
-"changed"
-  Ask whether merge was successful when the merged file shows no
-  changes.
-  
-"conflicts"
-  Check whether there are conflicts even though the tool reported
-  success.
-  
-"prompt"
-  Always prompt for merge success, regardless of success reported by
-  tool.
-  
-
-  $ hg help config.commands.update.check
   "commands.update.check"
   Determines what level of checking 'hg update' will perform before
   moving to a destination revision. Valid values are "abort", "none",
@@ -1402,6 +1364,10 @@ Test section name with dot
   changes, if any are present. (default: "linear")
   
 
+  $ hg help config.commands.update.check
+  abort: help section not found: config.commands.update.check
+  [255]
+
 Unrelated trailing paragraphs shouldn't be included
 
   $ hg help config.extramsg | grep '^$'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 4] minirst: filter blocks by full path to section

2018-08-29 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1533443644 -32400
#  Sun Aug 05 13:34:04 2018 +0900
# Node ID 67e8a8521cb22163ad42ae99ee27960b8f539fc7
# Parent  1089fe141b360764d5a413ea87f382a22f898499
minirst: filter blocks by full path to section

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -678,7 +678,11 @@ def format(text, width=80, indent=0, kee
 return formatplain(blocks, width=width)
 
 def filtersections(blocks, section):
-"""Select parsed blocks under the specified section"""
+"""Select parsed blocks under the specified section
+
+The section name is separated by a dot, and matches the suffix of the
+full section path.
+"""
 parents = []
 sections = _getsections(blocks)
 blocks = []
@@ -687,10 +691,10 @@ def filtersections(blocks, section):
 synthetic = []
 collapse = True
 while i < len(sections):
-name, nest, b = sections[i]
+path, nest, b = sections[i]
 del parents[nest:]
 parents.append(i)
-if name == section:
+if path == section or path.endswith('.' + section):
 if lastparents != parents:
 llen = len(lastparents)
 plen = len(parents)
@@ -729,8 +733,9 @@ def filtersections(blocks, section):
 return blocks
 
 def _getsections(blocks):
-'''return a list of (section name, nesting level, blocks) tuples'''
+'''return a list of (section path, nesting level, blocks) tuples'''
 nest = ""
+names = ()
 level = 0
 secs = []
 
@@ -751,7 +756,8 @@ def _getsections(blocks):
 nest += i
 level = nest.index(i) + 1
 nest = nest[:level]
-secs.append((getname(b), level, [b]))
+names = names[:level] + (getname(b),)
+secs.append(('.'.join(names), level, [b]))
 elif b['type'] in ('definition', 'field'):
 i = ' '
 if i not in nest:
@@ -772,7 +778,8 @@ def _getsections(blocks):
 elif siblingindent == indent:
 level = sec[1]
 break
-secs.append((getname(b), level, [b]))
+names = names[:level] + (getname(b),)
+secs.append(('.'.join(names), level, [b]))
 else:
 if not secs:
 # add an initial empty section
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1344,8 +1344,16 @@ Test repeated config section name
 Test section name with dot
 
   $ hg help config.ui.username
-  abort: help section not found: config.ui.username
-  [255]
+  "ui.username"
+  The committer of a changeset created when running "commit". Typically
+  a person's name and email address, e.g. "Fred Widget
+  ". Environment variables in the username are
+  expanded.
+  
+  (default: "$EMAIL" or "username@hostname". If the username in hgrc is
+  empty, e.g. if the system admin set "username =" in the system hgrc,
+  it has to be specified manually or in a different hgrc file)
+  
 
   $ hg help config.annotate.git
   abort: help section not found: config.annotate.git
@@ -1365,7 +1373,20 @@ Test section name with dot
   
 
   $ hg help config.commands.update.check
-  abort: help section not found: config.commands.update.check
+  "commands.update.check"
+  Determines what level of checking 'hg update' will perform before
+  moving to a destination revision. Valid values are "abort", "none",
+  "linear", and "noconflict". "abort" always fails if the working
+  directory has uncommitted changes. "none" performs no checking, and
+  may result in a merge with uncommitted changes. "linear" allows any
+  update as long as it follows a straight line in the revision history,
+  and may trigger a merge with uncommitted changes. "noconflict" will
+  allow any update which would not trigger a merge with uncommitted
+  changes, if any are present. (default: "linear")
+  
+
+  $ hg help config.ommands.update.check
+  abort: help section not found: config.ommands.update.check
   [255]
 
 Unrelated trailing paragraphs shouldn't be included
@@ -1388,6 +1409,14 @@ Show nested definitions
   $ hg help config.type | egrep '^$'|wc -l
   \s*3 (re)
 
+  $ hg help config.profiling.type.ls
+  "profiling.type.ls"
+Use Python's built-in instrumenting profiler. This profiler works 
on
+all platforms, but each line number it reports is the first line of
+a function. This restriction makes it difficult to identify the
+expensive parts of a non-trivial function.
+  
+
 Separate sections from subsections
 
   $ hg help config.format | egrep '^("|-)|^\s*$' | uniq
___
Mercurial-devel mailing list

[PATCH 3 of 4] minirst: mark getsections() as an internal helper

2018-08-29 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1533443698 -32400
#  Sun Aug 05 13:34:58 2018 +0900
# Node ID 1089fe141b360764d5a413ea87f382a22f898499
# Parent  656e548c9349e1e98e166a67a7a6193e237ca613
minirst: mark getsections() as an internal helper

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -680,7 +680,7 @@ def format(text, width=80, indent=0, kee
 def filtersections(blocks, section):
 """Select parsed blocks under the specified section"""
 parents = []
-sections = getsections(blocks)
+sections = _getsections(blocks)
 blocks = []
 i = 0
 lastparents = []
@@ -728,7 +728,7 @@ def filtersections(blocks, section):
 
 return blocks
 
-def getsections(blocks):
+def _getsections(blocks):
 '''return a list of (section name, nesting level, blocks) tuples'''
 nest = ""
 level = 0
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4407: tests: add test showing that rebase of extinct commit with successor fails

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa3af500a1362: tests: add test showing that rebase of 
extinct commit with successor fails (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4407?vs=10614=10641

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

AFFECTED FILES
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -1511,6 +1511,28 @@
   
   $ cd ..
 
+Rebase merge where extinct node has successor that is not an ancestor of
+destination
+
+  $ hg init extinct-with-succ-not-in-dest
+  $ cd extinct-with-succ-not-in-dest
+
+  $ hg debugdrawdag < E C # replace: C -> E
+  > | |
+  > D B
+  > |/
+  > A
+  > EOF
+
+TODO: There doesn't seem to be much reason to fail this rebase. Make it pass?
+  $ hg rebase -d D -s B
+  abort: this rebase will cause divergences from: 26805aba1e60
+  (to force the rebase please set experimental.evolution.allowdivergence=True)
+  [255]
+
+  $ cd ..
+
   $ hg init p2-succ-in-dest-c
   $ cd p2-succ-in-dest-c
 



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


D4408: rebase: skip extinct revisions even if it has no successor in rebase set

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG94a4980695f8: rebase: skip extinct revisions even if it has 
no successor in rebase set (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4408?vs=10615=10642

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -1525,11 +1525,9 @@
   > A
   > EOF
 
-TODO: There doesn't seem to be much reason to fail this rebase. Make it pass?
   $ hg rebase -d D -s B
-  abort: this rebase will cause divergences from: 26805aba1e60
-  (to force the rebase please set experimental.evolution.allowdivergence=True)
-  [255]
+  rebasing 1:112478962961 "B" (B)
+  note: not rebasing 3:26805aba1e60 "C" (C) and its descendants as this would 
cause divergence
 
   $ cd ..
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1891,7 +1891,7 @@
 # If 'srcrev' has a successor in rebase set but none in
 # destination (which would be catched above), we shall skip it
 # and its descendants to avoid divergence.
-if any(s in destmap for s in succrevs):
+if srcrev in extinctrevs or any(s in destmap for s in 
succrevs):
 obsoletewithoutsuccessorindestination.add(srcrev)
 
 return (



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


D4411: obsutil: make sure "addedmarkers" is not None in getobsoleted()

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG93175cba7edd: obsutil: make sure addedmarkers 
is not None in getobsoleted() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4411?vs=10623=10639

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

AFFECTED FILES
  mercurial/obsutil.py

CHANGE DETAILS

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -464,7 +464,7 @@
 phase = repo._phasecache.phase
 succsmarkers = repo.obsstore.successors.get
 public = phases.public
-addedmarkers = tr.changes.get('obsmarkers')
+addedmarkers = tr.changes['obsmarkers']
 origrepolen = tr.changes['origrepolen']
 seenrevs = set()
 obsoleted = set()



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


D4410: revsetlang: fix position of '-' in spaceless 'a-b' expressions

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb902b177901d: revsetlang: fix position of - in 
spaceless a-b expressions (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4410?vs=10622=10638

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

AFFECTED FILES
  mercurial/revsetlang.py

CHANGE DETAILS

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -177,7 +177,7 @@
 if p: # possible consecutive -
 yield ('symbol', p, s)
 s += len(p)
-yield ('-', None, pos)
+yield ('-', None, s)
 s += 1
 if parts[-1]: # possible trailing -
 yield ('symbol', parts[-1], s)



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


D4406: tests: add log output after stripping for context for next test

2018-08-29 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG63aa928be559: tests: add log output after stripping for 
context for next test (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4406?vs=10613=10640

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

AFFECTED FILES
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -1123,6 +1123,23 @@
   o  0:b173517d0057 a
   
   $ hg strip -r 8:
+  $ hg log -G -r 'a'::
+  *  7:1143e9adc121 f
+  |
+  | o  6:d60ebfa0f1cb e
+  | |
+  | o  5:027ad6c5830d d'
+  | |
+  x |  4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
+  |/
+  o  3:a82ac2b38757 c
+  |
+  | o  2:630d7c95eff7 x
+  | |
+  o |  1:488e1b7e7341 b
+  |/
+  o  0:b173517d0057 a
+  
 
 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
 set and none in destination, we still get the divergence warning.



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


Re: D4336: merge: improve interactive one-changed one-deleted message (issue5550)

2018-08-29 Thread Yuya Nishihara
> > +"file %(fd)s was deleted in local%(l)s but was modified in 
> > other%(o)s.\n"
> > +"What do you want to do?\n"
> >  "use (c)hanged version, (d)elete, or leave (u)nresolved?"
> 
> The UI consistently uses lower case sentences. While I like proper 
> punctuation, I thought I'd point out the inconsistency in case others feel it 
> should be changed.

Perhaps "What do you want to do?" can be removed? It adds nothing useful.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4336: merge: improve interactive one-changed one-deleted message (issue5550)

2018-08-29 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >> +"file %(fd)s was deleted in local%(l)s but was modified in 
other%(o)s.\n"
  >  > +"What do you want to do?\n"
  >  >  "use (c)hanged version, (d)elete, or leave (u)nresolved?"
  > 
  > The UI consistently uses lower case sentences. While I like proper 
punctuation, I thought I'd point out the inconsistency in case others feel it 
should be changed.
  
  Perhaps "What do you want to do?" can be removed? It adds nothing useful.

REPOSITORY
  rHG Mercurial

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

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


D4409: rebase: skip *all* obsolete revisions, just warn about divergence

2018-08-29 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > @@ -1289,18 +1286,16 @@
  > 
  >   o  0:b173517d0057 a
  >   
  >   $ hg rebase -d 0 -r 2
  > 
  > - rebasing 2:a82ac2b38757 "c" (c) +  note: not rebasing 2:a82ac2b38757 "c" 
(c) and its descendants as this would cause divergence
  
  Looks like the fix for issue5782 regressed.
  
  https://bz.mercurial-scm.org/show_bug.cgi?id=5782

REPOSITORY
  rHG Mercurial

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

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


Re: D4409: rebase: skip *all* obsolete revisions

2018-08-29 Thread Yuya Nishihara
> @@ -1289,18 +1286,16 @@
>o  0:b173517d0057 a
>
>$ hg rebase -d 0 -r 2
> -  rebasing 2:a82ac2b38757 "c" (c)
> +  note: not rebasing 2:a82ac2b38757 "c" (c) and its descendants as this 
> would cause divergence

Looks like the fix for issue5782 regressed.

https://bz.mercurial-scm.org/show_bug.cgi?id=5782
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5973] New: Merge can fails to use descendant filenode over ancestors one

2018-08-29 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5973

Bug ID: 5973
   Summary: Merge can fails to use descendant filenode over
ancestors one
   Product: Mercurial
   Version: earlier
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: lothiral...@gmail.com
CC: mercurial-devel@mercurial-scm.org

We have noticed cases where merged manifest replaces a filenode with one of its
ancestors. This is not supposed to happen since it produces a slightly buggy
history.

Redoing the same merge manually does not produce a faulty manifest so how to
reproduce the issue is unclear.

We initially noticed one occurrence in the private repository. However, a tool
to detect this at a wider scale revealed many more occurrences. We can spot
such buggy merge within every serious repository we looked at mercurial,
mozilla… etc. The occurrences are not localized in time and seem to be still
happening from time to time today.

For example, the first occurrence of this in the mercurial repository is
5e73dfe26ac1 (depth: 1687; date: 2006-02-03) It affects 5 files.

5e73dfe26ac1 mercurial/changelog.py@03be250163a1 not a descendant of
243d7f8d6ce4 (it is an ancestor)
5e73dfe26ac1 mercurial/filelog.py@80e3cd985743 not a descendant of
b19ace6ac92c (it is an ancestor)
5e73dfe26ac1 mercurial/manifest.py@0229e4efa726 not a descendant of
08af5a58aa45 (it is an ancestor)
5e73dfe26ac1 mercurial/revlog.py@03d6f352827a not a descendant of
2cbad71c6176 (it is an ancestor)
5e73dfe26ac1 mercurial/statichttprepo.py@45e1b2eddc09 not a descendant of
04aa8ad6b9e9 (it is an ancestor)

And the latest occurrence happens on 98e990bb7330 (depth: 33646 date:
2017-08-10)

98e990bb7330 tests/test-pull.t@99fa3b6f103b not a descendant of
3279510969cf (it is an ancestor)

Once the merge code has been confused once, it will never be able to fully
correct the error. Depending on the merge ancestors situation, the error will
be corrected or reintroduced over and over.

To search for this issues in a repository you can use the same tool as we did:

$ hg clone https://bitbucket.org/octobus/octobus-misc
$ hg --config
extensions.octotools=path/to/octobus-misc/hgext3rd/octotools.py
debuganalyzemerge


The full consequences of this are unclear:

* some `hg log FILE` call might be wrong,

* some copy tracing might be wrong,

* the eternal battle between branches with the right content and the one with
wrong content induces extra manifest churn.

* some linkrev adjustment might be wrong (or extra costly)

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