D5130: lfs: autoload the extension when cloning from repo with lfs enabled

2018-10-18 Thread mharbison72 (Matt Harbison)
mharbison72 added a subscriber: yuja.
mharbison72 added a comment.


  In https://phab.mercurial-scm.org/D5130#76737, @indygreg wrote:
  
  > > ! In https://phab.mercurial-scm.org/D5130#76736, @mharbison72 wrote:
  > > Also, I need to see if this can be made to work with cloning from a local 
repo.
  >
  > I'm **really** not a fan of local / hardlink clones. They are very brittle. 
When you start throwing extra repo features like LFS into the mix, it becomes 
even more dangerous. Especially when we start talking about adding modifying 
`.hg/requires` automatically. The fundamental problem is the hardlink clone is 
strictly separate but it "inherits" some state from its parent. If we start 
varying behavior of the two repos, interaction between them can be wonky. In 
general, for advanced features, we should go through the "hg clone --pull" 
interface to create a clean break and minimize potential for wonkiness.
  
  
  What's brittle about it, assuming clone implies exact copy?  I'm vaguely 
aware of filesystem bugs around detecting hardlinks, but I thought that was 
basically solved by the whitelist of filesystems.
  
  I'm fine with picking this up next cycle, but I was tinkering with trying to 
address @yuja's concerns in https://phab.mercurial-scm.org/D4713, and it looks 
like this already works with a local clone.  It looks like local clone doesn't 
call localrepo.createrepository(), rather it just calls 
localrepo.makerepository() twice for the source and destination, and reads the 
existing requirements file.  So I don't see an obvious way to warn about 
autoloading largefiles when cloning, and not being obnoxious and warning when 
any command is run.  (I do see the different behavior below with `clone 
--pull`.)
  
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -456,6 +456,7 @@ def makelocalrepository(baseui, path, in
 else:
 extensions.loadall(ui)

+print('makerepo for %s, requirements are %s' % (path, requirements))
 # Set of module names of extensions loaded for this repository.
 extensionmodulenames = {m.__name__ for n, m in 
extensions.extensions(ui)}

@@ -2809,6 +2810,7 @@ def undoname(fn):
 def instance(ui, path, create, intents=None, createopts=None):
 localpath = util.urllocalpath(path)
 if create:
+print('*** create repo on %s' % localpath)
 createrepository(ui, localpath, createopts=createopts)

 return makelocalrepository(ui, localpath, intents=intents)
diff --git a/tests/test-largefiles-small-disk.t 
b/tests/test-largefiles-small-disk.t
--- a/tests/test-largefiles-small-disk.t
+++ b/tests/test-largefiles-small-disk.t
@@ -28,14 +28,20 @@ Test how largefiles abort in case the di
   > util.oslink = oslink
   > EOF

+  $ cp $HGRCPATH $HGRCPATH.orig
+
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "largefiles =" >> $HGRCPATH

   $ hg init alice
+  *** create repo on alice
+  makerepo for alice, requirements are set(['dotencode', 'generaldelta', 
'fncache', 'store', 'revlogv1'])
   $ cd alice
   $ echo "this is a very big file" > big
   $ hg add --large big
+  makerepo for $TESTTMP\alice, requirements are set(['dotencode', 
'generaldelta', 'fncache', 'store', 'revlogv1'])
   $ hg commit --config extensions.criple=$TESTTMP/criple.py -m big
+  makerepo for $TESTTMP\alice, requirements are set(['dotencode', 
'generaldelta', 'fncache', 'store', 'revlogv1'])
   abort: No space left on device
   [255]

@@ -52,12 +58,16 @@ The user cache is not even created:
 Make the commit with space on the device:

   $ hg commit -m big
+  makerepo for $TESTTMP\alice, requirements are set(['dotencode', 
'generaldelta', 'fncache', 'store', 'revlogv1'])

 Now make a clone with a full disk, and make sure lfutil.link function
 makes copies instead of hardlinks:

   $ cd ..
   $ hg --config extensions.criple=$TESTTMP/criple.py clone --pull alice bob
+  makerepo for alice, requirements are set(['dotencode', 'largefiles', 
'fncache', 'store', 'generaldelta', 'revlogv1'])
+  *** create repo on bob
+  makerepo for bob, requirements are set(['dotencode', 'generaldelta', 
'fncache', 'store', 'revlogv1'])
   requesting all changes
   adding changesets
   adding manifests
@@ -73,3 +83,30 @@ The largefile is not created in .hg/larg

   $ ls bob/.hg/largefiles
   dirstate
+
+  $ cp -f $HGRCPATH.orig $HGRCPATH
+.  $ cat >> alice/.hg/hgrc < [extensions]
+.  > largefiles =
+.  > EOF
+
+  $ hg clone alice charlie
+  makerepo for alice, requirements are set(['dotencode', 'largefiles', 
'fncache', 'store', 'generaldelta', 'revlogv1'])
+  makerepo for charlie, requirements are set(['dotencode', 'largefiles', 
'fncache', 

D5087: help: displaying documented aliases by default

2018-10-18 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 12256.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5087?vs=12127=12256

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

AFFECTED FILES
  mercurial/dispatch.py
  mercurial/help.py
  mercurial/registrar.py
  tests/test-alias.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -823,18 +823,38 @@
   > def uisetup(ui):
   > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
   > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
+  > ui.setconfig(b'alias', b'hgalias:doc', b'My doc', b'helpext')
+  > ui.setconfig(b'alias', b'hgalias:category', b'navigation', b'helpext')
+  > ui.setconfig(b'alias', b'hgaliasnodoc', b'summary', b'helpext')
   > 
   > EOF
   $ echo '[extensions]' >> $HGRCPATH
   $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
 
 Test for aliases
 
+  $ hg help | grep hgalias
+   hgalias   My doc
+
   $ hg help hgalias
   hg hgalias [--remote]
   
   alias for: hg summary
   
+  My doc
+  
+  defined by: helpext
+  
+  options:
+  
+--remote check for push and pull
+  
+  (some details hidden, use --verbose to show complete help)
+  $ hg help hgaliasnodoc
+  hg hgaliasnodoc [--remote]
+  
+  alias for: hg summary
+  
   summarize working directory state
   
   This generates a brief summary of the working directory state, including
@@ -947,6 +967,7 @@
   
bisectsubdivision search of changesets
heads show branch heads
+   hgalias   My doc
identify  identify the working directory or specified revision
log   show revision history of entire repository or files
   
@@ -2662,6 +2683,13 @@
   hgalias
   
   
+  My doc
+  
+  
+  
+  hgaliasnodoc
+  
+  
   summarize working directory state
   
   
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -68,17 +68,17 @@
 help
 
   $ hg help -c | grep myinit
-   myinit This is my documented alias for init.
+   myinit   This is my documented alias for init.
   $ hg help -c | grep mycommit
-   mycommit   This is my alias with only doc.
+   mycommit This is my alias with only doc.
   $ hg help -c | grep cleanstatus
-   cleanstatusshow changed files in the working directory
+  [1]
   $ hg help -c | grep lognull
-   lognullLogs the null rev
+   lognull  Logs the null rev
   $ hg help -c | grep dln
-   dlnLogs the null rev
+  [1]
   $ hg help -c | grep recursivedoc
-   recursivedoc   Logs the null rev in debug mode
+   recursivedoc Logs the null rev in debug mode
   $ hg help myinit
   hg myinit [OPTIONS] [BLA] [BLE]
   
@@ -602,7 +602,7 @@
 help for a shell alias
 
   $ hg help -c | grep rebate
-   rebate This is my alias which just prints something.
+   rebate   This is my alias which just prints something.
   $ hg help rebate
   hg rebate [MYARGS]
   
diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -169,6 +169,10 @@
 """
 
 # Command categories for grouping them in help output.
+# These can also be specified for aliases, like:
+# [alias]
+# myalias = something
+# myalias:category = repo
 CATEGORY_REPO_CREATION = 'repo'
 CATEGORY_REMOTE_REPO_MANAGEMENT = 'remote'
 CATEGORY_COMMITTING = 'commit'
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -189,12 +189,25 @@
 if notomitted:
 rst.append('\n\n.. container:: notomitted\n\n%s\n\n' % notomitted)
 
-def filtercmd(ui, cmd, kw, doc):
+def filtercmd(ui, cmd, func, kw, doc):
 if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
+# Debug command, and user is not looking for those.
 return True
-if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
+if not ui.verbose:
+if not kw and not doc:
+# Command had no documentation, no point in showing it by default.
+return True
+if getattr(func, 'alias', False) and not getattr(func, 'owndoc', 
False):
+# Alias didn't have its own documentation.
+return True
+if doc and any(w in doc for w in _exclkeywords):
+# Documentation has excluded keywords.
+return True
+if kw == "shortlist" and not getattr(func, 'helpbasic', False):
+# We're presenting the short list but the command is not basic.
 return True
 if ui.configbool('help', 'hidden-command.%s' % cmd):
+# Configuration explicitly hides the command.
 return True
 return False
 
@@ -230,13 +243,14 @@
 else:
 summary = ''
 # translate docs *before* searching there
-docs = _(pycompat.getdoc(entry[0])) or ''
+

D5156: help: displaying extension commands by default

2018-10-18 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -820,6 +820,11 @@
   > def nohelp(ui, *args, **kwargs):
   > pass
   > 
+  > @command(b'hashelp', [], b'hg hashelp', norepo=True)
+  > def hashelp(ui, *args, **kwargs):
+  > """Extension command's help"""
+  > pass
+  > 
   > def uisetup(ui):
   > ui.setconfig(b'alias', b'shellalias', b'!echo hi', b'helpext')
   > ui.setconfig(b'alias', b'hgalias', b'summary', b'helpext')
@@ -904,6 +909,19 @@
   
   (some details hidden, use --verbose to show complete help)
 
+Test that default list of commands includes extension commands that have help,
+but not those that don't, except in verbose mode, when a keyword is passed, or
+when help about the extension is requested.
+
+#if no-extraextensions
+
+  $ hg help | grep hashelp
+   hashelp   Extension command's help
+  $ hg help | grep nohelp
+  [1]
+  $ hg help -v | grep nohelp
+   nohelp(no help text available)
+
   $ hg help -k nohelp
   Commands:
   
@@ -913,144 +931,15 @@
   
nohelp (no help text available)
 
-Test that default list of commands omits extension commands
-
-#if no-extraextensions
-
-  $ hg help
-  Mercurial Distributed SCM
+  $ hg help helpext
+  helpext extension - no help text available
   
   list of commands:
   
-  Repository creation:
-  
-   clone make a copy of an existing repository
-   init  create a new repository in the given directory
-  
-  Remote repository management:
-  
-   incoming  show new changesets found in source
-   outgoing  show changesets not found in the destination
-   paths show aliases for remote repositories
-   pull  pull changes from the specified source
-   push  push changes to the specified destination
-   serve start stand-alone webserver
-  
-  Change creation:
-  
-   commitcommit the specified files or all outstanding changes
-  
-  Change manipulation:
-  
-   backout   reverse effect of earlier changeset
-   graft copy changes from other branches onto the current branch
-   merge merge another revision into working directory
-  
-  Change organization:
-  
-   bookmarks create a new bookmark or list existing bookmarks
-   branchset or show the current branch name
-   branches  list repository named branches
-   phase set or show the current phase name
-   tag   add one or more tags for the current or given revision
-   tags  list repository tags
-  
-  File content management:
-  
-   annotate  show changeset information by line for each file
-   cat   output the current or given revision of files
-   copy  mark files as copied for the next commit
-   diff  diff repository (or selected files)
-   grep  search revision history for a pattern in specified files
-  
-  Change navigation:
-  
-   bisectsubdivision search of changesets
-   heads show branch heads
-   hgalias   My doc
-   identify  identify the working directory or specified revision
-   log   show revision history of entire repository or files
-  
-  Working directory management:
-  
-   add   add the specified files on the next commit
-   addremove add all new files, delete all missing files
-   files list tracked files
-   forgetforget the specified files on the next commit
-   removeremove the specified files on the next commit
-   renamerename files; equivalent of copy + remove
-   resolve   redo merges or set/view the merge status of files
-   revertrestore files to their checkout state
-   root  print the root (top) of the current working directory
-   statusshow changed files in the working directory
-   summary   summarize working directory state
-   updateupdate working directory (or switch revisions)
-  
-  Change import/export:
-  
-   archive   create an unversioned archive of a repository revision
-   bundlecreate a bundle file
-   exportdump the header and diffs for one or more changesets
-   importimport an ordered set of patches
-   unbundle  apply one or more bundle files
-  
-  Repository maintenance:
-  
-   manifest  output the current or given revision of the project manifest
-   recover   roll back an interrupted transaction
-   verifyverify the integrity of the repository
-  
-  Help:
-  
-   configshow combined config settings from all hgrc files
-   help  show help for a given topic or a help overview
-   version   output version and copyright information
-  
-  enabled 

D5077: help: allow hiding of help topics

2018-10-18 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 12255.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5077?vs=12126=12255

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/help.py
  tests/test-help-hide.t

CHANGE DETAILS

diff --git a/tests/test-help-hide.t b/tests/test-help-hide.t
--- a/tests/test-help-hide.t
+++ b/tests/test-help-hide.t
@@ -125,3 +125,131 @@
scripting Using Mercurial from scripts and automation
   
   (use 'hg help -v' to show built-in aliases and global options)
+
+Test hiding some topics.
+
+  $ hg --config help.hidden-topic.deprecated=true \
+  > --config help.hidden-topic.internals=true \
+  > --config help.hidden-topic.scripting=true help
+  Mercurial Distributed SCM
+  
+  list of commands:
+  
+  Repository creation:
+  
+   clone make a copy of an existing repository
+   init  create a new repository in the given directory
+  
+  Remote repository management:
+  
+   incoming  show new changesets found in source
+   outgoing  show changesets not found in the destination
+   paths show aliases for remote repositories
+   pull  pull changes from the specified source
+   push  push changes to the specified destination
+   serve start stand-alone webserver
+  
+  Change creation:
+  
+   commitcommit the specified files or all outstanding changes
+  
+  Change manipulation:
+  
+   backout   reverse effect of earlier changeset
+   graft copy changes from other branches onto the current branch
+   merge merge another revision into working directory
+  
+  Change organization:
+  
+   bookmarks create a new bookmark or list existing bookmarks
+   branchset or show the current branch name
+   branches  list repository named branches
+   phase set or show the current phase name
+   tag   add one or more tags for the current or given revision
+   tags  list repository tags
+  
+  File content management:
+  
+   annotate  show changeset information by line for each file
+   cat   output the current or given revision of files
+   copy  mark files as copied for the next commit
+   diff  diff repository (or selected files)
+   grep  search revision history for a pattern in specified files
+  
+  Change navigation:
+  
+   bisectsubdivision search of changesets
+   heads show branch heads
+   identify  identify the working directory or specified revision
+   log   show revision history of entire repository or files
+  
+  Working directory management:
+  
+   add   add the specified files on the next commit
+   addremove add all new files, delete all missing files
+   files list tracked files
+   forgetforget the specified files on the next commit
+   removeremove the specified files on the next commit
+   renamerename files; equivalent of copy + remove
+   resolve   redo merges or set/view the merge status of files
+   revertrestore files to their checkout state
+   root  print the root (top) of the current working directory
+   statusshow changed files in the working directory
+   summary   summarize working directory state
+   updateupdate working directory (or switch revisions)
+  
+  Change import/export:
+  
+   archive   create an unversioned archive of a repository revision
+   bundlecreate a bundle file
+   exportdump the header and diffs for one or more changesets
+   importimport an ordered set of patches
+   unbundle  apply one or more bundle files
+  
+  Repository maintenance:
+  
+   manifest  output the current or given revision of the project manifest
+   recover   roll back an interrupted transaction
+   verifyverify the integrity of the repository
+  
+  Help:
+  
+   configshow combined config settings from all hgrc files
+   help  show help for a given topic or a help overview
+   version   output version and copyright information
+  
+  additional help topics:
+  
+  Mercurial identifiers:
+  
+   filesets  Specifying File Sets
+   hgignore  Syntax for Mercurial Ignore Files
+   patterns  File Name Patterns
+   revisions Specifying Revisions
+   urls  URL Paths
+  
+  Mercurial output:
+  
+   color Colorizing Outputs
+   dates Date Formats
+   diffs Diff Formats
+   templatingTemplate Usage
+  
+  Mercurial configuration:
+  
+   configConfiguration Files
+   environment   Environment Variables
+   extensionsUsing Additional Features
+   flags Command-line flags
+   hgweb Configuring hgweb
+   merge-tools   Merge Tools
+   pager Pager Support
+  
+  Concepts:
+  
+   bundlespecBundle File Formats
+   glossary  Glossary
+   phases

D5087: help: displaying documented aliases by default

2018-10-18 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  In https://phab.mercurial-scm.org/D5087#76401, @yuja wrote:
  
  > > @@ -507,16 +522,11 @@
  > > 
  > >   f = fs[0]
  > >   syns[f] = ', '.join(fs)
  > >   func = e[0]
  > > 
  > > +alias = getattr(func, 'alias', False)
  > > 
  > >   if select and not select(f):
  > >   continue
  > > 
  > > - if (not select and name != 'shortlist' and
  > > - func.__module__ != commands.__name__):
  > > - continue
  > > - if name == "shortlist":
  > > - if not getattr(func, 'helpbasic', False):
  > > - continue doc = pycompat.getdoc(func)
  > > - if filtercmd(ui, f, name, doc): +if filtercmd(ui, f, func, 
name, doc):
  >
  > This makes extension commands get listed in "hg help". I think that's fine,
  >  but can you split patches so we can backout if that causes problem?
  
  
  Done. Sending another review for the extensions part.

REPOSITORY
  rHG Mercurial

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

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


D5077: help: allow hiding of help topics

2018-10-18 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  In https://phab.mercurial-scm.org/D5077#76403, @yuja wrote:
  
  > > +def filtertopic(ui, topic):
  > >  +return ui.configbool('help', 'hide.%s' % topic, False)
  >
  > Maybe we need a separate namespace (e.g. help.hidden-topic.%s)?
  
  
  Done.

REPOSITORY
  rHG Mercurial

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

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


D5076: help: allow commands to be hidden

2018-10-18 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  In https://phab.mercurial-scm.org/D5076#76405, @yuja wrote:
  
  > > +if ui.configbool('help', 'hide.%s' % cmd):
  > >  +return True
  >
  > Nit: "hidden" or "hidden-command" seems better.
  
  
  Done.

REPOSITORY
  rHG Mercurial

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

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


[PATCH] lfs: don't add extension to hgrc after conversion (BC)

2018-10-18 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1539914147 14400
#  Thu Oct 18 21:55:47 2018 -0400
# Node ID 5efdab0bd5b25112f44dc22813d0fb78a77a0009
# Parent  824b687ff6af49622a18dfea760cf41a7abe5aa7
lfs: don't add extension to hgrc after conversion (BC)

This is in the spirit of bcf72d7b1524.

diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -213,10 +213,6 @@ def convertsink(orig, sink):
 self.repo.requirements.add('lfs')
 self.repo._writerequirements()
 
-# Permanently enable lfs locally
-self.repo.vfs.append(
-'hgrc', util.tonativeeol('\n[extensions]\nlfs=\n'))
-
 return node
 
 sink.__class__ = lfssink
diff --git a/tests/test-lfs-largefiles.t b/tests/test-lfs-largefiles.t
--- a/tests/test-lfs-largefiles.t
+++ b/tests/test-lfs-largefiles.t
@@ -286,8 +286,7 @@ parameters are available, but not --auth
   0 remove large_by_size.bin
   $ cd nolargefiles
 
-The requirement is added to the destination repo, and the extension is enabled
-locally.
+The requirement is added to the destination repo.
 
   $ cat .hg/requires
   dotencode
@@ -296,8 +295,6 @@ locally.
   lfs
   revlogv1
   store
-  $ hg config --debug extensions | grep lfs
-  $TESTTMP/nolargefiles/.hg/hgrc:*: extensions.lfs= (glob)
 
   $ hg log -r 'all()' -G -T '{rev} {join(lfs_files, ", ")} ({desc})\n'
   o  8 large_by_size.bin (remove large_by_size.bin)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@40332: 8 new changesets

2018-10-18 Thread Mercurial Commits
8 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/b0fbd1792e2d
changeset:   40325:b0fbd1792e2d
user:Gregory Szorc 
date:Tue Oct 16 15:36:19 2018 +0200
summary: storageutil: extract most of peek_censored from revlog

https://www.mercurial-scm.org/repo/hg/rev/fed697fa1734
changeset:   40326:fed697fa1734
user:Gregory Szorc 
date:Tue Oct 09 08:50:13 2018 -0700
summary: sqlitestore: file storage backend using SQLite

https://www.mercurial-scm.org/repo/hg/rev/55836a34f41b
changeset:   40327:55836a34f41b
user:Gregory Szorc 
date:Wed Sep 26 14:38:43 2018 -0700
summary: exchangev2: recognize narrow patterns when pulling

https://www.mercurial-scm.org/repo/hg/rev/2c55716f8a1c
changeset:   40328:2c55716f8a1c
user:Gregory Szorc 
date:Tue Oct 16 21:35:33 2018 +0200
summary: wireprotov2: add response type that serializes to indefinite 
length bytestring

https://www.mercurial-scm.org/repo/hg/rev/ed55a0077490
changeset:   40329:ed55a0077490
user:Gregory Szorc 
date:Tue Oct 16 21:31:21 2018 +0200
summary: wireprotov2: implement command for retrieving raw store files

https://www.mercurial-scm.org/repo/hg/rev/00a4cd368e3f
changeset:   40330:00a4cd368e3f
user:Gregory Szorc 
date:Wed Oct 17 10:10:05 2018 +0200
summary: exchangev2: support for calling rawstorefiledata to retrieve raw 
files

https://www.mercurial-scm.org/repo/hg/rev/ac59de55c8b4
changeset:   40331:ac59de55c8b4
user:Gregory Szorc 
date:Fri Sep 14 14:56:13 2018 -0700
summary: exchange: support declaring pull depth

https://www.mercurial-scm.org/repo/hg/rev/e0dea186ab6e
changeset:   40332:e0dea186ab6e
bookmark:@
tag: tip
user:Mark Thomas 
date:Sun Oct 14 09:34:21 2018 +
summary: py3: fix test-hardlinks.t

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


[PATCH 2 of 3] py3: fix module imports in test-highlight.t

2018-10-18 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1539900676 14400
#  Thu Oct 18 18:11:16 2018 -0400
# Node ID 54a6f166ac8bf8d563d6244e76cefc91d34c2516
# Parent  b8adc6cf0c130b1bc4183df9b4b3363ae94aa3f1
py3: fix module imports in test-highlight.t

The hash changes are because the *.py file is committed to the repo.

diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -26,7 +26,7 @@ create random Python file to exercise Py
   > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
   > """
   > 
-  > from itertools import dropwhile, ifilter, islice, count, chain
+  > import itertools
   > 
   > def primes():
   > """Generate all primes."""
@@ -35,12 +35,13 @@ create random Python file to exercise Py
   > # It is important to yield *here* in order to stop the
   > # infinite recursion.
   > yield p
-  > ns = ifilter(lambda n: n % p != 0, ns)
+  > ns = itertools.ifilter(lambda n: n % p != 0, ns)
   > for n in sieve(ns):
   > yield n
   > 
-  > odds = ifilter(lambda i: i % 2 == 1, count())
-  > return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
+  > odds = itertools.ifilter(lambda i: i % 2 == 1, itertools.count())
+  > dropwhile = itertools.dropwhile
+  > return itertools.chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
   > 
   > if __name__ == "__main__":
   > import sys
@@ -49,7 +50,7 @@ create random Python file to exercise Py
   > except (ValueError, IndexError):
   > n = 10
   > p = primes()
-  > print("The first %d primes: %s" % (n, list(islice(p, n
+  > print("The first %d primes: %s" % (n, list(itertools.islice(p, n
   > EOF
   $ echo >> primes.py  # to test html markup with an empty line just before EOF
   $ hg ci -Ama
@@ -74,7 +75,7 @@ hgweb filerevision, html
   
   
   
-  test: f4fca47b67e6 primes.py
+  test: 687f2d169546 primes.py
   
   
   
@@ -112,7 +113,7 @@ hgweb filerevision, html
   
   Mercurial 
   
-   view primes.py @ 0:f4fca47b67e6
+   view primes.py @ 0:687f2d169546
draft default 
tip 
   
   
@@ -159,7 +160,7 @@ hgweb filerevision, html
   where sieve (p:ns) = p : sieve [n | n 
- ns, mod n p /= 0]
   
   
-  from itertools 
import dropwhile, ifilter, islice, count, chain
+  import itertools
   
   def primes():
   Generate all 
primes.
@@ -168,22 +169,23 @@ hgweb filerevision, html
   # It is important to yield *here* in 
order to stop the
   # infinite recursion.
   yield p
-  ns = 
ifilter(lambda n: n % p != 0, ns)
+  ns = 
itertools.ifilter(lambda 
n: n % p != 0, ns)
   for n 
in sieve(ns):
   yield n
   
-  odds = 
ifilter(lambda i: i % 2 == 1, count())
-  return chain([2], sieve(dropwhile(lambda n: n  3, odds)))
-  
-  if __name__ 
== __main__:
-  import sys
-  try:
-  n = 
int(sys.argv[1])
-  except (ValueError, 
IndexError):
-  n = 
10
-  p = primes()
-  print(The first %d primes: %s % 
(n, list(islice(p, n
-  
+  odds = 
itertools.ifilter(lambda 
i: i % 2 == 1, itertools.count())
+  dropwhile = 
itertools.dropwhile
+  return itertools.chain([2], sieve(dropwhile(lambda n: n  3, odds)))
+  
+  if __name__ 
== __main__:
+  import sys
+  try:
+  n = 
int(sys.argv[1])
+  except (ValueError, 
IndexError):
+  n = 
10
+  p = primes()
+  print(The first %d primes: %s % 
(n, list(itertools.islice(p, n
+  
   
   
   
@@ -251,7 +253,7 @@ hgweb fileannotate, html
   
   Mercurial 
   
-   annotate primes.py @ 0:f4fca47b67e6
+   annotate primes.py @ 0:687f2d169546
draft default 
tip 
   
   
@@ -318,19 +320,19 @@ hgweb fileannotate, html
 
   
   
-  
+  
   0
   
   
   
-  
-  f4fca47b67e6
+  
+  687f2d169546
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
1 Fun with generators. Corresponding Haskell 
implementation:
@@ -340,14 +342,14 @@ hgweb fileannotate, html
   
   
   
-  
-  f4fca47b67e6
+  
+  687f2d169546
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
2 
@@ -357,14 +359,14 @@ hgweb fileannotate, html
   
   
   
-  
-  f4fca47b67e6
+  
+  687f2d169546
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
3 primes = 2 : sieve [3, 5..]
@@ -374,14 +376,14 @@ hgweb fileannotate, html
   
   
   
-  
-  f4fca47b67e6
+  
+  687f2d169546
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
4 where sieve (p:ns) = p : sieve [n | n - ns, mod n p /= 
0]
@@ -391,14 +393,14 @@ hgweb fileannotate, html
   
   
   
-  
-  f4fca47b67e6
+  
+  687f2d169546
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
5 
@@ -408,14 +410,14 @@ hgweb fileannotate, html
   
   
   
-  
-  f4fca47b67e6
+  
+  687f2d169546
   a
   
   
   parents: 
-  

[PATCH 3 of 3] tests: glob over a difference between Windows 7 and Window 10

2018-10-18 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1539899647 14400
#  Thu Oct 18 17:54:07 2018 -0400
# Node ID 813e957dd8c608d071d96f4adea5a5bbca44a17c
# Parent  54a6f166ac8bf8d563d6244e76cefc91d34c2516
tests: glob over a difference between Windows 7 and Window 10

The error value is 11001 on Windows 10.  I have no idea why it changed, but it
seems unimportant.

diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -54,7 +54,7 @@ Manifest file with invalid URL aborts
   $ hg clone http://localhost:$HGPORT 404-url
   applying clone bundle from http://does.not.exist/bundle.hg
   error fetching bundle: (.* not known|(\[Errno -?\d+])? No address associated 
with hostname) (re) (no-windows !)
-  error fetching bundle: [Errno 11004] getaddrinfo failed (windows !)
+  error fetching bundle: [Errno 1100*] getaddrinfo failed (glob) (windows !)
   abort: error applying bundle
   (if this error persists, consider contacting the server operator or disable 
clone bundles via "--config ui.clonebundles=false")
   [255]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3] py3: fix module imports in tests, as flagged by test-check-module-imports.t

2018-10-18 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1539833623 14400
#  Wed Oct 17 23:33:43 2018 -0400
# Node ID b8adc6cf0c130b1bc4183df9b4b3363ae94aa3f1
# Parent  13885aa723e6d83cd9a873cf861ef92377a2dfde
py3: fix module imports in tests, as flagged by test-check-module-imports.t

I have no idea why these aren't flagged with python2.  I excluded
test-highlight.t for now to make this easier to review- the changed code is
committed to a repo, which has cascading changes on the rest of the test.

There's a mix of bytes and str in the imports dict of contrib/import-checker.py
that crashed it half way through listing out these errors.  I couldn't figure
out how to fix that properly, so I was lazy and applied this on py3, to find the
rest of the errors:

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -626,7 +626,12 @@ def find_cycles(imports):
 top.foo -> top.qux -> top.foo
 """
 cycles = set()
-for mod in sorted(imports.keys()):
+def sort(v):
+if isinstance(v, bytes):
+return v.decode('ascii')
+return v
+
+for mod in sorted(imports.keys(), key=sort):
 try:
 checkmod(mod, imports)
 except CircularImport as e:

diff --git a/tests/test-basic.t b/tests/test-basic.t
--- a/tests/test-basic.t
+++ b/tests/test-basic.t
@@ -61,8 +61,8 @@ This command is ancient:
 Verify that updating to revision 0 via commands.update() works properly
 
   $ cat < update_to_rev0.py
-  > from mercurial import ui, hg, commands
-  > myui = ui.ui.load()
+  > from mercurial import commands, hg, ui as uimod
+  > myui = uimod.ui.load()
   > repo = hg.repository(myui, path=b'.')
   > commands.update(myui, repo, rev=b"0")
   > EOF
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -351,7 +351,8 @@ when using chg, blackbox.log should get 
   $ chg noop
 
   $ cat > showsize.py << 'EOF'
-  > import os, sys
+  > import os
+  > import sys
   > limit = 500
   > for p in sys.argv[1:]:
   > size = os.stat(p).st_size
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -934,7 +934,7 @@ Test lazily acquiring the lock during un
 
   $ cat >> $TESTTMP/locktester.py < import os
-  > from mercurial import extensions, bundle2, error
+  > from mercurial import bundle2, error, extensions
   > def checklock(orig, repo, *args, **kwargs):
   > if repo.svfs.lexists(b"lock"):
   > raise error.Abort(b"Lock should not be taken")
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -558,8 +558,8 @@ Issue2267: Error in 1.6 hg.py: TypeError
 iterable in addbranchrevs()
 
   $ cat < simpleclone.py
-  > from mercurial import ui, hg
-  > myui = ui.ui.load()
+  > from mercurial import hg, ui as uimod
+  > myui = uimod.ui.load()
   > repo = hg.repository(myui, b'a')
   > hg.clone(myui, {}, repo, dest=b"ua")
   > EOF
@@ -571,8 +571,8 @@ iterable in addbranchrevs()
   $ rm -r ua
 
   $ cat < branchclone.py
-  > from mercurial import ui, hg, extensions
-  > myui = ui.ui.load()
+  > from mercurial import extensions, hg, ui as uimod
+  > myui = uimod.ui.load()
   > extensions.loadall(myui)
   > repo = hg.repository(myui, b'a')
   > hg.clone(myui, {}, repo, dest=b"ua", branch=[b"stable",])
diff --git a/tests/test-commit-multiple.t b/tests/test-commit-multiple.t
--- a/tests/test-commit-multiple.t
+++ b/tests/test-commit-multiple.t
@@ -80,8 +80,8 @@ transplant bug fixes onto release branch
 
 now test that we fixed the bug for all scripts/extensions
   $ cat > $TESTTMP/committwice.py <<__EOF__
-  > from mercurial import ui, hg, match, node
-  > from time import sleep
+  > import time
+  > from mercurial import hg, match, node, ui as uimod
   > 
   > def replacebyte(fn, b):
   > f = open(fn, "rb+")
@@ -94,12 +94,12 @@ now test that we fixed the bug for all s
   >% (rev, b', '.join(b"'%s'" % f
   >   for f in repo[rev].files(
   > 
-  > repo = hg.repository(ui.ui.load(), b'.')
+  > repo = hg.repository(uimod.ui.load(), b'.')
   > assert len(repo) == 6, \
   >"initial: len(repo): %d, expected: 6" % len(repo)
   > 
   > replacebyte(b"bugfix", b"u")
-  > sleep(2)
+  > time.sleep(2)
   > try:
   > repo.ui.status(b"PRE: len(repo): %d\n" % len(repo))
   > wlock = repo.wlock()
diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -342,7 +342,7 @@ Test warning on config option access and
   $ cat << EOF > ${TESTTMP}/buggyconfig.py
   > """A small extension that tests our developer warnings for config"""
   > 
-  > from mercurial import registrar, configitems
+  > from 

D5155: bundle2: fix broken compression engine assertion

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

REVISION SUMMARY
  bundletype() is a function, so it needs to be called, and it is
  documented to return a 2-tuple. This code is untested, so that's why
  we haven't noticed the bad assertion.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -839,7 +839,7 @@
 params = self._readexact(paramssize)
 self._processallparams(params)
 yield params
-assert self._compengine.bundletype == 'UN'
+assert self._compengine.bundletype()[1] == 'UN'
 # From there, payload might need to be decompressed
 self._fp = self._compengine.decompressorreader(self._fp)
 emptycount = 0



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


D5154: fuzz: move many initialization steps into LLVMFuzzerInitialize

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

REVISION SUMMARY
  Doing this means that things we intentionally leak (eg type objects)
  no longer confuse AddressSanitizer, so now we can run the fuzzer MUCH
  longer.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/manifest.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/manifest.cc b/contrib/fuzz/manifest.cc
--- a/contrib/fuzz/manifest.cc
+++ b/contrib/fuzz/manifest.cc
@@ -12,6 +12,10 @@
 
 static char cpypath[8192] = "\0";
 
+static PyCodeObject *code;
+static PyObject *mainmod;
+static PyObject *globals;
+
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
const std::string subdir = "/sanpy/lib/python2.7";
@@ -35,20 +39,8 @@
setenv("PYTHONUSERBASE", cpypath, 1);
Py_SetPythonHome(cpypath);
Py_InitializeEx(0);
-   return 0;
-}
-
-int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
-{
initparsers();
-   PyObject *mtext =
-   PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
-   PyObject *mainmod = PyImport_AddModule("__main__");
-   PyObject *globals = PyModule_GetDict(mainmod);
-   PyObject *locals = PyDict_New();
-   PyDict_SetItemString(locals, "mdata", mtext);
-   PyCodeObject *code =
-   (PyCodeObject *)Py_CompileString(R"py(
+   code = (PyCodeObject *)Py_CompileString(R"py(
 from parsers import lazymanifest
 try:
   lm = lazymanifest(mdata)
@@ -67,13 +59,23 @@
   # to debug failures.
   # print e
 )py",
-"fuzzer", Py_file_input);
+   "fuzzer", Py_file_input);
+   mainmod = PyImport_AddModule("__main__");
+   globals = PyModule_GetDict(mainmod);
+   return 0;
+}
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
+{
+   PyObject *mtext =
+   PyBytes_FromStringAndSize((const char *)Data, (Py_ssize_t)Size);
+   PyObject *locals = PyDict_New();
+   PyDict_SetItemString(locals, "mdata", mtext);
PyObject *res = PyEval_EvalCode(code, globals, locals);
if (!res) {
PyErr_Print();
}
Py_XDECREF(res);
-   Py_DECREF(code);
Py_DECREF(locals);
Py_DECREF(mtext);
return 0; // Non-zero return values are reserved for future use.



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


D4312: New bookflow extension for bookmark-based branching

2018-10-18 Thread idlsoft (Sandu Turcan)
idlsoft added a comment.


  In https://phab.mercurial-scm.org/D4312#77084, @pulkit wrote:
  
  > Unrelated, do you use narrow with ellipses or without ellipses? Also I am 
sorry to say but in this cycle, narrow extension has under gone a lot of perf 
and correctness improvements and it won't be backward compatible in upcoming 
release. I will be writing some text about this in the releasenotes too, and 
you can contact me personally and I will be glad to help you with the BC 
changes.
  
  
  Hmm, I thought we did, but no, just this:
  
[experimental]
changegroup3=true
  
  I'm actually kinda looking forward to see if `lfs` works better with all the 
new changes.
  
  ... Even more unrelated, IntelliJ 2018.3 will have a branch/bookmark compare 
dialog similar to the one for git.

REPOSITORY
  rHG Mercurial

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

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


D5153: update: clarify update() call sites by specifying argument names

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb14fdf1fb615: update: clarify update() call sites by 
specifying argument names (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5153?vs=12249=12251

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.py
  hgext/transplant.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/hg.py
  tests/test-revlog-ancestry.py

CHANGE DETAILS

diff --git a/tests/test-revlog-ancestry.py b/tests/test-revlog-ancestry.py
--- a/tests/test-revlog-ancestry.py
+++ b/tests/test-revlog-ancestry.py
@@ -22,10 +22,10 @@
 commit(name, time)
 
 def update(rev):
-merge.update(repo, rev, False, True)
+merge.update(repo, rev, branchmerge=False, force=True)
 
 def merge_(rev):
-merge.update(repo, rev, True, False)
+merge.update(repo, rev, branchmerge=True, force=False)
 
 if __name__ == '__main__':
 addcommit(b"A", 0)
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -846,7 +846,7 @@
 When overwrite is set, changes are clobbered, merged else
 
 returns stats (see pydoc mercurial.merge.applyupdates)"""
-return mergemod.update(repo, node, False, overwrite,
+return mergemod.update(repo, node, branchmerge=False, force=overwrite,
labels=['working copy', 'destination'],
updatecheck=updatecheck)
 
@@ -949,8 +949,8 @@
 """Branch merge with node, resolving changes. Return true if any
 unresolved conflicts."""
 if not abort:
-stats = mergemod.update(repo, node, True, force, mergeforce=mergeforce,
-labels=labels)
+stats = mergemod.update(repo, node, branchmerge=True, force=force,
+mergeforce=mergeforce, labels=labels)
 else:
 ms = mergemod.mergestate.read(repo)
 if ms.active():
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -643,7 +643,9 @@
 with dirstateguard.dirstateguard(repo, 'backout'):
 overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
 with ui.configoverride(overrides, 'backout'):
-stats = mergemod.update(repo, parent, True, True, node, False)
+stats = mergemod.update(repo, parent, branchmerge=True,
+force=True, ancestor=node,
+mergeancestor=False)
 repo.setparents(op1, op2)
 hg._showstats(repo, stats)
 if stats.unresolvedcount:
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -365,8 +365,8 @@
 if backups:
 # Equivalent to hg.revert
 m = scmutil.matchfiles(repo, backups.keys())
-mergemod.update(repo, repo.dirstate.p1(),
-False, True, matcher=m)
+mergemod.update(repo, repo.dirstate.p1(), branchmerge=False,
+force=True, matcher=m)
 
 # 3b. (apply)
 if dopatch:
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -184,7 +184,8 @@
 if pulls:
 if source != repo:
 exchange.pull(repo, source.peer(), heads=pulls)
-merge.update(repo, pulls[-1], False, False)
+merge.update(repo, pulls[-1], branchmerge=False,
+ force=False)
 p1, p2 = repo.dirstate.parents()
 pulls = []
 
@@ -249,7 +250,7 @@
 tr.close()
 if pulls:
 exchange.pull(repo, source.peer(), heads=pulls)
-merge.update(repo, pulls[-1], False, False)
+merge.update(repo, pulls[-1], branchmerge=False, force=False)
 finally:
 self.saveseries(revmap, merges)
 self.transplants.write()
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -656,7 +656,7 @@
 try:
 checkparents(repo, state)
 
-merge.update(repo, state.pendingctx, False, True)
+merge.update(repo, state.pendingctx, branchmerge=False, force=True)
 if (state.activebookmark
 and state.activebookmark in repo._bookmarks):
 bookmarks.activate(repo, state.activebookmark)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1188,7 +1188,7 @@
 else:
 if repo['.'].rev() != p1:
 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
- 

Re: I2P anonymous protocol want to use Mercurial

2018-10-18 Thread Augie Fackler


> On Oct 17, 2018, at 17:55, za3...@i2pmail.org wrote:
> 
> Hi There, 
> 
> Im from I2P community and our developers using Monotone to develop the famous 
> anonymous protocol I2P (or the invisible internet project).
> 
> Sadly monotone project died since 4 years ago, so we want to have 
> alternative. 
> 
> our conditions to make the development software to work well (specially with 
> I2P) , to have these criteria: 
> 
> - supports resume

You mean resumable clone operations? We don't have that today, but there's 
ongoing work to try and handle that.

> - key signed checkins

This is on our roadmap (https://www.mercurial-scm.org/wiki/CommitCustodyConcept 
and https://www.mercurial-scm.org/wiki/CommitSigningPlan) but nobody is (to my 
knowledge) tackling this work right now.

> - revocation of keys/trust function implementation

Same as previous.

> - easy migration of mtn history into new system

This as far as I know is easily done: `hg convert` ships with hg and should 
already support mtn.

> does Mercurial support these options? if no, is it on the road map? if no, 
> then why not?

Note that there'd probably be some fairly enthusiastic mentoring from existing 
committers on the commit signing bit, but that still means someone needs to 
volunteer to tackle what appears to be an at least somewhat challenging problem.

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

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


Re: [PATCH] addremove: add "ui." prefix to message color keys

2018-10-18 Thread Pulkit Goyal
On Thu, Oct 18, 2018 at 3:35 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1539864007 -32400
> #  Thu Oct 18 21:00:07 2018 +0900
> # Node ID 10e4e6d63c504f1117b0d49160e301d21818515f
> # Parent  17abd7febf13b99845f0305e92cfa6e321810a99
> addremove: add "ui." prefix to message color keys
>
> I don't like fully-colorized status/warning messages, and I want to disable
> them at all. If we'd supported a syntax like 'color.ui.*=none', I could
> easily turn addremove.added/removed off as well as ui.error. This patch is
> just for that.
>
> Since addremove colors aren't released yet, which were added at
> ddc1da134772,
> there are no compatibility concerns.
>

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


D5120: match: fix up a repr to not crash on Python 3

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> durin42 wrote in match.py:1176
> I could swear I've seen cases where it's not, but maybe we can prune this out 
> after the freeze?

Yes, after or not at all :) I mostly pointed it out so you know for future 
patches (if I'm even correct about it)

REPOSITORY
  rHG Mercurial

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

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


D5120: match: fix up a repr to not crash on Python 3

2018-10-18 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> martinvonz wrote in match.py:1176
> sorted() seems to return a list on py3, so maybe the list() call is 
> unnecessary?

I could swear I've seen cases where it's not, but maybe we can prune this out 
after the freeze?

REPOSITORY
  rHG Mercurial

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

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


D5152: debugcommands: avoid stack trace from debugindexstats in pure mode

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4f37af86d5d5: debugcommands: avoid stack trace from 
debugindexstats in pure mode (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5152?vs=12248=12250

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

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

CHANGE DETAILS

diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -176,7 +176,12 @@
 
 debugdelta chain basic output
 
-#if reporevlogstore
+#if reporevlogstore pure
+  $ hg debugindexstats
+  abort: debugindexstats only works with native code
+  [255]
+#endif
+#if reporevlogstore no-pure
   $ hg debugindexstats
   node trie capacity: 4
   node trie count: 2
@@ -186,7 +191,9 @@
   node trie misses: 1
   node trie splits: 1
   revs in memory: 3
+#endif
 
+#if reporevlogstore no-pure
   $ hg debugdeltachain -m
   rev  chain# chainlen prev   delta   sizerawsize  chainsize   
  ratio   lindist extradist extraratio
 0   11   -1base 44 43 44   
1.0232644 00.0
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1168,7 +1168,10 @@
 def debugindexstats(ui, repo):
 """show stats related to the changelog index"""
 repo.changelog.shortest(nullid, 1)
-for k, v in sorted(repo.changelog.index.stats().items()):
+index = repo.changelog.index
+if not util.safehasattr(index, 'stats'):
+raise error.Abort(_('debugindexstats only works with native code'))
+for k, v in sorted(index.stats().items()):
 ui.write('%s: %s\n' % (k, v))
 
 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)



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


D5153: update: clarify update() call sites by specifying argument names

2018-10-18 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
  merge.update() takes a lot of parameters and I get confused all the
  time which is which.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.py
  hgext/transplant.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/hg.py
  tests/test-revlog-ancestry.py

CHANGE DETAILS

diff --git a/tests/test-revlog-ancestry.py b/tests/test-revlog-ancestry.py
--- a/tests/test-revlog-ancestry.py
+++ b/tests/test-revlog-ancestry.py
@@ -22,10 +22,10 @@
 commit(name, time)
 
 def update(rev):
-merge.update(repo, rev, False, True)
+merge.update(repo, rev, branchmerge=False, force=True)
 
 def merge_(rev):
-merge.update(repo, rev, True, False)
+merge.update(repo, rev, branchmerge=True, force=False)
 
 if __name__ == '__main__':
 addcommit(b"A", 0)
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -846,7 +846,7 @@
 When overwrite is set, changes are clobbered, merged else
 
 returns stats (see pydoc mercurial.merge.applyupdates)"""
-return mergemod.update(repo, node, False, overwrite,
+return mergemod.update(repo, node, branchmerge=False, force=overwrite,
labels=['working copy', 'destination'],
updatecheck=updatecheck)
 
@@ -949,8 +949,8 @@
 """Branch merge with node, resolving changes. Return true if any
 unresolved conflicts."""
 if not abort:
-stats = mergemod.update(repo, node, True, force, mergeforce=mergeforce,
-labels=labels)
+stats = mergemod.update(repo, node, branchmerge=True, force=force,
+mergeforce=mergeforce, labels=labels)
 else:
 ms = mergemod.mergestate.read(repo)
 if ms.active():
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -643,7 +643,9 @@
 with dirstateguard.dirstateguard(repo, 'backout'):
 overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
 with ui.configoverride(overrides, 'backout'):
-stats = mergemod.update(repo, parent, True, True, node, False)
+stats = mergemod.update(repo, parent, branchmerge=True,
+force=True, ancestor=node,
+mergeancestor=False)
 repo.setparents(op1, op2)
 hg._showstats(repo, stats)
 if stats.unresolvedcount:
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -365,8 +365,8 @@
 if backups:
 # Equivalent to hg.revert
 m = scmutil.matchfiles(repo, backups.keys())
-mergemod.update(repo, repo.dirstate.p1(),
-False, True, matcher=m)
+mergemod.update(repo, repo.dirstate.p1(), branchmerge=False,
+force=True, matcher=m)
 
 # 3b. (apply)
 if dopatch:
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -184,7 +184,8 @@
 if pulls:
 if source != repo:
 exchange.pull(repo, source.peer(), heads=pulls)
-merge.update(repo, pulls[-1], False, False)
+merge.update(repo, pulls[-1], branchmerge=False,
+ force=False)
 p1, p2 = repo.dirstate.parents()
 pulls = []
 
@@ -249,7 +250,7 @@
 tr.close()
 if pulls:
 exchange.pull(repo, source.peer(), heads=pulls)
-merge.update(repo, pulls[-1], False, False)
+merge.update(repo, pulls[-1], branchmerge=False, force=False)
 finally:
 self.saveseries(revmap, merges)
 self.transplants.write()
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -656,7 +656,7 @@
 try:
 checkparents(repo, state)
 
-merge.update(repo, state.pendingctx, False, True)
+merge.update(repo, state.pendingctx, branchmerge=False, force=True)
 if (state.activebookmark
 and state.activebookmark in repo._bookmarks):
 bookmarks.activate(repo, state.activebookmark)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1188,7 +1188,7 @@
 else:
 if repo['.'].rev() != p1:
 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
-mergemod.update(repo, p1, 

D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-18 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Correct, no tests in hg-experimental. I did a basic sniff test, but I don't 
really know how we do curses tests in general.

REPOSITORY
  rHG Mercurial

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

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


D5120: match: fix up a repr to not crash on Python 3

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> match.py:1176
>  return dir in dirs
> -regex = b'rootfilesin: %s' % sorted(dirs)
> +regex = b'rootfilesin: %s' % 
> stringutil.pprint(list(sorted(dirs)))
>  matchfuncs.append(mf)

sorted() seems to return a list on py3, so maybe the list() call is unnecessary?

REPOSITORY
  rHG Mercurial

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

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


[PATCH RFC] bundle2: add the ability to fetch part content from another URL

2018-10-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539880502 -7200
#  Thu Oct 18 18:35:02 2018 +0200
# Node ID 9b6b8f0b3d821f17db216ba346934b8ffb6de1d5
# Parent  2c0aa02ecd5a05ae76b6345962ee3a0ef773bd8a
# EXP-Topic bundle2-remote
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9b6b8f0b3d82
bundle2: add the ability to fetch part content from another URL

This is a first changeset adding the ability to retrieve a part content from
another location. The part headers and its parameters still need to be set by
the initial server. This is especially helpful to save server CPU and
bandwidth when the part content is large and expensive to compute.

Such feature is very useful when combined with the stable-range slicing that
being experimented in a third party extension. However, it needs client-side
support in Core to be properly leveraged. It is inspired by Gregory Szorc
generic redirect support in protocol v2.

To be fully usable, this feature would need a couple more straightforward
changes:

* digests and size checking,
* compression support,
* protocol restriction (maybe),
* ability to disable the feature server side.
* advertised as a bundle2 capability

The current changeset is provided as an RFC.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1292,12 +1292,14 @@ class unbundlepart(unpackermixin):
 def _initparams(self, mandatoryparams, advisoryparams):
 """internal function to setup all logic related parameters"""
 # make it read only to prevent people touching it by mistake.
-self.mandatoryparams = tuple(mandatoryparams)
-self.advisoryparams  = tuple(advisoryparams)
+self.mandatoryparams = tuple(p for p in mandatoryparams
+ if not p[0].startswith('remote-content'))
+self.advisoryparams  = tuple(p for p in advisoryparams
+ if not p[0].startswith('remote-content'))
 # user friendly UI
-self.params = util.sortdict(self.mandatoryparams)
-self.params.update(self.advisoryparams)
-self.mandatorykeys = frozenset(p[0] for p in mandatoryparams)
+self.params = util.sortdict(mandatoryparams)
+self.params.update(advisoryparams)
+self.mandatorykeys = frozenset(p[0] for p in self.mandatoryparams)
 
 def _readheader(self):
 """read the header and setup the object"""
@@ -1330,10 +1332,25 @@ class unbundlepart(unpackermixin):
 advparams.append((self._fromheader(key), self._fromheader(value)))
 self._initparams(manparams, advparams)
 ## part payload
-self._payloadstream = util.chunkbuffer(self._payloadchunks())
+self._payloadstream = self._payloadstream()
 # we read the data, tell it
 self._initialized = True
 
+
+def _payloadstream(self):
+"""filelike object reading the part payload
+
+The payload might be fetch remotely."""
+
+payload = util.chunkbuffer(self._payloadchunks())
+remotecontent = self.params.pop('remote-content', None)
+if remotecontent is None:
+return payload
+else:
+fullurl = payload.read()
+data = url.open(self.ui, fullurl)
+return data
+
 def _payloadchunks(self):
 """Generator of decoded chunks in the payload."""
 return decodepayloadchunks(self.ui, self._fp)
diff --git a/tests/test-bundle2-remote-changegroup.t 
b/tests/test-bundle2-remote-changegroup.t
--- a/tests/test-bundle2-remote-changegroup.t
+++ b/tests/test-bundle2-remote-changegroup.t
@@ -74,6 +74,21 @@ Create an extension to test bundle2 remo
   >part = newpart(b'remote-changegroup')
   >for k, v in eval(args).items():
   >part.addparam(pycompat.sysbytes(k), pycompat.bytestr(v))
+  > elif verb == b'native-remote-changegroup':
+  >fullurl, filepath, revs = args.split()
+  >nodes = [c.node() for c in repo.set(revs)]
+  >outgoing = discovery.outgoing(repo, missingroots=nodes, 
missingheads=nodes)
+  >cgversion = b'02'
+  >cgstream = changegroup.makestream(repo, outgoing, cgversion, 
source,
+  >  bundlecaps=bundlecaps)
+  >with open(filepath, 'wb') as cachefile:
+  >for chunk in cgstream:
+  >cachefile.write(chunk)
+  >part = newpart(b'changegroup', fullurl)
+  >part.addparam(b'remote-content', b'1')
+  >part.addparam(b'version', cgversion)
+  >part.addparam(b'nbchanges', 
pycompat.bytestr(len(outgoing.missing)))
+  >part.addparam(b'targetphase', b'1')
   > elif verb == b'changegroup':
   > _common, heads = args.split()
   > 

D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision.
martinvonz added a comment.
This revision is now accepted and ready to land.


  Would be good to have tests, but I guess there are no tests in 
hg-experimental either? I'm not queuing because I'm biased.

REPOSITORY
  rHG Mercurial

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

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


Re: Rust extensions: the next step

2018-10-18 Thread Georges Racinet
On 10/18/2018 12:22 PM, Gregory Szorc wrote:
> One open item is full PyPy/cffi support. Ideally we’d only write the native 
> code interface once. But I think that means cffi everywhere and last I 
> looked, CPython into cffi was a bit slower compared to native extensions. I’m 
> willing to ignore cffi support for now (PyPy can use pure Python and rely on 
> JIT for faster execution). Maybe something like milksnake can help us here? 
> But I’m content with using the cpython crate to maintain a Rust-based 
> extension: that’s little different from what we do today and we shouldn’t let 
> perfect be the enemy of good.

One nice thing with the cpython crate is that it's just using the
CPython ABI. Therefore, there's nothing we can't do – only things that
are less practical. It's not very intuitive, but it should be ok with a
bit of practice.

About cffi, if milksnake can automate it, that's an easy win to be added
later (for now I still need to call in the C modules from the Rust code).

In both cases, we need to tighten it with comprehensive integration tests.

Cheers,

-- 
Georges Racinet
Anybox SAS, http://anybox.fr
Téléphone: +33 6 51 32 07 27
GPG: B59E 22AB B842 CAED 77F7 7A7F C34F A519 33AB 0A35, sur serveurs publics


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


D4312: New bookflow extension for bookmark-based branching

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D4312#77083, @idlsoft wrote:
  
  > First of all, thank you for reviewing the patch.
  >
  > We switched to mercurial a few months ago, mainly because of the narrow 
extension.
  
  
  Unrelated, do you use narrow with ellipses or without ellipses? Also I am 
sorry to say but in this cycle, narrow extension has under gone a lot of perf 
and correctness improvements and it won't be backward compatible in upcoming 
release. I will be writing some text about this in the releasenotes too, and 
you can contact me personally and I will be glad to help you with the BC 
changes.

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

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


D4312: New bookflow extension for bookmark-based branching

2018-10-18 Thread idlsoft (Sandu Turcan)
idlsoft added a comment.


  First of all, thank you for reviewing the patch.
  
  We switched to mercurial a few months ago, mainly because of the narrow 
extension. Feature branches workflow was something everyone in the company 
understood and adhered to, so trying to adopt something else wouldn't be 
practical.
  Besides it was unclear what that something would be. Short lived branches 
were not recommended, evolve and topics aren't in core and take a while to wrap 
your mind around. Besides whatever we picked, it would need to be fully 
supported by Teamcity and IntelliJ. And Rhodecode.
  Writing a proprietary extension wasn't our first choice, not by a long shot. 
But at some point it was just the lesser evil.
  
  I see a lot of people focus on the DAG aspect of the repo, which for a core 
DVCS developer makes a lot of sense. You also mentioned anonymous heads, but 
this is not what we were trying to solve at all.
  In fact, as we realized at some point, tip and heads weren't very 
consequential for our workflow, but maintaining DAG references reliably was.
  A common problem we encountered was somebody starting their work, and before 
committing anything doing an `hg pull -u`. This would then move their bookmark 
to someone else's changes.
  To this day I can't quite see why it would make sense to move bookmarks on 
update. What was the original workflow that lead to that design?
  
  Basing a solution on bookmarks seemed like the least intrusive option. It 
would be client-side only, the only thing the server needs to do is protect 
certain bookmarks via the acl extension.
  Tools already support bookmarks, they just need to be more predictable.
  
  That's what the extension does. Really, if there was a config setting to not 
move bookmarks on update, I'm not sure we would have written anything at all 
(well, the fact that `hg bookmark NAME` can either create or move a bookmark is 
also not great).
  All the other functionality is trivial, to help guide the workflow and avoid 
confusion. We don't autocreate bookmarks, we just make sure you have one when 
you commit.
  
  While I understand the concern of endorsing too many branching models, I 
don't see this extension as introducing anything drastically new.
  It just addresses issues in the default bookmark behavior, which made them 
unsuitable for a pretty established workflow.
  Whether or not this is approved, I hope that can be revisited in core, 
perhaps made configurable.

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

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


Re: Rust extensions: the next step

2018-10-18 Thread Georges Racinet
On 10/18/2018 04:09 PM, Yuya Nishihara wrote:
> On Thu, 18 Oct 2018 08:58:04 -0400, Josef 'Jeff' Sipek wrote:
>> On Thu, Oct 18, 2018 at 12:22:16 +0200, Gregory Szorc wrote:
>> ...
>>> Something else we may want to consider is a single Python module exposing
>>> the Rust code instead of N. Rust’s more aggressive cross function
>>> compilation optimization could result in better performance if everything
>>> is linked/exposed in a single shared library/module/extension. Maybe this
>>> is what you are proposing? It is unclear if Rust code is linked into the
>>> Python extension or loaded from a shared shared library.
>> (Warning: I suck at python, aren't an expert on rust, but have more
>> knowledge about ELF linking/loading/etc. than is healthy.)
>>
>> Isn't there also a distinction between code layout (separate crates) and the
>> actual binary that cargo/rustc builds?  IOW, the code could (and probably
>> should) be nicely separated but rustc can combine all the crates' code into
>> one big binary for loading into python.  Since it would see all the code, it
>> can do its fancy optimizations without impacting code readability.
> IIUC, it is. Perhaps, the rustext is a single binary exporting multiple
> submodules?
Yes totally, it's exactly as Josef writes. To demonstrate, here's what I
have :

$ ls mercurial/*.so
mercurial/rustext.so  mercurial/zstd.so
$ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mercurial import rustext
>>> dir(rustext)
['GraphError', '__doc__', '__file__', '__name__', '__package__',
'ancestors']
>>> from mercurial.rustext import ancestors
>>> ancestors is rustext.ancestors
True
>>> dir(ancestors)
['AncestorsIterator', '__doc__', '__name__', '__package__']

So, in short, it's a single shared library that can hold a bunch of
modules. The submodules are themselves initialized from the Rust code.
Here's the definition of 'rustext' itself. It follows the pattern
expected by Josef.

$ tail rust/hg-cpython/src/lib.rs
mod ancestors;  // corresponds to src/ancestors.rs
mod exceptions;

py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| {
    m.add(py, "__doc__", "Mercurial core concepts - Rust implementation")?;

    m.add(py, "ancestors", ancestors::init_module(py)?)?;
    m.add(py, "GraphError", py.get_type::())?;
    Ok(())
});

(Mark confirmed to me during the sprint that adding submodules on the
fly was doable).

Indeed I hope the Rust compiler can do lots of optimizations in that
single shared library object.
>
> I expect "rustext" (or its upper layer) to be a shim over Rust-based modules
> and cexts. So if you do policy.importmod('parsers'), it will return
> cext.parsers, whereas policy.importmod('ancestor') will return 
> rustext.ancestor,
> though I have no idea if there will be cext/pure.ancestor.
Yes, it's quite possible to add a new module policy this way. After all,
from mercurial.policy, it behaves in the same way as the cext package
does and the fact that we have a single shared library instead of
several ones is an implementation detail, hidden by Python's import
machinery.

But this opens another, longer term, question: currently what I have in
mercurial.rustext.ancestor has only a fragment of what
mercurial.ancestor provides. Therefore to have mercurial.policy handle
it, we'll need either to take such partial cases into account, or decide
to translate the whole Python module in Rust. For the time being, I'm
simply doing an import and catch the error to fallback to the Python
version.

Regards,

-- 
Georges Racinet
Anybox SAS, http://anybox.fr
Téléphone: +33 6 51 32 07 27
GPG: B59E 22AB B842 CAED 77F7 7A7F C34F A519 33AB 0A35, sur serveurs publics


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


D5152: debugcommands: avoid stack trace from debugindexstats in pure mode

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

REVISION SUMMARY
  This has been broken since I added it in 
https://phab.mercurial-scm.org/rHGd71e0ba34d9bba52ca6956fbefe46bdfbb8d4284 
(debugcommands:
  add a debugindexstats command, 2018-08-08). This patch also fixes the
  test.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -176,7 +176,12 @@
 
 debugdelta chain basic output
 
-#if reporevlogstore
+#if reporevlogstore pure
+  $ hg debugindexstats
+  abort: debugindexstats only works with native code
+  [255]
+#endif
+#if reporevlogstore no-pure
   $ hg debugindexstats
   node trie capacity: 4
   node trie count: 2
@@ -186,7 +191,9 @@
   node trie misses: 1
   node trie splits: 1
   revs in memory: 3
+#endif
 
+#if reporevlogstore no-pure
   $ hg debugdeltachain -m
   rev  chain# chainlen prev   delta   sizerawsize  chainsize   
  ratio   lindist extradist extraratio
 0   11   -1base 44 43 44   
1.0232644 00.0
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1168,7 +1168,10 @@
 def debugindexstats(ui, repo):
 """show stats related to the changelog index"""
 repo.changelog.shortest(nullid, 1)
-for k, v in sorted(repo.changelog.index.stats().items()):
+index = repo.changelog.index
+if not util.safehasattr(index, 'stats'):
+raise error.Abort(_('debugindexstats only works with native code'))
+for k, v in sorted(index.stats().items()):
 ui.write('%s: %s\n' % (k, v))
 
 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)



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


D5151: tests: fix up pure case of test-sqlitestore.t

2018-10-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0a212b643277: tests: fix up pure case of test-sqlitestore.t 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5151?vs=12245=12247

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

AFFECTED FILES
  tests/test-sqlitestore.t

CHANGE DETAILS

diff --git a/tests/test-sqlitestore.t b/tests/test-sqlitestore.t
--- a/tests/test-sqlitestore.t
+++ b/tests/test-sqlitestore.t
@@ -22,7 +22,7 @@
   dotencode
   exp-sqlite-001
   exp-sqlite-comp-001=zstd (zstd !)
-  exp-sqlite-comp-001-zlib (no-zstd !)
+  exp-sqlite-comp-001=$BUNDLE2_COMPRESSIONS$ (no-zstd !)
   fncache
   generaldelta
   revlogv1



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


D5150: tests: don't emit false failures when sqlite3 is missing

2018-10-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc3ad9ef0876c: tests: dont emit false failures when 
sqlite3 is missing (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5150?vs=12244=12246

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

AFFECTED FILES
  tests/test-duplicateoptions.py
  tests/test-storage.py

CHANGE DETAILS

diff --git a/tests/test-storage.py b/tests/test-storage.py
--- a/tests/test-storage.py
+++ b/tests/test-storage.py
@@ -17,9 +17,12 @@
 storage as storagetesting,
 )
 
-from hgext import (
-sqlitestore,
-)
+try:
+from hgext import (
+sqlitestore,
+)
+except ImportError:
+sqlitestore = None
 
 try:
 from mercurial import zstd
@@ -110,12 +113,13 @@
 else:
 raise error.Abort(b'must supply rawtext or delta arguments')
 
-sqlitefileindextests = storagetesting.makeifileindextests(
-makesqlitefile, maketransaction, addrawrevisionsqlite)
-sqlitefiledatatests = storagetesting.makeifiledatatests(
-makesqlitefile, maketransaction, addrawrevisionsqlite)
-sqlitefilemutationtests = storagetesting.makeifilemutationtests(
-makesqlitefile, maketransaction, addrawrevisionsqlite)
+if sqlitestore is not None:
+sqlitefileindextests = storagetesting.makeifileindextests(
+makesqlitefile, maketransaction, addrawrevisionsqlite)
+sqlitefiledatatests = storagetesting.makeifiledatatests(
+makesqlitefile, maketransaction, addrawrevisionsqlite)
+sqlitefilemutationtests = storagetesting.makeifilemutationtests(
+makesqlitefile, maketransaction, addrawrevisionsqlite)
 
 if __name__ == '__main__':
 silenttestrunner.main(__name__)
diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py
--- a/tests/test-duplicateoptions.py
+++ b/tests/test-duplicateoptions.py
@@ -8,6 +8,11 @@
 
 ignore = {b'highlight', b'win32text', b'factotum', b'beautifygraph'}
 
+try:
+import sqlite3
+except ImportError:
+ignore.add(b'sqlitestore')
+
 if os.name != 'nt':
 ignore.add(b'win32mbcs')
 



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


D5151: tests: fix up pure case of test-sqlitestore.t

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

REVISION SUMMARY
  This is clearly what the line should read based on the "force to zlib"
  section below, so I'm guessing it just got overlooked during development.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-sqlitestore.t

CHANGE DETAILS

diff --git a/tests/test-sqlitestore.t b/tests/test-sqlitestore.t
--- a/tests/test-sqlitestore.t
+++ b/tests/test-sqlitestore.t
@@ -22,7 +22,7 @@
   dotencode
   exp-sqlite-001
   exp-sqlite-comp-001=zstd (zstd !)
-  exp-sqlite-comp-001-zlib (no-zstd !)
+  exp-sqlite-comp-001=$BUNDLE2_COMPRESSIONS$ (no-zstd !)
   fncache
   generaldelta
   revlogv1



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


mercurial@40324: new changeset

2018-10-18 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/6637b079ae45
changeset:   40324:6637b079ae45
bookmark:@
tag: tip
user:Matt Harbison 
date:Thu Sep 20 17:27:01 2018 -0700
summary: lfs: autoload the extension when cloning from repo with lfs enabled

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


D5150: tests: don't emit false failures when sqlite3 is missing

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

REVISION SUMMARY
  I'm honestly surprised we have buildbot coverage for this, but we do!

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-duplicateoptions.py
  tests/test-storage.py

CHANGE DETAILS

diff --git a/tests/test-storage.py b/tests/test-storage.py
--- a/tests/test-storage.py
+++ b/tests/test-storage.py
@@ -17,9 +17,12 @@
 storage as storagetesting,
 )
 
-from hgext import (
-sqlitestore,
-)
+try:
+from hgext import (
+sqlitestore,
+)
+except ImportError:
+sqlitestore = None
 
 try:
 from mercurial import zstd
@@ -110,12 +113,13 @@
 else:
 raise error.Abort(b'must supply rawtext or delta arguments')
 
-sqlitefileindextests = storagetesting.makeifileindextests(
-makesqlitefile, maketransaction, addrawrevisionsqlite)
-sqlitefiledatatests = storagetesting.makeifiledatatests(
-makesqlitefile, maketransaction, addrawrevisionsqlite)
-sqlitefilemutationtests = storagetesting.makeifilemutationtests(
-makesqlitefile, maketransaction, addrawrevisionsqlite)
+if sqlitestore is not None:
+sqlitefileindextests = storagetesting.makeifileindextests(
+makesqlitefile, maketransaction, addrawrevisionsqlite)
+sqlitefiledatatests = storagetesting.makeifiledatatests(
+makesqlitefile, maketransaction, addrawrevisionsqlite)
+sqlitefilemutationtests = storagetesting.makeifilemutationtests(
+makesqlitefile, maketransaction, addrawrevisionsqlite)
 
 if __name__ == '__main__':
 silenttestrunner.main(__name__)
diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py
--- a/tests/test-duplicateoptions.py
+++ b/tests/test-duplicateoptions.py
@@ -8,6 +8,11 @@
 
 ignore = {b'highlight', b'win32text', b'factotum', b'beautifygraph'}
 
+try:
+import sqlite3
+except ImportError:
+ignore.add(b'sqlitestore')
+
 if os.name != 'nt':
 ignore.add(b'win32mbcs')
 



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


Re: [PATCH] color: issue warning in yellow

2018-10-18 Thread Yuya Nishihara
On Thu, 18 Oct 2018 06:14:43 -0700, Martin von Zweigbergk wrote:
> On Thu, Oct 18, 2018, 05:42 Yuya Nishihara  
> > On Wed, 17 Oct 2018 15:17:58 +0200, Boris FELD wrote:
> > > On 21/08/2018 15:15, Yuya Nishihara wrote:
> > > > On Mon, 20 Aug 2018 11:14:23 -0700, Martin von Zweigbergk via
> > Mercurial-devel wrote:
> > > >> On Mon, Aug 20, 2018 at 9:26 AM Kyle Lippincott 
> > wrote:
> > > >>
> > > >>> Bright/bold yellow should be considered unavailable.  "Normal"
> > yellow,
> > > >>> which is closer to brown or maybe gold on many screens, is fine.
> > > >>>
> > > >> Ah, and we already use yellow for a few things (as you also pointed
> > out).
> > > >> Sorry I didn't even check that.
> > > >>
> > > >>
> > > >>>   At Google, and I think other tools like clang, generally use
> > magenta I
> > > >>> believe, but I have no strong preference.  Keep in mind that
> > ui.prompt is
> > > >>> also yellow a couple lines below.
> > > >>>
> > > >> Good point about ui.prompt. Yellow seems like the obvious choice for
> > > >> warnings, so do we want to change the color for the prompt?
> > > > FWIW, I don't like the red-colored "error" since it's hard to spot in
> > > > white-on-black screen. Well, it's readable, but not significant. A
> > plain
> > > > "yellow" (i.e. dark yellow) would have the same effect.
> > >
> > > I'm not sure what is the status of this series.
> > >
> > > Rereading the discussion, it seems like the yellow on white background
> > > is readable. Is there anything else blocking this improvement
> >
> > I'm not sure either, but for the record, I (and maybe David Demelier) voted
> > against this. I want an essential part of console output to be white
> > because
> > that's what I configured for. I'd rather want warning/error messages to be
> > prefixed with highlighted tags (e.g. abort: blah blah...)
> >
> 
> I'm for the patch.
> 
> I also agree with Yuya that it would be better to color only a short
> prefix. That's probably a lot more work and can be done in a follow-up.
> However, I understand if Yuya and others think it's too distracting with
> all the color before that is done, so I'm also fine with waiting until
> that's fixed. Do we have a common prefix for warnings?

I don't think there is, but I think we can make ui.warn() add 'warning: %s'.
If that breaks scripting usage, it can be behind a config knob. Anyway, that
won't be a trivial change, so my position is to wait the release.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Rust extensions: the next step

2018-10-18 Thread Yuya Nishihara
On Thu, 18 Oct 2018 08:58:04 -0400, Josef 'Jeff' Sipek wrote:
> On Thu, Oct 18, 2018 at 12:22:16 +0200, Gregory Szorc wrote:
> ...
> > Something else we may want to consider is a single Python module exposing
> > the Rust code instead of N. Rust’s more aggressive cross function
> > compilation optimization could result in better performance if everything
> > is linked/exposed in a single shared library/module/extension. Maybe this
> > is what you are proposing? It is unclear if Rust code is linked into the
> > Python extension or loaded from a shared shared library.
> 
> (Warning: I suck at python, aren't an expert on rust, but have more
> knowledge about ELF linking/loading/etc. than is healthy.)
> 
> Isn't there also a distinction between code layout (separate crates) and the
> actual binary that cargo/rustc builds?  IOW, the code could (and probably
> should) be nicely separated but rustc can combine all the crates' code into
> one big binary for loading into python.  Since it would see all the code, it
> can do its fancy optimizations without impacting code readability.

IIUC, it is. Perhaps, the rustext is a single binary exporting multiple
submodules?

I expect "rustext" (or its upper layer) to be a shim over Rust-based modules
and cexts. So if you do policy.importmod('parsers'), it will return
cext.parsers, whereas policy.importmod('ancestor') will return rustext.ancestor,
though I have no idea if there will be cext/pure.ancestor.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] blackbox: add configitem for format of log timestamps

2018-10-18 Thread Matthew DeVore

# HG changeset patch
# User Matt DeVore 
# Date 1539816481 25200
#  Wed Oct 17 15:48:01 2018 -0700
# Node ID b42c2264048f8859c8966577a1929aa80132ffa5
# Parent  5644f7c8982e805e53f56fcbfe0322e9de58a934
blackbox: add configitem for format of log timestamps

Sometimes blackbox logs are used to report performance problems, but the
timestamps are only at second granularity, so often the timings have to
stated separately by the reporter. This is inconvenient and error-prone,
so I would like to include %f in the date format. This patch makes that
possible.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -33,6 +33,11 @@ Examples::
   # rotate up to N log files when the current one gets too big
   maxfiles = 3

+  [blackbox]
+  # Include nanoseconds in log entries with %f (see Python function
+  # datetime.datetime.strftime)
+  date-format = '%Y-%m-%d @ %H:%M:%S.%f'
+
 """

 from __future__ import absolute_import
@@ -82,6 +87,9 @@ configitem('blackbox', 'maxfiles',
 configitem('blackbox', 'track',
 default=lambda: ['*'],
 )
+configitem('blackbox', 'date-format',
+default='%Y/%m/%d %H:%M:%S',
+)

 lastui = None

@@ -169,7 +177,9 @@ def wrapui(ui):
 return
 ui._bbinlog = True
 default = self.configdate('devel', 'default-date')
-date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
+format = ui.config('blackbox', 'date-format')
+date = dateutil.datestr(default,
+ui.config('blackbox', 'date-format'))
 user = procutil.getuser()
 pid = '%d' % procutil.getpid()
 formattedmsg = msg[0] % msg[1:]
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -82,6 +82,16 @@ recursive aliases work correctly
   1970/01/01 00:00:00 bob @ (5000)> 
so-confusing exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @ (5000)> 
blackbox

+custom date format
+  $ rm ./.hg/blackbox.log
+  $ hg --config blackbox.date-format='%Y-%m-%d @ %H:%M:%S' \
+  >--config devel.default-date='1334347993 0' --traceback status
+  A a
+  $ hg blackbox
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status
+  2012-04-13 @ 20:13:13 bob @ (5000)> 
--config 'blackbox.date-format=%Y-%m-%d @ %H:%M:%S' --config 
'devel.default-date=1334347993 0' --traceback status exited 0 after * seconds 
(glob)
+  1970/01/01 00:00:00 bob @ (5000)> 
blackbox
+
 incoming change tracking

 create two heads to verify that we only see one change in the log later
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Mercurial match the options?

2018-10-18 Thread bo0od
Hi There, 

i have sent this request before through the mailing list using susimail
before, but it seems that im not receiving the replies back. Thus im
using this email instead. I hope i did not disturb the mailing list.
sorry for inconvenient:

"
Im from I2P community and our developers using Monotone to develop the famous 
anonymous protocol I2P (or the invisible internet project).

Sadly monotone project died since 4 years ago, so we want to have alternative. 

our conditions to make the development software to work well (specially with 
I2P) , to have these criteria: 

- supports resume
- key signed checkins
- revocation of keys/trust function implementation
- easy migration of mtn history into new system

does Mercurial support these options? if no, is it on the road map? if no, then 
why not?

Thank You!"

feel free to reply on this email
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 9] py3: byte-stringify most literals in test-commandserver.t

2018-10-18 Thread Pulkit Goyal
On Thu, Oct 18, 2018 at 3:37 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1539668129 -7200
> #  Tue Oct 16 07:35:29 2018 +0200
> # Node ID 826a987530cd48a93758104b205065e2192227c8
> # Parent  2c5835b4246be6ea42e4b4c7b42dc23e379e2c23
> py3: byte-stringify most literals in test-commandserver.t
>
> print() calls will be replaced by bprint().
>
> # skip-blame just tons of b'' prefixes.
>

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


[PATCH 2 of 2 V2] streamclone: abort when client needs to handle obsmarkers, but doesn't

2018-10-18 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1538754012 -28800
#  Fri Oct 05 23:40:12 2018 +0800
# Node ID 7827e8870afe4a1505767a748dd07e94569196ac
# Parent  212b1f69138c7d1fa166356448305219259f34f9
# EXP-Topic stream-obsmarkers
streamclone: abort when client needs to handle obsmarkers, but doesn't

When client doesn't have any of obsolescence markers exchange capabilities,
then it's safe to say it can't handle obsmarkers. However, if it understands
even one format version, then stream clones are fine -- client can use
"obsmarkers" bundle2 part.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1700,7 +1700,10 @@ def addpartbundlestream2(bundler, repo, 
 includeobsmarkers = False
 if repo.obsstore:
 remoteversions = obsmarkersversion(bundler.capabilities)
-if repo.obsstore._version in remoteversions:
+if not remoteversions:
+raise error.Abort(_('server has obsolescence markers, but client '
+'cannot receive them via stream clone'))
+elif repo.obsstore._version in remoteversions:
 includeobsmarkers = True
 
 filecount, bytecount, it = streamclone.generatev2(repo, includepats,
diff --git a/tests/test-clone-uncompressed.t b/tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -556,6 +556,12 @@ Clone non-publishing with obsolescence
   $ hg debugobsolete -R with-obsolescence
   50382b884f66690b7045cac93a540cba4d4c906f 0 
{c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +) 
{'user': 'test'}
 
+  $ hg clone -U --stream --config experimental.evolution=0 
http://localhost:$HGPORT with-obsolescence-no-evolution
+  streaming all changes
+  remote: abort: server has obsolescence markers, but client cannot receive 
them via stream clone
+  abort: pull failed on remote
+  [255]
+
   $ killdaemons.py
 
 #endif
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 V2] streamclone: include obsstore file into stream bundle if client can read it

2018-10-18 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1538753237 -28800
#  Fri Oct 05 23:27:17 2018 +0800
# Node ID 212b1f69138c7d1fa166356448305219259f34f9
# Parent  89cba88e95ed84b6e5e49ecc51ebf7119cfaa6b4
# EXP-Topic stream-obsmarkers
streamclone: include obsstore file into stream bundle if client can read it

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1697,8 +1697,15 @@ def addpartbundlestream2(bundler, repo, 
 if (includepats or excludepats) and not narrowstream:
 raise error.Abort(_('server does not support narrow stream clones'))
 
+includeobsmarkers = False
+if repo.obsstore:
+remoteversions = obsmarkersversion(bundler.capabilities)
+if repo.obsstore._version in remoteversions:
+includeobsmarkers = True
+
 filecount, bytecount, it = streamclone.generatev2(repo, includepats,
-  excludepats)
+  excludepats,
+  includeobsmarkers)
 requirements = _formatrequirementsspec(repo.requirements)
 part = bundler.newpart('stream2', data=it)
 part.addparam('bytecount', '%d' % bytecount, mandatory=True)
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -532,7 +532,7 @@ def _emit2(repo, entries, totalfilesize)
 finally:
 fp.close()
 
-def generatev2(repo, includes, excludes):
+def generatev2(repo, includes, excludes, includeobsmarkers):
 """Emit content for version 2 of a streaming clone.
 
 the data stream consists the following entries:
@@ -567,6 +567,9 @@ def generatev2(repo, includes, excludes)
 if repo.svfs.exists(name):
 totalfilesize += repo.svfs.lstat(name).st_size
 entries.append((_srcstore, name, _filefull, None))
+if includeobsmarkers and repo.svfs.exists('obsstore'):
+totalfilesize += repo.svfs.lstat('obsstore').st_size
+entries.append((_srcstore, 'obsstore', _filefull, None))
 for name in cacheutil.cachetocopy(repo):
 if repo.cachevfs.exists(name):
 totalfilesize += repo.cachevfs.lstat(name).st_size
diff --git a/tests/test-clone-uncompressed.t b/tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -514,3 +514,48 @@ stream v1 unsuitable for non-publishing 
 #endif
 
   $ killdaemons.py
+
+#if stream-legacy
+
+With v1 of the stream protocol, changeset are always cloned as public. There's
+no obsolescence markers exchange in stream v1.
+
+#endif
+#if stream-bundle2
+
+Stream repository with obsolescence
+---
+
+Clone non-publishing with obsolescence
+
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > evolution=all
+  > EOF
+
+  $ cd server
+  $ echo foo > foo
+  $ hg -q commit -m 'about to be pruned'
+  $ hg debugobsolete `hg log -r . -T '{node}'` -d '0 0' -u test 
--record-parents
+  obsoleted 1 changesets
+  $ hg up null -q
+  $ hg log -T '{rev}: {phase}\n'
+  1: draft
+  0: draft
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid
+  $ cat hg.pid > $DAEMON_PIDS
+  $ cd ..
+
+  $ hg clone -U --stream http://localhost:$HGPORT with-obsolescence
+  streaming all changes
+  1035 files to transfer, 97.1 KB of data
+  transferred 97.1 KB in * seconds (* */sec) (glob)
+  $ hg -R with-obsolescence log -T '{rev}: {phase}\n'
+  1: draft
+  0: draft
+  $ hg debugobsolete -R with-obsolescence
+  50382b884f66690b7045cac93a540cba4d4c906f 0 
{c17445101a72edac06facd130d14808dfbd5c7c2} (Thu Jan 01 00:00:00 1970 +) 
{'user': 'test'}
+
+  $ killdaemons.py
+
+#endif
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4895: narrow: when widening, don't include manifests the client already has

2018-10-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >> narrowwirepeer.py:15
  >  >  hg,
  >  >  match as matchmod,
  >  >  narrowspec,
  > 
  > removed this in flight to make pyflakes happy.
  
  So did I. :)

REPOSITORY
  rHG Mercurial

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

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


Re: D4895: narrow: when widening, don't include manifests the client already has

2018-10-18 Thread Yuya Nishihara
> > narrowwirepeer.py:15
> >  hg,
> >  match as matchmod,
> >  narrowspec,
> 
> removed this in flight to make pyflakes happy.

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


Re: D5137: streamclone: new server config and some API changes for narrow stream clones

2018-10-18 Thread Pulkit Goyal
On Thu, Oct 18, 2018 at 4:10 PM Martin von Zweigbergk via Mercurial-devel <
mercurial-devel@mercurial-scm.org> wrote:

>
>
> On Thu, Oct 18, 2018, 02:22 pulkit (Pulkit Goyal) <
> phabrica...@mercurial-scm.org wrote:
>
>> pulkit added a comment.
>>
>>
>>   @martinvonz many thanks for changing things in flight. Any reason why
>> https://phab.mercurial-scm.org/D5138 and
>> https://phab.mercurial-scm.org/D5139 are not considered during review
>> because with them, you won't have to change much things except the config
>> knob to experimental.
>>
>
> Each patch should pass tests in its own. Otherwise code archeology
> (including bisection) will get much harder.
>
> I just got a new computer that's fast enough that i can run tests on each
> patch. I had been taking shortcuts before, so if you had sent knowingly
> broken patches before, that may have been why I didn't notice :)
>
>>
Hehe, I generally run test-suite on the full series but it's very rare that
I break something in one patch and then fix in another. Nice to know about
the new computer btw ;)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] color: issue warning in yellow

2018-10-18 Thread Martin von Zweigbergk via Mercurial-devel
On Thu, Oct 18, 2018, 05:42 Yuya Nishihara  On Wed, 17 Oct 2018 15:17:58 +0200, Boris FELD wrote:
> > On 21/08/2018 15:15, Yuya Nishihara wrote:
> > > On Mon, 20 Aug 2018 11:14:23 -0700, Martin von Zweigbergk via
> Mercurial-devel wrote:
> > >> On Mon, Aug 20, 2018 at 9:26 AM Kyle Lippincott 
> wrote:
> > >>
> > >>> Bright/bold yellow should be considered unavailable.  "Normal"
> yellow,
> > >>> which is closer to brown or maybe gold on many screens, is fine.
> > >>>
> > >> Ah, and we already use yellow for a few things (as you also pointed
> out).
> > >> Sorry I didn't even check that.
> > >>
> > >>
> > >>>   At Google, and I think other tools like clang, generally use
> magenta I
> > >>> believe, but I have no strong preference.  Keep in mind that
> ui.prompt is
> > >>> also yellow a couple lines below.
> > >>>
> > >> Good point about ui.prompt. Yellow seems like the obvious choice for
> > >> warnings, so do we want to change the color for the prompt?
> > > FWIW, I don't like the red-colored "error" since it's hard to spot in
> > > white-on-black screen. Well, it's readable, but not significant. A
> plain
> > > "yellow" (i.e. dark yellow) would have the same effect.
> >
> > I'm not sure what is the status of this series.
> >
> > Rereading the discussion, it seems like the yellow on white background
> > is readable. Is there anything else blocking this improvement
>
> I'm not sure either, but for the record, I (and maybe David Demelier) voted
> against this. I want an essential part of console output to be white
> because
> that's what I configured for. I'd rather want warning/error messages to be
> prefixed with highlighted tags (e.g. abort: blah blah...)
>

I'm for the patch.

I also agree with Yuya that it would be better to color only a short
prefix. That's probably a lot more work and can be done in a follow-up.
However, I understand if Yuya and others think it's too distracting with
all the color before that is done, so I'm also fine with waiting until
that's fixed. Do we have a common prefix for warnings?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4820: logtoprocess: sends the canonical command name to the subprocess

2018-10-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > - a/hgext/logtoprocess.py +++ b/hgext/logtoprocess.py @@ -40,6 +40,9 @@ 
import sys
  > 
  >   from mercurial import ( +dispatch, +encoding, +extensions,
  
  Unused.
  
  > @@ -110,6 +113,12 @@
  > 
  >   script = self.config('logtoprocess', event)
  >   if script:
  >   if msg:
  > 
  > +
  >  +# extract the canonical command from the passed opts
  >  +canonical_command = opts.pop("canonical_command", 
None)
  >  +if canonical_command is None:
  >  +canonical_command = ""
  >  +
  > 
  >   1. try to format the log message given the remaining
  >   2. arguments try: @@ -134,7 +143,8 @@ for key, value in opts.iteritems()) 
env = dict(itertools.chain(procutil.shellenviron().items(), msgpairs, optpairs),
  > - EVENT=event, HGPID=str(os.getpid())) +   
EVENT=event, HGPID=str(os.getpid()), +   
LTP_COMMAND=canonical_command)
  
  As I said before, `LTP_*` doesn't sound great. Can't we simply pass in
  `canonical_command` as `OPT_CANONICAL_COMMAND`? If we really want to name
  it other than `OPT_*`, please document it.
  
  And I noticed there's no test. Can you add some?

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #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: D4820: logtoprocess: sends the canonical command name to the subprocess

2018-10-18 Thread Yuya Nishihara
> --- a/hgext/logtoprocess.py
> +++ b/hgext/logtoprocess.py
> @@ -40,6 +40,9 @@
>  import sys
>  
>  from mercurial import (
> +dispatch,
> +encoding,
> +extensions,

Unused.

> @@ -110,6 +113,12 @@
>  script = self.config('logtoprocess', event)
>  if script:
>  if msg:
> +
> +# extract the canonical command from the passed opts
> +canonical_command = opts.pop("canonical_command", None)
> +if canonical_command is None:
> +canonical_command = ""
> +
>  # try to format the log message given the remaining
>  # arguments
>  try:
> @@ -134,7 +143,8 @@
>  for key, value in opts.iteritems())
>  env = dict(itertools.chain(procutil.shellenviron().items(),
> msgpairs, optpairs),
> -   EVENT=event, HGPID=str(os.getpid()))
> +   EVENT=event, HGPID=str(os.getpid()),
> +   LTP_COMMAND=canonical_command)

As I said before, `LTP_*` doesn't sound great. Can't we simply pass in
`canonical_command` as `OPT_CANONICAL_COMMAND`? If we really want to name
it other than `OPT_*`, please document it.

And I noticed there's no test. Can you add some?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5107: localrepo: ensure we properly %-format int in exception throw

2018-10-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa2ebdca4d10e: localrepo: ensure we properly %-format int in 
exception throw (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5107?vs=12173=12243

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1282,7 +1282,8 @@
 raise error.FilteredRepoLookupError(_("filtered revision '%s'")
 % pycompat.bytestr(changeid))
 except (IndexError, LookupError):
-raise error.RepoLookupError(_("unknown revision '%s'") % changeid)
+raise error.RepoLookupError(
+_("unknown revision '%s'") % pycompat.bytestr(changeid))
 except error.WdirUnsupported:
 return context.workingctx(self)
 



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


D5148: py3: add 5 new passing tests to whitelist caught by buildbot

2018-10-18 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb1eb19301c94: py3: add 5 new passing tests to whitelist 
caught by buildbot (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5148?vs=12238=12241

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -155,6 +155,7 @@
 test-empty.t
 test-encode.t
 test-encoding-func.py
+test-encoding-textwrap.t
 test-encoding.t
 test-eol-add.t
 test-eol-clone.t
@@ -215,6 +216,7 @@
 test-graft.t
 test-grep.t
 test-hardlinks.t
+test-help.t
 test-hg-parseurl.py
 test-hghave.t
 test-hgignore.t
@@ -375,6 +377,7 @@
 test-narrow-clone-no-ellipsis.t
 test-narrow-clone-non-narrow-server.t
 test-narrow-clone-nonlinear.t
+test-narrow-clone-stream.t
 test-narrow-clone.t
 test-narrow-commit.t
 test-narrow-copies.t
@@ -432,6 +435,7 @@
 test-phases.t
 test-profile.t
 test-progress.t
+test-propertycache.py
 test-pull-branch.t
 test-pull-http.t
 test-pull-permission.t
@@ -629,6 +633,7 @@
 test-wireproto-command-lookup.t
 test-wireproto-command-manifestdata.t
 test-wireproto-command-pushkey.t
+test-wireproto-command-rawstorefiledata.t
 test-wireproto-framing.py
 test-wireproto-serverreactor.py
 test-wireproto.py



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


Re: D5137: streamclone: new server config and some API changes for narrow stream clones

2018-10-18 Thread Martin von Zweigbergk via Mercurial-devel
On Thu, Oct 18, 2018, 02:22 pulkit (Pulkit Goyal) <
phabrica...@mercurial-scm.org wrote:

> pulkit added a comment.
>
>
>   @martinvonz many thanks for changing things in flight. Any reason why
> https://phab.mercurial-scm.org/D5138 and
> https://phab.mercurial-scm.org/D5139 are not considered during review
> because with them, you won't have to change much things except the config
> knob to experimental.
>

Each patch should pass tests in its own. Otherwise code archeology
(including bisection) will get much harder.

I just got a new computer that's fast enough that i can run tests on each
patch. I had been taking shortcuts before, so if you had sent knowingly
broken patches before, that may have been why I didn't notice :)


> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D5137
>
> To: pulkit, durin42, #hg-reviewers, martinvonz
> Cc: martinvonz, indygreg, mercurial-devel
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Rust extensions: the next step

2018-10-18 Thread Josef 'Jeff' Sipek
On Thu, Oct 18, 2018 at 12:22:16 +0200, Gregory Szorc wrote:
...
> Something else we may want to consider is a single Python module exposing
> the Rust code instead of N. Rust’s more aggressive cross function
> compilation optimization could result in better performance if everything
> is linked/exposed in a single shared library/module/extension. Maybe this
> is what you are proposing? It is unclear if Rust code is linked into the
> Python extension or loaded from a shared shared library.

(Warning: I suck at python, aren't an expert on rust, but have more
knowledge about ELF linking/loading/etc. than is healthy.)

Isn't there also a distinction between code layout (separate crates) and the
actual binary that cargo/rustc builds?  IOW, the code could (and probably
should) be nicely separated but rustc can combine all the crates' code into
one big binary for loading into python.  Since it would see all the code, it
can do its fancy optimizations without impacting code readability.

Jeff.

-- 
C is quirky, flawed, and an enormous success.
- Dennis M. Ritchie.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 3] help: document the server capabilities added by the LFS extension

2018-10-18 Thread Yuya Nishihara
On Wed, 17 Oct 2018 22:09:00 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1539824743 14400
> #  Wed Oct 17 21:05:43 2018 -0400
> # Node ID 197a387c4ed9a510a5d92e68e7be7752b327cb99
> # Parent  d916ed3ca951a3bfd37bf29f54dc70f82787512a
> help: document the server capabilities added by the LFS extension

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


Re: [PATCH] py3: fix test-propertycache.py on Windows

2018-10-18 Thread Yuya Nishihara
On Wed, 17 Oct 2018 23:56:38 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1538099653 14400
> #  Thu Sep 27 21:54:13 2018 -0400
> # Node ID 7b9cf4dddf95b5964d3a05f65b9609b751f4334a
> # Parent  b08be5625c0094a2fdd6cc00bec2a4dcdcc9ea75
> py3: fix test-propertycache.py on Windows

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


Re: [PATCH] commands: adjust metavariables as appropriate

2018-10-18 Thread Yuya Nishihara
On Wed, 17 Oct 2018 22:23:01 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov 
> # Date 1539781236 -28800
> #  Wed Oct 17 21:00:36 2018 +0800
> # Node ID 02ad74c4abc1b66e63f118f1247ccc7c97acc786
> # Parent  ef0baff11aeaaa8424294982235a18c476728264
> commands: adjust metavariables as appropriate

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


Re: [PATCH] color: issue warning in yellow

2018-10-18 Thread Yuya Nishihara
On Wed, 17 Oct 2018 15:17:58 +0200, Boris FELD wrote:
> On 21/08/2018 15:15, Yuya Nishihara wrote:
> > On Mon, 20 Aug 2018 11:14:23 -0700, Martin von Zweigbergk via 
> > Mercurial-devel wrote:
> >> On Mon, Aug 20, 2018 at 9:26 AM Kyle Lippincott  
> >> wrote:
> >>
> >>> Bright/bold yellow should be considered unavailable.  "Normal" yellow,
> >>> which is closer to brown or maybe gold on many screens, is fine.
> >>>
> >> Ah, and we already use yellow for a few things (as you also pointed out).
> >> Sorry I didn't even check that.
> >>
> >>
> >>>   At Google, and I think other tools like clang, generally use magenta I
> >>> believe, but I have no strong preference.  Keep in mind that ui.prompt is
> >>> also yellow a couple lines below.
> >>>
> >> Good point about ui.prompt. Yellow seems like the obvious choice for
> >> warnings, so do we want to change the color for the prompt?
> > FWIW, I don't like the red-colored "error" since it's hard to spot in
> > white-on-black screen. Well, it's readable, but not significant. A plain
> > "yellow" (i.e. dark yellow) would have the same effect.
> 
> I'm not sure what is the status of this series.
> 
> Rereading the discussion, it seems like the yellow on white background
> is readable. Is there anything else blocking this improvement

I'm not sure either, but for the record, I (and maybe David Demelier) voted
against this. I want an essential part of console output to be white because
that's what I configured for. I'd rather want warning/error messages to be
prefixed with highlighted tags (e.g. abort: blah blah...)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 9 of 9] py3: get around IOError variants in test-commandserver.t

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539672503 -7200
#  Tue Oct 16 08:48:23 2018 +0200
# Node ID 17abd7febf13b99845f0305e92cfa6e321810a99
# Parent  570e96ab987597acf146a6636f11f70494413745
py3: get around IOError variants in test-commandserver.t

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -78,6 +78,7 @@ test-clone-update-order.t
 test-clone.t
 test-clonebundles.t
 test-close-head.t
+test-commandserver.t
 test-commit-amend.t
 test-commit-interactive.t
 test-commit-multiple.t
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -793,13 +793,13 @@ unix domain socket:
   ... break
   >>> check(earlycrash, server.connect)
   e, 'Traceback (most recent call last):\n'
-  e, "IOError: *" (glob)
+  e, "(IOError|FileNotFoundError): .*" (re)
   >>> server.shutdown()
 
   $ cat .hg/server.log | grep -v '^  '
   listening at .hg/server.sock
   Traceback (most recent call last):
-  IOError: * (glob)
+  (IOError|FileNotFoundError): .* (re)
   killed!
 #endif
 #if no-unix-socket
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 8 of 9] py3: don't use traceback.print_exc() in commandserver.py

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539672118 -7200
#  Tue Oct 16 08:41:58 2018 +0200
# Node ID 570e96ab987597acf146a6636f11f70494413745
# Parent  fe19b709e1219b716bcf8adcb2dbe053deb31d93
py3: don't use traceback.print_exc() in commandserver.py

It doesn't support a bytes stream on Python 3. This makes a traceback being
sent by one frame, but that shouldn't matter.

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -369,7 +369,7 @@ def _serverequest(ui, repo, conn, create
 cerr = sv.cerr
 else:
 cerr = channeledoutput(fout, 'e')
-traceback.print_exc(file=cerr)
+cerr.write(encoding.strtolocal(traceback.format_exc()))
 raise
 finally:
 fin.close()
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -786,8 +786,9 @@ unix domain socket:
   ... while True:
   ... try:
   ... ch, data = readchannel(conn)
-  ... if not data.startswith(b'  '):
-  ... bprint(b'%c, %r' % (ch, data))
+  ... for l in data.splitlines(True):
+  ... if not l.startswith(b'  '):
+  ... bprint(b'%c, %r' % (ch, l))
   ... except EOFError:
   ... break
   >>> check(earlycrash, server.connect)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 7 of 9] py3: invalidate repository cache with system-string keys

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539671364 -7200
#  Tue Oct 16 08:29:24 2018 +0200
# Node ID fe19b709e1219b716bcf8adcb2dbe053deb31d93
# Parent  9235215b40cf586e1a4af768380de580fe01edf0
py3: invalidate repository cache with system-string keys

# skip-blame just a few r'' prefixes

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -3511,9 +3511,9 @@ def reposetup(ui, repo):
 
 def invalidateall(self):
 super(mqrepo, self).invalidateall()
-if localrepo.hasunfilteredcache(self, 'mq'):
+if localrepo.hasunfilteredcache(self, r'mq'):
 # recreate mq in case queue path was changed
-delattr(self.unfiltered(), 'mq')
+delattr(self.unfiltered(), r'mq')
 
 def abortifwdirpatched(self, errmsg, force=False):
 if self.mq.applied and self.mq.checkapplied and not force:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2046,9 +2046,9 @@ class localrepository(object):
 
 def invalidatecaches(self):
 
-if '_tagscache' in vars(self):
+if r'_tagscache' in vars(self):
 # can't use delattr on proxy
-del self.__dict__['_tagscache']
+del self.__dict__[r'_tagscache']
 
 self.unfiltered()._branchcaches.clear()
 self.invalidatevolatilesets()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 9] py3: system-stringify file mode in commandserver.py

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539670803 -7200
#  Tue Oct 16 08:20:03 2018 +0200
# Node ID 9235215b40cf586e1a4af768380de580fe01edf0
# Parent  1bafbc9bc7b33101f19bd69350a8530289958468
py3: system-stringify file mode in commandserver.py

# skip-blame just r'' prefixes

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -344,8 +344,8 @@ def _initworkerprocess():
 random.seed()
 
 def _serverequest(ui, repo, conn, createcmdserver):
-fin = conn.makefile('rb')
-fout = conn.makefile('wb')
+fin = conn.makefile(r'rb')
+fout = conn.makefile(r'wb')
 sv = None
 try:
 sv = createcmdserver(repo, conn, fin, fout)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 9] py3: alias next to __next__ in commandserver.py

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539669460 -7200
#  Tue Oct 16 07:57:40 2018 +0200
# Node ID 1bafbc9bc7b33101f19bd69350a8530289958468
# Parent  752fb338abc2fbe12fd6fc6a3f09c2fdb34ac88f
py3: alias next to __next__ in commandserver.py

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -149,6 +149,8 @@ class channeledinput(object):
 raise StopIteration
 return l
 
+__next__ = next
+
 def __getattr__(self, attr):
 if attr in (r'isatty', r'fileno', r'tell', r'seek'):
 raise AttributeError(attr)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 9] py3: system-stringify list of attributes to be forwarded from commandserver.py

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539669425 -7200
#  Tue Oct 16 07:57:05 2018 +0200
# Node ID 752fb338abc2fbe12fd6fc6a3f09c2fdb34ac88f
# Parent  b63525d6a2de8e3e965fb684a034f199a3f41a6d
py3: system-stringify list of attributes to be forwarded from commandserver.py

# skip-blame just some r'' prefixes

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -66,7 +66,7 @@ class channeledoutput(object):
 self.out.flush()
 
 def __getattr__(self, attr):
-if attr in ('isatty', 'fileno', 'tell', 'seek'):
+if attr in (r'isatty', r'fileno', r'tell', r'seek'):
 raise AttributeError(attr)
 return getattr(self.out, attr)
 
@@ -150,7 +150,7 @@ class channeledinput(object):
 return l
 
 def __getattr__(self, attr):
-if attr in ('isatty', 'fileno', 'tell', 'seek'):
+if attr in (r'isatty', r'fileno', r'tell', r'seek'):
 raise AttributeError(attr)
 return getattr(self.in_, attr)
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 9] py3: import StringIO from test utility to test-commandserver.t

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539669176 -7200
#  Tue Oct 16 07:52:56 2018 +0200
# Node ID b63525d6a2de8e3e965fb684a034f199a3f41a6d
# Parent  806a11272f637e1b1074c9f2ac5c18a403a8d842
py3: import StringIO from test utility to test-commandserver.t

diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -153,15 +153,14 @@ check strict parsing of early options:
 
 check that "histedit --commands=-" can read rules from the input channel:
 
-  >>> import cStringIO
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import check, readchannel, runcommand, stringio
   >>> @check
   ... def serverinput(server):
   ... readchannel(server)
   ... rules = b'pick eff892de26ec\n'
   ... runcommand(server, [b'histedit', b'0', b'--commands=-',
   ... b'--config', b'extensions.histedit='],
-  ...input=cStringIO.StringIO(rules))
+  ...input=stringio(rules))
   *** runcommand histedit 0 --commands=- --config extensions.histedit=
 
 check that --cwd doesn't persist between requests:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 9] py3: use bprint() helper in test-commandserver.t

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539668311 -7200
#  Tue Oct 16 07:38:31 2018 +0200
# Node ID 806a11272f637e1b1074c9f2ac5c18a403a8d842
# Parent  826a987530cd48a93758104b205065e2192227c8
py3: use bprint() helper in test-commandserver.t

diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -13,14 +13,14 @@ typical client does not want echo-back m
   $ hg init repo
   $ cd repo
 
-  >>> from __future__ import absolute_import, print_function
+  >>> from __future__ import absolute_import
   >>> import os
   >>> import sys
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import bprint, check, readchannel, runcommand
   >>> @check
   ... def hellomessage(server):
   ... ch, data = readchannel(server)
-  ... print(b'%c, %r' % (ch, data))
+  ... bprint(b'%c, %r' % (ch, data))
   ... # run an arbitrary command to make sure the next thing the server
   ... # sends isn't part of the hello message
   ... runcommand(server, [b'id'])
@@ -93,7 +93,7 @@ typical client does not want echo-back m
   abort: unknown revision 'unknown'!
[255]
 
-  >>> from hgclient import check, readchannel
+  >>> from hgclient import bprint, check, readchannel
   >>> @check
   ... def inputeof(server):
   ... readchannel(server)
@@ -102,7 +102,7 @@ typical client does not want echo-back m
   ... server.stdin.close()
   ... 
   ... # server exits with 1 if the pipe closed while reading the command
-  ... print(b'server exit code =', server.wait())
+  ... bprint(b'server exit code =', b'%d' % server.wait())
   server exit code = 1
 
   >>> from hgclient import check, readchannel, runcommand, stringio
@@ -235,11 +235,11 @@ check that local configs for the cached 
 #endif
 
   $ cat < hook.py
-  > from __future__ import print_function
   > import sys
+  > from hgclient import bprint
   > def hook(**args):
-  > print(b'hook talking')
-  > print(b'now try to read something: %r' % sys.stdin.read())
+  > bprint(b'hook talking')
+  > bprint(b'now try to read something: %r' % sys.stdin.read())
   > EOF
 
   >>> from hgclient import check, readchannel, runcommand, stringio
@@ -281,7 +281,7 @@ Clean hook cached version
   *** runcommand status
 
   >>> import os
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import bprint, check, readchannel, runcommand
   >>> @check
   ... def bookmarks(server):
   ... readchannel(server)
@@ -302,7 +302,7 @@ Clean hook cached version
   ... f.close()
   ... runcommand(server, [b'commit', b'-Amm'])
   ... runcommand(server, [b'bookmarks'])
-  ... print(b'')
+  ... bprint(b'')
   *** runcommand bookmarks
   no bookmarks set
   *** runcommand bookmarks
@@ -346,7 +346,7 @@ Clean hook cached version
   3: public
 
   $ echo a >> a
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import bprint, check, readchannel, runcommand
   >>> @check
   ... def rollback(server):
   ... readchannel(server)
@@ -354,7 +354,7 @@ Clean hook cached version
   ... runcommand(server, [b'commit', b'-Am.'])
   ... runcommand(server, [b'rollback'])
   ... runcommand(server, [b'phase', b'-r', b'.'])
-  ... print(b'')
+  ... bprint(b'')
   *** runcommand phase -r . -p
   no phases changed
   *** runcommand commit -Am.
@@ -385,7 +385,7 @@ Clean hook cached version
 
   $ touch .hgignore
   >>> import os
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import bprint, check, readchannel, runcommand
   >>> @check
   ... def hgignore(server):
   ... readchannel(server)
@@ -397,7 +397,7 @@ Clean hook cached version
   ... f.write(b'ignored-file')
   ... f.close()
   ... runcommand(server, [b'status', b'-i', b'-u'])
-  ... print(b'')
+  ... bprint(b'')
   *** runcommand commit -Am.
   adding .hgignore
   *** runcommand status -i -u
@@ -408,7 +408,7 @@ cache of non-public revisions should be 
 (issue4855):
 
   >>> import os
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import bprint, check, readchannel, runcommand
   >>> @check
   ... def phasesetscacheaftercommit(server):
   ... readchannel(server)
@@ -423,7 +423,7 @@ cache of non-public revisions should be 
   ... os.system('hg commit -Aqm%d' % i)
   ... # new commits should be listed as draft revisions
   ... runcommand(server, [b'log', b'-qr', b'draft()'])
-  ... print(b'')
+  ... bprint(b'')
   *** runcommand log -qr draft()
   4:7966c8e3734d
   *** runcommand log -qr draft()
@@ -433,7 +433,7 @@ cache of non-public revisions should be 
   
 
   >>> import os
-  >>> from hgclient import check, readchannel, runcommand
+  >>> from hgclient import bprint, check, readchannel, runcommand
   >>> @check
   ... def phasesetscacheafterstrip(server):
   ... readchannel(server)
@@ -443,7 

[PATCH 1 of 9] py3: byte-stringify most literals in test-commandserver.t

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539668129 -7200
#  Tue Oct 16 07:35:29 2018 +0200
# Node ID 826a987530cd48a93758104b205065e2192227c8
# Parent  2c5835b4246be6ea42e4b4c7b42dc23e379e2c23
py3: byte-stringify most literals in test-commandserver.t

print() calls will be replaced by bprint().

# skip-blame just tons of b'' prefixes.

diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -20,10 +20,10 @@ typical client does not want echo-back m
   >>> @check
   ... def hellomessage(server):
   ... ch, data = readchannel(server)
-  ... print('%c, %r' % (ch, data))
+  ... print(b'%c, %r' % (ch, data))
   ... # run an arbitrary command to make sure the next thing the server
   ... # sends isn't part of the hello message
-  ... runcommand(server, ['id'])
+  ... runcommand(server, [b'id'])
   o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
   *** runcommand id
    tip
@@ -31,7 +31,7 @@ typical client does not want echo-back m
   >>> from hgclient import check
   >>> @check
   ... def unknowncommand(server):
-  ... server.stdin.write('unknowncommand\n')
+  ... server.stdin.write(b'unknowncommand\n')
   abort: unknown command unknowncommand
 
   >>> from hgclient import check, readchannel, runcommand
@@ -44,19 +44,19 @@ typical client does not want echo-back m
   ... runcommand(server, [])
   ... 
   ... # global options
-  ... runcommand(server, ['id', '--quiet'])
+  ... runcommand(server, [b'id', b'--quiet'])
   ... 
   ... # make sure global options don't stick through requests
-  ... runcommand(server, ['id'])
+  ... runcommand(server, [b'id'])
   ... 
   ... # --config
-  ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
+  ... runcommand(server, [b'id', b'--config', b'ui.quiet=True'])
   ... 
   ... # make sure --config doesn't stick
-  ... runcommand(server, ['id'])
+  ... runcommand(server, [b'id'])
   ... 
   ... # negative return code should be masked
-  ... runcommand(server, ['id', '-runknown'])
+  ... runcommand(server, [b'id', b'-runknown'])
   *** runcommand 
   Mercurial Distributed SCM
   
@@ -97,12 +97,12 @@ typical client does not want echo-back m
   >>> @check
   ... def inputeof(server):
   ... readchannel(server)
-  ... server.stdin.write('runcommand\n')
+  ... server.stdin.write(b'runcommand\n')
   ... # close stdin while server is waiting for input
   ... server.stdin.close()
   ... 
   ... # server exits with 1 if the pipe closed while reading the command
-  ... print('server exit code =', server.wait())
+  ... print(b'server exit code =', server.wait())
   server exit code = 1
 
   >>> from hgclient import check, readchannel, runcommand, stringio
@@ -110,7 +110,7 @@ typical client does not want echo-back m
   ... def serverinput(server):
   ... readchannel(server)
   ... 
-  ... patch = """
+  ... patch = b"""
   ... # HG changeset patch
   ... # User test
   ... # Date 0 0
@@ -125,8 +125,8 @@ typical client does not want echo-back m
   ... +1
   ... """
   ... 
-  ... runcommand(server, ['import', '-'], input=stringio(patch))
-  ... runcommand(server, ['log'])
+  ... runcommand(server, [b'import', b'-'], input=stringio(patch))
+  ... runcommand(server, [b'log'])
   *** runcommand import -
   applying patch from stdin
   *** runcommand log
@@ -145,8 +145,8 @@ check strict parsing of early options:
   >>> @check
   ... def cwd(server):
   ... readchannel(server)
-  ... runcommand(server, ['log', '-b', '--config=alias.log=!echo pwned',
-  ... 'default'])
+  ... runcommand(server, [b'log', b'-b', b'--config=alias.log=!echo pwned',
+  ... b'default'])
   *** runcommand log -b --config=alias.log=!echo pwned default
   abort: unknown revision '--config=alias.log=!echo pwned'!
[255]
@@ -158,9 +158,9 @@ check that "histedit --commands=-" can r
   >>> @check
   ... def serverinput(server):
   ... readchannel(server)
-  ... rules = 'pick eff892de26ec\n'
-  ... runcommand(server, ['histedit', '0', '--commands=-',
-  ... '--config', 'extensions.histedit='],
+  ... rules = b'pick eff892de26ec\n'
+  ... runcommand(server, [b'histedit', b'0', b'--commands=-',
+  ... b'--config', b'extensions.histedit='],
   ...input=cStringIO.StringIO(rules))
   *** runcommand histedit 0 --commands=- --config extensions.histedit=
 
@@ -172,8 +172,8 @@ check that --cwd doesn't persist between
   >>> @check
   ... def cwd(server):
   ... readchannel(server)
-  ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
-  ... runcommand(server, ['st', 'foo/bar'])
+  ... runcommand(server, [b'--cwd', b'foo', b'st', b'bar'])
+  ... runcommand(server, [b'st', 

[PATCH] addremove: add "ui." prefix to message color keys

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539864007 -32400
#  Thu Oct 18 21:00:07 2018 +0900
# Node ID 10e4e6d63c504f1117b0d49160e301d21818515f
# Parent  17abd7febf13b99845f0305e92cfa6e321810a99
addremove: add "ui." prefix to message color keys

I don't like fully-colorized status/warning messages, and I want to disable
them at all. If we'd supported a syntax like 'color.ui.*=none', I could
easily turn addremove.added/removed off as well as ui.error. This patch is
just for that.

Since addremove colors aren't released yet, which were added at ddc1da134772,
there are no compatibility concerns.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2058,7 +2058,7 @@ def add(ui, repo, match, prefix, explici
 names.append(f)
 if ui.verbose or not exact:
 ui.status(_('adding %s\n') % match.rel(f),
-  label='addremove.added')
+  label='ui.addremove.added')
 
 for subpath in sorted(wctx.substate):
 sub = wctx.sub(subpath)
@@ -2157,7 +2157,7 @@ def forget(ui, repo, match, prefix, expl
 for f in forget:
 if ui.verbose or not match.exact(f) or interactive:
 ui.status(_('removing %s\n') % match.rel(f),
-  label='addremove.removed')
+  label='ui.addremove.removed')
 
 if not dryrun:
 rejected = wctx.forget(forget, prefix)
@@ -2291,7 +2291,7 @@ def remove(ui, repo, m, prefix, after, f
 if ui.verbose or not m.exact(f):
 progress.increment()
 ui.status(_('removing %s\n') % m.rel(f),
-  label='addremove.removed')
+  label='ui.addremove.removed')
 progress.complete()
 
 if not dryrun:
diff --git a/mercurial/color.py b/mercurial/color.py
--- a/mercurial/color.py
+++ b/mercurial/color.py
@@ -83,8 +83,6 @@ except ImportError:
 'grep.filename': 'magenta',
 'grep.user': 'magenta',
 'grep.date': 'magenta',
-'addremove.added': 'green',
-'addremove.removed': 'red',
 'bookmarks.active': 'green',
 'branches.active': 'none',
 'branches.closed': 'black bold',
@@ -119,6 +117,8 @@ except ImportError:
 'formatvariant.config.default': 'green',
 'formatvariant.default': '',
 'histedit.remaining': 'red bold',
+'ui.addremove.added': 'green',
+'ui.addremove.removed': 'red',
 'ui.error': 'red',
 'ui.prompt': 'yellow',
 'log.changeset': 'yellow',
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1043,10 +1043,10 @@ def addremove(repo, matcher, prefix, opt
 if repo.ui.verbose or not m.exact(abs):
 if abs in unknownset:
 status = _('adding %s\n') % m.uipath(abs)
-label = 'addremove.added'
+label = 'ui.addremove.added'
 else:
 status = _('removing %s\n') % m.uipath(abs)
-label = 'addremove.removed'
+label = 'ui.addremove.removed'
 repo.ui.status(status, label=label)
 
 renames = _findrenames(repo, m, added + unknown, removed + deleted,
diff --git a/tests/test-add.t b/tests/test-add.t
--- a/tests/test-add.t
+++ b/tests/test-add.t
@@ -14,7 +14,7 @@
   adding a
   $ hg forget a
   $ hg add --color debug
-  [addremove.added ui.status|adding a]
+  [ui.addremove.added ui.status|adding a]
   $ hg st
   A a
   $ mkdir dir
diff --git a/tests/test-addremove.t b/tests/test-addremove.t
--- a/tests/test-addremove.t
+++ b/tests/test-addremove.t
@@ -70,10 +70,10 @@
   adding d
   recording removal of a as rename to b (100% similar)
   $ hg addremove -ns 50 --color debug
-  [addremove.removed ui.status|removing a]
-  [addremove.added ui.status|adding b]
-  [addremove.removed ui.status|removing c]
-  [addremove.added ui.status|adding d]
+  [ui.addremove.removed ui.status|removing a]
+  [ui.addremove.added ui.status|adding b]
+  [ui.addremove.removed ui.status|removing c]
+  [ui.addremove.added ui.status|adding d]
   [ ui.status|recording removal of a as rename to b (100% similar)]
   $ hg addremove -s 50
   removing a
diff --git a/tests/test-remove.t b/tests/test-remove.t
--- a/tests/test-remove.t
+++ b/tests/test-remove.t
@@ -527,7 +527,7 @@ test dry-run for remove
   \r (no-eol) (esc)
   deleting [===>] 1/1\r (no-eol) (esc)
   \r (no-eol) (esc)
-  [addremove.removed ui.status|removing a]
+  [ui.addremove.removed ui.status|removing a]
   $ hg diff
 
   $ cat >> .hg/hgrc 

[PATCH] commands: restore compatibility for "^cmd" registration (issue6005)

2018-10-18 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1539864862 -32400
#  Thu Oct 18 21:14:22 2018 +0900
# Node ID 21cf5d2d5b7e2c5264bc132285cdd042c21d2b38
# Parent  10e4e6d63c504f1117b0d49160e301d21818515f
commands: restore compatibility for "^cmd" registration (issue6005)

This is done at loading time, where ui is available.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6135,6 +6135,16 @@ def version_(ui, **opts):
 def loadcmdtable(ui, name, cmdtable):
 """Load command functions from specified cmdtable
 """
+cmdtable = cmdtable.copy()
+for cmd in list(cmdtable):
+if not cmd.startswith('^'):
+continue
+ui.deprecwarn("old-style command registration '%s' in extension '%s'"
+  % (cmd, name), '4.8')
+entry = cmdtable.pop(cmd)
+entry[0].helpbasic = True
+cmdtable[cmd[1:]] = entry
+
 overrides = [cmd for cmd in cmdtable if cmd in table]
 if overrides:
 ui.warn(_("extension '%s' overrides commands: %s\n")
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-18 Thread durin42 (Augie Fackler)
durin42 added a comment.


  > pulkit added a comment.
  > 
  >   Is the goal is to include this in 4.8?
  
  Yes if possible.
  
  >

REPOSITORY
  rHG Mercurial

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

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


D5120: match: fix up a repr to not crash on Python 3

2018-10-18 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd30a19d10441: match: fix up a repr to not crash on Python 3 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5120?vs=12174=12240

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

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -1173,7 +1173,7 @@
 else:
 dir = '.'
 return dir in dirs
-regex = b'rootfilesin: %s' % sorted(dirs)
+regex = b'rootfilesin: %s' % stringutil.pprint(list(sorted(dirs)))
 matchfuncs.append(mf)
 else:
 regex, mf = _buildregexmatch(kindpats, globsuffix)



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


D4895: narrow: when widening, don't include manifests the client already has

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> narrowwirepeer.py:15
>  hg,
>  match as matchmod,
>  narrowspec,

removed this in flight to make pyflakes happy.

REPOSITORY
  rHG Mercurial

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

To: martinvonz, durin42, #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


D5149: py3: add a r'' prefix in mercurial/exchange.py

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

REVISION SUMMARY
  skip-blame because just r'' prefix
  ==
  
  This fixes test-narrow-acl.t on py3 which was broken by one of the
  earlier patches.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2170,7 +2170,7 @@
 if 'treemanifest' in repo.requirements:
 part.addparam('treemanifest', '1')
 
-if (kwargs.get(r'narrow', False) and kwargs.get('narrow_acl', False)
+if (kwargs.get(r'narrow', False) and kwargs.get(r'narrow_acl', False)
 and (include or exclude)):
 narrowspecpart = bundler.newpart('narrow:spec')
 if include:



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


D5148: py3: add 5 new passing tests to whitelist caught by buildbot

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

REVISION SUMMARY
  Thanks to everyone who is putting efforts in making hg py3 compatible.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -155,6 +155,7 @@
 test-empty.t
 test-encode.t
 test-encoding-func.py
+test-encoding-textwrap.t
 test-encoding.t
 test-eol-add.t
 test-eol-clone.t
@@ -215,6 +216,7 @@
 test-graft.t
 test-grep.t
 test-hardlinks.t
+test-help.t
 test-hg-parseurl.py
 test-hghave.t
 test-hgignore.t
@@ -375,6 +377,7 @@
 test-narrow-clone-no-ellipsis.t
 test-narrow-clone-non-narrow-server.t
 test-narrow-clone-nonlinear.t
+test-narrow-clone-stream.t
 test-narrow-clone.t
 test-narrow-commit.t
 test-narrow-copies.t
@@ -432,6 +435,7 @@
 test-phases.t
 test-profile.t
 test-progress.t
+test-propertycache.py
 test-pull-branch.t
 test-pull-http.t
 test-pull-permission.t
@@ -629,6 +633,7 @@
 test-wireproto-command-lookup.t
 test-wireproto-command-manifestdata.t
 test-wireproto-command-pushkey.t
+test-wireproto-command-rawstorefiledata.t
 test-wireproto-framing.py
 test-wireproto-serverreactor.py
 test-wireproto.py



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


Re: [PATCH 5 of 5 V5] context: floor adjustlinkrev graph walk during copy tracing

2018-10-18 Thread Boris FELD
There have been a bit a bit too much churn on this series and we would
like to re-validate the performance number. We won't have time before
the freeze so you can drop this series.

On 10/10/2018 10:41, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1539125437 -7200
> #  Wed Oct 10 00:50:37 2018 +0200
> # Node ID 4a2a673868756ca9495a54b7686c19e22b6b21ab
> # Parent  39593cc2e82294f379e9d7cfd0f9de7eca43e808
> # EXP-Topic copy-perf
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 4a2a67386875
> context: floor adjustlinkrev graph walk during copy tracing
>
> The `_adjustlinkrev` method gains an optional "stoprev" argument. The linkrev
> adjustment will give up once this floor is reached. The relevant functions
> using `_adjustlinkrev` are updated to pass an appropriate value in the copy
> tracing code.
>
> In some private repository, about 10% of the status call triggered the
> pathological case addressed by this change. The speedup varies from one call
> to another, the best-observed win is moving from 170s to 11s.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -714,7 +714,7 @@ class basefilectx(object):
>  
>  return True
>  
> -def _adjustlinkrev(self, srcrev, inclusive=False):
> +def _adjustlinkrev(self, srcrev, inclusive=False, stoprev=None):
>  """return the first ancestor of  introducing 
>  
>  If the linkrev of the file revision does not point to an ancestor of
> @@ -723,6 +723,10 @@ class basefilectx(object):
>  
>  :srcrev: the changeset revision we search ancestors from
>  :inclusive: if true, the src revision will also be checked
> +:stoprev: an optional revision to stop the walk at. If no 
> introduction
> +  of this file content could be found before this floor
> +  revision, the function will returns "None" and stops its
> +  iteration.
>  """
>  repo = self._repo
>  cl = repo.unfiltered().changelog
> @@ -750,6 +754,8 @@ class basefilectx(object):
>  fnode = self._filenode
>  path = self._path
>  for a in iteranc:
> +if stoprev is not None and a < stoprev:
> +return None
>  ac = cl.read(a) # get changeset data (we avoid object 
> creation)
>  if path in ac[3]: # checking the 'files' field.
>  # The file has been touched, check if the content is
> @@ -765,8 +771,12 @@ class basefilectx(object):
>  def isintroducedafter(self, changelogrev):
>  """True if a filectx have been introduced after a given floor 
> revision
>  """
> -return (self.linkrev() >= changelogrev
> -or self._introrev() >= changelogrev)
> +if self.linkrev() >= changelogrev:
> +return True
> +introrev = self._introrev(stoprev=changelogrev)
> +if introrev is None:
> +return False
> +return introrev >= changelogrev
>  
>  def introrev(self):
>  """return the rev of the changeset which introduced this file 
> revision
> @@ -779,7 +789,15 @@ class basefilectx(object):
>  """
>  return self._introrev()
>  
> -def _introrev(self):
> +def _introrev(self, stoprev=None):
> +"""
> +Same as `introrev` but, with an extra argument to limit changelog
> +iteration range in some internal usecase.
> +
> +If `stoprev` is set, the `introrev` will not be searched past that
> +`stoprev` revision and "None" might be returned. This is useful to
> +limit the iteration range.
> +"""
>  toprev = None
>  attrs = vars(self)
>  if r'_changeid' in attrs:
> @@ -790,11 +808,12 @@ class basefilectx(object):
>  toprev = self._changectx.rev()
>  
>  if toprev is not None:
> -return self._adjustlinkrev(toprev, inclusive=True)
> +return self._adjustlinkrev(toprev, inclusive=True, 
> stoprev=stoprev)
>  elif r'_descendantrev' in attrs:
> -introrev = self._adjustlinkrev(self._descendantrev)
> +introrev = self._adjustlinkrev(self._descendantrev, 
> stoprev=stoprev)
>  # be nice and cache the result of the computation
> -self._changeid = introrev
> +if introrev is not None:
> +self._changeid = introrev
>  return introrev
>  else:
>  return self.linkrev()
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org

D4895: narrow: when widening, don't include manifests the client already has

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG89cba88e95ed: narrow: when widening, dont include 
manifests the client already has (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4895?vs=12217=12237

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowwirepeer.py
  mercurial/bundle2.py
  mercurial/changegroup.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2153,14 +2153,12 @@
 if kwargs.get(r'narrow', False):
 include = sorted(filter(bool, kwargs.get(r'includepats', [])))
 exclude = sorted(filter(bool, kwargs.get(r'excludepats', [])))
-filematcher = narrowspec.match(repo.root, include=include,
-   exclude=exclude)
+matcher = narrowspec.match(repo.root, include=include, exclude=exclude)
 else:
-filematcher = None
+matcher = None
 
 cgstream = changegroup.makestream(repo, outgoing, version, source,
-  bundlecaps=bundlecaps,
-  filematcher=filematcher)
+  bundlecaps=bundlecaps, matcher=matcher)
 
 part = bundler.newpart('changegroup', data=cgstream)
 if cgversions:
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -727,14 +727,17 @@
 progress.complete()
 
 class cgpacker(object):
-def __init__(self, repo, filematcher, version,
+def __init__(self, repo, oldmatcher, matcher, version,
  builddeltaheader, manifestsend,
  forcedeltaparentprev=False,
  bundlecaps=None, ellipses=False,
  shallow=False, ellipsisroots=None, fullnodes=None):
 """Given a source repo, construct a bundler.
 
-filematcher is a matcher that matches on files to include in the
+oldmatcher is a matcher that matches on files the client already has.
+These will not be included in the changegroup.
+
+matcher is a matcher that matches on files to include in the
 changegroup. Used to facilitate sparse changegroups.
 
 forcedeltaparentprev indicates whether delta parents must be against
@@ -761,8 +764,10 @@
 ellipsis because for very large histories we expect this to be
 significantly smaller.
 """
-assert filematcher
-self._filematcher = filematcher
+assert oldmatcher
+assert matcher
+self._oldmatcher = oldmatcher
+self._matcher = matcher
 
 self.version = version
 self._forcedeltaparentprev = forcedeltaparentprev
@@ -1027,7 +1032,7 @@
 tree, nodes = tmfnodes.popitem()
 store = mfl.getstorage(tree)
 
-if not self._filematcher.visitdir(store.tree[:-1] or '.'):
+if not self._matcher.visitdir(store.tree[:-1] or '.'):
 # No nodes to send because this directory is out of
 # the client's view of the repository (probably
 # because of narrow clones).
@@ -1051,7 +1056,16 @@
 fullclnodes=self._fullclnodes,
 precomputedellipsis=self._precomputedellipsis)
 
-yield tree, deltas
+if not self._oldmatcher.visitdir(store.tree[:-1] or '.'):
+yield tree, deltas
+else:
+# 'deltas' is a generator and we need to consume it even if
+# we are not going to send it because a side-effect is that
+# it updates tmdnodes (via lookupfn)
+for d in deltas:
+pass
+if not tree:
+yield tree, []
 
 def _prunemanifests(self, store, nodes, commonrevs):
 # This is split out as a separate method to allow filtering
@@ -1066,7 +1080,8 @@
 # The 'source' parameter is useful for extensions
 def generatefiles(self, changedfiles, commonrevs, source,
   mfdicts, fastpathlinkrev, fnodes, clrevs):
-changedfiles = list(filter(self._filematcher, changedfiles))
+changedfiles = [f for f in changedfiles
+if self._matcher(f) and not self._oldmatcher(f)]
 
 if not fastpathlinkrev:
 def normallinknodes(unused, fname):
@@ -1151,12 +1166,13 @@
 
 progress.complete()
 
-def _makecg1packer(repo, filematcher, bundlecaps, ellipses=False,
-   shallow=False, ellipsisroots=None, fullnodes=None):
+def _makecg1packer(repo, oldmatcher, matcher, bundlecaps,
+   ellipses=False, shallow=False, ellipsisroots=None,
+   fullnodes=None):
 builddeltaheader 

D5144: subrepo: access status members by name instead of by position

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6f152067ba57: subrepo: access status members by name 
instead of by position (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5144?vs=12218=12235

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

AFFECTED FILES
  mercurial/subrepo.py

CHANGE DETAILS

diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1583,17 +1583,15 @@
 if self._gitmissing():
 return []
 
-(modified, added, removed,
- deleted, unknown, ignored, clean) = self.status(None, unknown=True,
- clean=True)
+s = self.status(None, unknown=True, clean=True)
 
 tracked = set()
 # dirstates 'amn' warn, 'r' is added again
-for l in (modified, added, deleted, clean):
+for l in (s.modified, s.added, s.deleted, s.clean):
 tracked.update(l)
 
 # Unknown files not of interest will be rejected by the matcher
-files = unknown
+files = s.unknown
 files.extend(match.files())
 
 rejected = []



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


D5143: tests: add test for widening from an empty clone

2018-10-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa69d5823af6d: tests: add test for widening from an empty 
clone (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5143?vs=12216=12236#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5143?vs=12216=12236

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

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

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -30,17 +30,30 @@
 
 narrow clone the inside file
 
-  $ hg clone --narrow ssh://user@dummy/master narrow --include inside
+  $ hg clone --narrow ssh://user@dummy/master narrow
   requesting all changes
   adding changesets
   adding manifests
   adding file changes
-  added 3 changesets with 1 changes to 1 files
+  added 3 changesets with 0 changes to 0 files
   new changesets *:* (glob)
   updating to branch default
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd narrow
   $ hg tracked
+  $ hg files
+  [1]
+
+widen from an empty clone
+
+  $ hg tracked --addinclude inside
+  comparing with ssh://user@dummy/master
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 1 changes to 1 files
+  $ hg tracked
   I path:inside
   $ ls
   inside



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


D5146: histedit: import chistedit curses UI from hg-experimental

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Is the goal is to include this in 4.8?

REPOSITORY
  rHG Mercurial

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

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


[PATCH 4 of 4 V2] changegroup: add a option to create bundle with full snapshot only

2018-10-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539858666 -7200
#  Thu Oct 18 12:31:06 2018 +0200
# Node ID 4c805ec9e478424e631ed8bb7ba6fd65714cfd15
# Parent  2a54c05a0e8901bb171721024843531f95382616
# EXP-Topic slim-bundle
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
4c805ec9e478
changegroup: add a option to create bundle with full snapshot only

This is easy to implement now and can be useful for benchmarking.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -698,7 +698,7 @@ def deltagroup(repo, store, nodes, ischa
 total=len(nodes))
 
 configtarget = repo.ui.config('devel', 'bundle.delta')
-if configtarget not in ('', 'p1'):
+if configtarget not in ('', 'p1', 'full'):
 msg = _("""config "devel.bundle.delta" as unknown value: %s""")
 repo.ui.warn(msg % configtarget)
 
@@ -707,6 +707,8 @@ def deltagroup(repo, store, nodes, ischa
 deltamode = repository.CG_DELTAMODE_PREV
 elif configtarget == 'p1':
 deltamode = repository.CG_DELTAMODE_P1
+elif configtarget == 'full':
+deltamode = repository.CG_DELTAMODE_FULL
 
 revisions = store.emitrevisions(
 nodes,
diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -905,3 +905,7 @@ Test the option that create slim bundle
 
   $ hg bundle -a --config devel.bundle.delta=p1 ./slim.hg
   3 changesets found
+
+Test the option that create and no-delta's bundle
+  $ hg bundle -a --config devel.bundle.delta=full ./full.hg
+  3 changesets found
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4 V2] storage: also use `deltamode argument` for ifiledata

2018-10-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539120395 -7200
#  Tue Oct 09 23:26:35 2018 +0200
# Node ID 64d8829dc24e8fc02f228295bb3b330c696c7d34
# Parent  cc7eeac5f0d94e27c527524040f2cd1814c8102b
# EXP-Topic slim-bundle
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
64d8829dc24e
storage: also use `deltamode argument` for ifiledata

Now that lower level uses such argument, we can propagate the change to higher
layers.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -697,12 +697,16 @@ def deltagroup(repo, store, nodes, ischa
 progress = repo.ui.makeprogress(topic, unit=_('chunks'),
 total=len(nodes))
 
+deltamode = repository.CG_DELTAMODE_STD
+if forcedeltaparentprev:
+deltamode = repository.CG_DELTAMODE_PREV
+
 revisions = store.emitrevisions(
 nodes,
 nodesorder=nodesorder,
 revisiondata=True,
 assumehaveparentrevisions=not ellipses,
-deltaprevious=forcedeltaparentprev)
+deltamode=deltamode)
 
 for i, revision in enumerate(revisions):
 if progress:
diff --git a/mercurial/filelog.py b/mercurial/filelog.py
--- a/mercurial/filelog.py
+++ b/mercurial/filelog.py
@@ -77,11 +77,11 @@ class filelog(object):
 
 def emitrevisions(self, nodes, nodesorder=None,
   revisiondata=False, assumehaveparentrevisions=False,
-  deltaprevious=False):
+  deltamode=repository.CG_DELTAMODE_STD):
 return self._revlog.emitrevisions(
 nodes, nodesorder=nodesorder, revisiondata=revisiondata,
 assumehaveparentrevisions=assumehaveparentrevisions,
-deltaprevious=deltaprevious)
+deltamode=deltamode)
 
 def addrevision(self, revisiondata, transaction, linkrev, p1, p2,
 node=None, flags=revlog.REVIDX_DEFAULT_FLAGS,
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1575,11 +1575,11 @@ class manifestrevlog(object):
 
 def emitrevisions(self, nodes, nodesorder=None,
   revisiondata=False, assumehaveparentrevisions=False,
-  deltaprevious=False):
+  deltamode=repository.CG_DELTAMODE_STD):
 return self._revlog.emitrevisions(
 nodes, nodesorder=nodesorder, revisiondata=revisiondata,
 assumehaveparentrevisions=assumehaveparentrevisions,
-deltaprevious=deltaprevious)
+deltamode=deltamode)
 
 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None):
 return self._revlog.addgroup(deltas, linkmapper, transaction,
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -606,7 +606,7 @@ class ifiledata(interfaceutil.Interface)
   nodesorder=None,
   revisiondata=False,
   assumehaveparentrevisions=False,
-  deltaprevious=False):
+  deltamode=CG_DELTAMODE_STD):
 """Produce ``irevisiondelta`` for revisions.
 
 Given an iterable of nodes, emits objects conforming to the
@@ -649,10 +649,10 @@ class ifiledata(interfaceutil.Interface)
 The ``linknode`` attribute on the returned ``irevisiondelta`` may not
 be set and it is the caller's responsibility to resolve it, if needed.
 
-If ``deltaprevious`` is True and revision data is requested, all
-revision data should be emitted as deltas against the revision
-emitted just prior. The initial revision should be a delta against
-its 1st parent.
+If ``deltamode`` is CG_DELTAMODE_PREV and revision data is requested,
+all revision data should be emitted as deltas against the revision
+emitted just prior. The initial revision should be a delta against its
+1st parent.
 """
 
 class ifilemutation(interfaceutil.Interface):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2221,7 +2221,8 @@ class revlog(object):
 return res
 
 def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
-  assumehaveparentrevisions=False, deltaprevious=False):
+  assumehaveparentrevisions=False,
+  deltamode=repository.CG_DELTAMODE_STD):
 if nodesorder not in ('nodes', 'storage', None):
 raise error.ProgrammingError('unhandled value for nodesorder: %s' %
  nodesorder)
@@ -2229,10 +2230,8 @@ class revlog(object):
 if nodesorder is None and not self._generaldelta:
 nodesorder = 'storage'
 
-

[PATCH 3 of 4 V2] changegroup: allow to force delta to be against p1

2018-10-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539123662 -7200
#  Wed Oct 10 00:21:02 2018 +0200
# Node ID 2a54c05a0e8901bb171721024843531f95382616
# Parent  64d8829dc24e8fc02f228295bb3b330c696c7d34
# EXP-Topic slim-bundle
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
2a54c05a0e89
changegroup: allow to force delta to be against p1

This new developer option is useful to general more "generic" bundle. Without
this option, a bundle generated from the repository use deltas similar to the
one stored in the specific repository it was generated from. This makes
performance testing a bit tricky.

Using deltas similar to the final result means all delta stored in the bundle
can be applied to the target repository without any further processing (except
for the rare case of a full snapshot). The application of such bundles
(almost) never exercises the (slower) path of searching for a new valid delta.
This result in unrealistic and too favorable timing and profile.

Instead, we introduce an option to make sure all revisions are stored as a
delta against p1. It might not be the best generation option, but it
guarantees that the content will be "generic", not favoring a specific target.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -697,9 +697,16 @@ def deltagroup(repo, store, nodes, ischa
 progress = repo.ui.makeprogress(topic, unit=_('chunks'),
 total=len(nodes))
 
+configtarget = repo.ui.config('devel', 'bundle.delta')
+if configtarget not in ('', 'p1'):
+msg = _("""config "devel.bundle.delta" as unknown value: %s""")
+repo.ui.warn(msg % configtarget)
+
 deltamode = repository.CG_DELTAMODE_STD
 if forcedeltaparentprev:
 deltamode = repository.CG_DELTAMODE_PREV
+elif configtarget == 'p1':
+deltamode = repository.CG_DELTAMODE_P1
 
 revisions = store.emitrevisions(
 nodes,
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -329,6 +329,9 @@ coreconfigitem('devel', 'all-warnings',
 coreconfigitem('devel', 'bundle2.debug',
 default=False,
 )
+coreconfigitem('devel', 'bundle.delta',
+default='',
+)
 coreconfigitem('devel', 'cache-vfs',
 default=None,
 )
diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -40,6 +40,7 @@ REVISION_FLAGS_KNOWN = (
 CG_DELTAMODE_STD = b'default'
 CG_DELTAMODE_PREV = b'previous'
 CG_DELTAMODE_FULL = b'fulltext'
+CG_DELTAMODE_P1 = b'p1'
 
 class ipeerconnection(interfaceutil.Interface):
 """Represents a "connection" to a repository.
diff --git a/mercurial/utils/storageutil.py b/mercurial/utils/storageutil.py
--- a/mercurial/utils/storageutil.py
+++ b/mercurial/utils/storageutil.py
@@ -372,6 +372,9 @@ def emitrevisions(store, nodes, nodesord
 # We're instructed to send fulltext. Honor that.
 elif deltamode == repository.CG_DELTAMODE_FULL:
 baserev = nullrev
+# We're instructed to use p1. Honor that
+elif deltamode == repository.CG_DELTAMODE_P1:
+baserev = p1rev
 
 # There is a delta in storage. We try to use that because it
 # amounts to effectively copying data from storage and is
diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -900,3 +900,8 @@ the warning shouldn't be emitted
   $ hg update -R ../update2bundled.hg -r 0
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
 #endif
+
+Test the option that create slim bundle
+
+  $ hg bundle -a --config devel.bundle.delta=p1 ./slim.hg
+  3 changesets found
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 4 V2] changegroup: refactor emitrevision to use a `deltamode` argument

2018-10-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539115321 -7200
#  Tue Oct 09 22:02:01 2018 +0200
# Node ID cc7eeac5f0d94e27c527524040f2cd1814c8102b
# Parent  2c0aa02ecd5a05ae76b6345962ee3a0ef773bd8a
# EXP-Topic slim-bundle
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
cc7eeac5f0d9
changegroup: refactor emitrevision to use a `deltamode` argument

This new argument gathers the semantic of `sendfulltext` and `deltaprevious`
in a single value. We are about to introduce a new type of constraints.
Avoiding yet another argument sounds like a plus.

diff --git a/mercurial/repository.py b/mercurial/repository.py
--- a/mercurial/repository.py
+++ b/mercurial/repository.py
@@ -37,6 +37,10 @@ REVISION_FLAG_EXTSTORED = 1 << 13
 REVISION_FLAGS_KNOWN = (
 REVISION_FLAG_CENSORED | REVISION_FLAG_ELLIPSIS | REVISION_FLAG_EXTSTORED)
 
+CG_DELTAMODE_STD = b'default'
+CG_DELTAMODE_PREV = b'previous'
+CG_DELTAMODE_FULL = b'fulltext'
+
 class ipeerconnection(interfaceutil.Interface):
 """Represents a "connection" to a repository.
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2229,6 +2229,12 @@ class revlog(object):
 if nodesorder is None and not self._generaldelta:
 nodesorder = 'storage'
 
+deltamode = repository.CG_DELTAMODE_STD
+if deltaprevious:
+deltamode = repository.CG_DELTAMODE_PREV
+elif not self._storedeltachains:
+deltamode = repository.CG_DELTAMODE_FULL
+
 return storageutil.emitrevisions(
 self, nodes, nodesorder, revlogrevisiondelta,
 deltaparentfn=self.deltaparent,
@@ -2236,10 +2242,9 @@ class revlog(object):
 rawsizefn=self.rawsize,
 revdifffn=self.revdiff,
 flagsfn=self.flags,
-sendfulltext=not self._storedeltachains,
+deltamode=deltamode,
 revisiondata=revisiondata,
-assumehaveparentrevisions=assumehaveparentrevisions,
-deltaprevious=deltaprevious)
+assumehaveparentrevisions=assumehaveparentrevisions)
 
 DELTAREUSEALWAYS = 'always'
 DELTAREUSESAMEREVS = 'samerevs'
diff --git a/mercurial/utils/storageutil.py b/mercurial/utils/storageutil.py
--- a/mercurial/utils/storageutil.py
+++ b/mercurial/utils/storageutil.py
@@ -21,6 +21,7 @@ from .. import (
 error,
 mdiff,
 pycompat,
+repository,
 )
 
 _nullhash = hashlib.sha1(nullid)
@@ -268,9 +269,8 @@ def resolvestripinfo(minlinkrev, tiprev,
 
 def emitrevisions(store, nodes, nodesorder, resultcls, deltaparentfn=None,
   candeltafn=None, rawsizefn=None, revdifffn=None, 
flagsfn=None,
-  sendfulltext=False,
-  revisiondata=False, assumehaveparentrevisions=False,
-  deltaprevious=False):
+  deltamode=repository.CG_DELTAMODE_STD,
+  revisiondata=False, assumehaveparentrevisions=False):
 """Generic implementation of ifiledata.emitrevisions().
 
 Emitting revision data is subtly complex. This function attempts to
@@ -321,14 +321,17 @@ def emitrevisions(store, nodes, nodesord
Callable receiving a revision number and returns the integer flags
value for it. If not defined, flags value will be 0.
 
-``sendfulltext``
+``deltamode``
+   constaint on delta to be sent:
+   * CG_DELTAMODE_STD  - normal mode, try to reuse storage deltas,
+   * CG_DELTAMODE_PREV - only delta against "prev",
+   * CG_DELTAMODE_FULL - only issue full snapshot.
+
Whether to send fulltext revisions instead of deltas, if allowed.
 
 ``nodesorder``
 ``revisiondata``
 ``assumehaveparentrevisions``
-``deltaprevious``
-   See ``ifiledata.emitrevisions()`` interface documentation.
 """
 
 fnode = store.node
@@ -344,7 +347,7 @@ def emitrevisions(store, nodes, nodesord
 
 prevrev = None
 
-if deltaprevious or assumehaveparentrevisions:
+if deltamode == repository.CG_DELTAMODE_PREV or assumehaveparentrevisions:
 prevrev = store.parentrevs(revs[0])[0]
 
 # Set of revs available to delta against.
@@ -363,11 +366,11 @@ def emitrevisions(store, nodes, nodesord
 deltaparentrev = nullrev
 
 # Forced delta against previous mode.
-if deltaprevious:
+if deltamode == repository.CG_DELTAMODE_PREV:
 baserev = prevrev
 
 # We're instructed to send fulltext. Honor that.
-elif sendfulltext:
+elif deltamode == repository.CG_DELTAMODE_FULL:
 baserev = nullrev
 
 # There is a delta in storage. We try to use that because it
@@ -426,7 +429,8 @@ def emitrevisions(store, nodes, nodesord
 baserevisionsize = len(store.revision(baserev,
   raw=True))
 
-elif 

D4895: narrow: when widening, don't include manifests the client already has

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit accepted this revision.
pulkit added a comment.


  Many thanks for investing time and efforts into this. \o/

INLINE COMMENTS

> changegroup.py:1065
> +# it updates tmdnodes (via lookupfn)
> +for d in deltas:
> +pass

maybe, we can prevent walking the deltas in case of trees because if the root 
does not match, the rest of tree won't match. I will try to test this and send 
a patch if that works.

REPOSITORY
  rHG Mercurial

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

To: martinvonz, durin42, #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


Re: [PATCH 3 of 4] storage: also use `deltamode argument` for ifiledata

2018-10-18 Thread Boris FELD

On 16/10/2018 18:41, Gregory Szorc wrote:
> On Tue, Oct 16, 2018 at 10:38 AM Boris Feld  > wrote:
>
> # HG changeset patch
> # User Boris Feld  >
> # Date 1539120395 -7200
> #      Tue Oct 09 23:26:35 2018 +0200
> # Node ID c835d3020e536e8ef368223d628b9e0c6d0c8251
> # Parent  a075ac3487d6d266ec5f2dbd6901da21c38d4ed9
> # EXP-Topic slim-bundle
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull
> https://bitbucket.org/octobus/mercurial-devel/ -r c835d3020e53
> storage: also use `deltamode argument` for ifiledata
>
> Now that lower level uses such argument, we can propagate the
> change to higher
> layers. At some of the higher level, we use `None` as the default
> value to
> simplify imports and argument forwarding  (instead of
> `storageutil.DELTAMODE_STD`). Strictly speaking, we could import
> `storageutil`
> everywhere, however, it did not seem to help readability.
>
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -29,6 +29,10 @@ from . import (
>      util,
>  )
>
> +from .utils import (
> +    storageutil,
> +)
> +
>  _CHANGEGROUPV1_DELTA_HEADER = struct.Struct("20s20s20s20s")
>  _CHANGEGROUPV2_DELTA_HEADER = struct.Struct("20s20s20s20s20s")
>  _CHANGEGROUPV3_DELTA_HEADER = struct.Struct(">20s20s20s20s20sH")
> @@ -697,12 +701,16 @@ def deltagroup(repo, store, nodes, ischa
>          progress = repo.ui.makeprogress(topic, unit=_('chunks'),
>                                          total=len(nodes))
>
> +    deltamode = storageutil.DELTAMODE_STD
> +    if forcedeltaparentprev:
> +        deltamode = storageutil.DELTAMODE_PREV
> +
>      revisions = store.emitrevisions(
>          nodes,
>          nodesorder=nodesorder,
>          revisiondata=True,
>          assumehaveparentrevisions=not ellipses,
> -        deltaprevious=forcedeltaparentprev)
> +        deltamode=deltamode)
>
>      for i, revision in enumerate(revisions):
>          if progress:
> diff --git a/mercurial/filelog.py b/mercurial/filelog.py
> --- a/mercurial/filelog.py
> +++ b/mercurial/filelog.py
> @@ -77,11 +77,11 @@ class filelog(object):
>
>      def emitrevisions(self, nodes, nodesorder=None,
>                        revisiondata=False,
> assumehaveparentrevisions=False,
> -                      deltaprevious=False):
> +                      deltamode=None):
>          return self._revlog.emitrevisions(
>              nodes, nodesorder=nodesorder, revisiondata=revisiondata,
>              assumehaveparentrevisions=assumehaveparentrevisions,
> -            deltaprevious=deltaprevious)
> +            deltamode=deltamode)
>
>      def addrevision(self, revisiondata, transaction, linkrev, p1, p2,
>                      node=None, flags=revlog.REVIDX_DEFAULT_FLAGS,
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -1575,11 +1575,11 @@ class manifestrevlog(object):
>
>      def emitrevisions(self, nodes, nodesorder=None,
>                        revisiondata=False,
> assumehaveparentrevisions=False,
> -                      deltaprevious=False):
> +                      deltamode=None):
>          return self._revlog.emitrevisions(
>              nodes, nodesorder=nodesorder, revisiondata=revisiondata,
>              assumehaveparentrevisions=assumehaveparentrevisions,
> -            deltaprevious=deltaprevious)
> +            deltamode=deltamode)
>
>      def addgroup(self, deltas, linkmapper, transaction,
> addrevisioncb=None):
>          return self._revlog.addgroup(deltas, linkmapper, transaction,
> diff --git a/mercurial/repository.py b/mercurial/repository.py
> --- a/mercurial/repository.py
> +++ b/mercurial/repository.py
> @@ -602,7 +602,7 @@ class ifiledata(interfaceutil.Interface)
>                        nodesorder=None,
>                        revisiondata=False,
>                        assumehaveparentrevisions=False,
> -                      deltaprevious=False):
> +                      deltamode=None):
>          """Produce ``irevisiondelta`` for revisions.
>
>          Given an iterable of nodes, emits objects conforming to the
> @@ -645,10 +645,10 @@ class ifiledata(interfaceutil.Interface)
>          The ``linknode`` attribute on the returned
> ``irevisiondelta`` may not
>          be set and it is the caller's responsibility to resolve
> it, if needed.
>
> -        If ``deltaprevious`` is True and revision data is
> requested, all
> -        revision data 

Re: [PATCH 1 of 4] changegroup: if possible fallback to delta against parents instead of prev

2018-10-18 Thread Boris FELD
This patch is not essential to the series and opens various questions
regarding deltas in bundle. We are dropping it from the series for now.

On 16/10/2018 18:33, Gregory Szorc wrote:
> On Tue, Oct 16, 2018 at 10:35 AM Boris Feld  > wrote:
>
> # HG changeset patch
> # User Boris Feld  >
> # Date 1539114828 -7200
> #      Tue Oct 09 21:53:48 2018 +0200
> # Node ID a69790aaac1946e80e35b28c8f41b14a7f6c0f64
> # Parent  43f0a37bd9ed20b45d73f667acbb0c3035492e1a
> # EXP-Topic slim-bundle
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull
> https://bitbucket.org/octobus/mercurial-devel/ -r a69790aaac19
> changegroup: if possible fallback to delta against parents instead
> of prev
>
> Deltas against parent are likely to be smaller. This is especially
> useful
> since we stop reordering changeset in the bundle.
>
> diff --git a/mercurial/utils/storageutil.py
> b/mercurial/utils/storageutil.py
> --- a/mercurial/utils/storageutil.py
> +++ b/mercurial/utils/storageutil.py
> @@ -394,9 +394,11 @@ def emitrevisions(store, nodes, nodesord
>                  baserev = nullrev
>
>          # Storage has a fulltext revision.
> -
> -        # Let's use the previous revision, which is as good a
> guess as any.
> -        # There is definitely room to improve this logic.
> +        elif assumehaveparentrevisions and p1rev != nullrev:
> +            baserev = p1rev
> +        elif assumehaveparentrevisions and p2rev != nullrev:
> +            baserev = p2rev
> +        # revision is a root, try our luck against the previous
> revision
>
>
> I'm worried this will kill performance on non-generaldelta revlogs.
> Yes, this change is for the case where storage has a fulltext. So we
> need to resolve the baserev's fulltext regardless. But since revlogs
> cache the last fulltext and the last fulltext has a good chance of
> being "prev," this change might take away some cache hits.
>
> Could you please measure the impact of bundling performance on a
> non-generaldelta repo? Preferably one with a lot of merges, like Netbeans.
>  
>
>          elif prevrev is not None:
>              baserev = prevrev
>          else:
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> 
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5147: config: make 'experimental' the section instead of 'experimental.server'

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

REVISION SUMMARY
  This is more common to what we do in core and is better.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py
  mercurial/configitems.py
  tests/test-narrow-clone-stream.t

CHANGE DETAILS

diff --git a/tests/test-narrow-clone-stream.t b/tests/test-narrow-clone-stream.t
--- a/tests/test-narrow-clone-stream.t
+++ b/tests/test-narrow-clone-stream.t
@@ -36,8 +36,8 @@
 
 Enable stream clone on the server
 
-  $ echo "[experimental.server]" >> master/.hg/hgrc
-  $ echo "stream-narrow-clones=True" >> master/.hg/hgrc
+  $ echo "[experimental]" >> master/.hg/hgrc
+  $ echo "server.stream-narrow-clones=True" >> master/.hg/hgrc
 
 Cloning a specific file when stream clone is supported
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -610,7 +610,7 @@
 coreconfigitem('experimental', 'server.manifestdata.recommended-batch-size',
 default=10,
 )
-coreconfigitem('experimental.server', 'stream-narrow-clones',
+coreconfigitem('experimental', 'server.stream-narrow-clones',
 default=False,
 )
 coreconfigitem('experimental', 'single-head-per-branch',
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1691,8 +1691,8 @@
 includepats = kwargs.get(r'includepats')
 excludepats = kwargs.get(r'excludepats')
 
-narrowstream = repo.ui.configbool('experimental.server',
-  'stream-narrow-clones')
+narrowstream = repo.ui.configbool('experimental',
+  'server.stream-narrow-clones')
 
 if (includepats or excludepats) and not narrowstream:
 raise error.Abort(_('server does not support narrow stream clones'))



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


D5139: store: introduce _matchtrackedpath() and use it to filter store files

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 12233.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5139?vs=12212=12233

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

AFFECTED FILES
  mercurial/store.py
  mercurial/streamclone.py
  tests/test-narrow-clone-stream.t

CHANGE DETAILS

diff --git a/tests/test-narrow-clone-stream.t b/tests/test-narrow-clone-stream.t
--- a/tests/test-narrow-clone-stream.t
+++ b/tests/test-narrow-clone-stream.t
@@ -1,7 +1,16 @@
+#testcases tree flat
+
 Tests narrow stream clones
 
   $ . "$TESTDIR/narrow-library.sh"
 
+#if tree
+  $ cat << EOF >> $HGRCPATH
+  > [experimental]
+  > treemanifest = 1
+  > EOF
+#endif
+
 Server setup
 
   $ hg init master
@@ -27,13 +36,51 @@
 
 Enable stream clone on the server
 
-  $ echo "[server]" >> master/.hg/hgrc
+  $ echo "[experimental.server]" >> master/.hg/hgrc
   $ echo "stream-narrow-clones=True" >> master/.hg/hgrc
 
 Cloning a specific file when stream clone is supported
 
   $ hg clone --narrow ssh://user@dummy/master narrow --noupdate --include 
"dir/src/f10" --stream
   streaming all changes
-  remote: abort: server does not support narrow stream clones
-  abort: pull failed on remote
-  [255]
+  * files to transfer, * KB of data (glob)
+  transferred * KB in * seconds (* MB/sec) (glob)
+
+  $ cd narrow
+  $ ls
+  $ hg tracked
+  I path:dir/src/f10
+
+Making sure we have the correct set of requirements
+
+  $ cat .hg/requires
+  dotencode
+  fncache
+  generaldelta
+  narrowhg-experimental
+  revlogv1
+  store
+  treemanifest (tree !)
+
+Making sure store has the required files
+
+  $ ls .hg/store/
+  00changelog.i
+  00manifest.i
+  data
+  fncache
+  meta (tree !)
+  narrowspec
+  undo
+  undo.backupfiles
+  undo.phaseroots
+
+Checking that repository has all the required data and not broken
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  checking directory manifests (tree !)
+  crosschecking files in changesets and manifests
+  checking files
+  checked 40 changesets with 1 changes to 1 files
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -545,10 +545,6 @@
 Returns a 3-tuple of (file count, file size, data iterator).
 """
 
-# temporarily raise error until we add storage level logic
-if includes or excludes:
-raise error.Abort(_("server does not support narrow stream clones"))
-
 with repo.lock():
 
 entries = []
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -24,6 +24,20 @@
 
 parsers = policy.importmod(r'parsers')
 
+def _matchtrackedpath(path, matcher):
+"""parses a fncache entry and returns whether the entry is tracking a path
+matched by matcher or not.
+
+If matcher is None, returns True"""
+
+if matcher is None:
+return True
+path = decodefilename(path)
+if path.startswith('data/'):
+return matcher(path[len('data/'):-len('.i')])
+elif path.startswith('meta/'):
+return matcher.visitdir(path[len('meta/'):-len('/00manifest.i')] or 
'.')
+
 # This avoids a collision between a file named foo and a dir named
 # foo.i or foo.d
 def _encodedir(path):
@@ -413,6 +427,8 @@
 
 def datafiles(self, matcher=None):
 for a, b, size in super(encodedstore, self).datafiles():
+if not _matchtrackedpath(a, matcher):
+continue
 try:
 a = decodefilename(a)
 except KeyError:
@@ -542,6 +558,8 @@
 
 def datafiles(self, matcher=None):
 for f in sorted(self.fncache):
+if not _matchtrackedpath(f, matcher):
+continue
 ef = self.encode(f)
 try:
 yield f, ef, self.getsize(ef)



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


D5138: narrow: only send includepats and excludepats if they are not empty

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 12232.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5138?vs=12211=12232

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -141,8 +141,10 @@
 include, exclude = repo.narrowpats
 kwargs['oldincludepats'] = include
 kwargs['oldexcludepats'] = exclude
-kwargs['includepats'] = include
-kwargs['excludepats'] = exclude
+if include:
+kwargs['includepats'] = include
+if exclude:
+kwargs['excludepats'] = exclude
 # calculate known nodes only in ellipses cases because in non-ellipses 
cases
 # we have all the nodes
 if wireprototypes.ELLIPSESCAP in pullop.remote.capabilities():



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


Re: Rust extensions: the next step

2018-10-18 Thread Gregory Szorc


> On Oct 17, 2018, at 18:45, Georges Racinet  wrote:
> 
> Hi all,
> 
> first, many thanks for the Stockholm sprint, it was my first interaction
> with the Mercurial community, and it's been very welcoming to me.
> 
> I've been pursuing some experiments I started then to convert the Rust
> bindings I've done in the patch series about ancestry iteration (now
> landed) to a proper Python extension, using the cpython crate and Python
> capsules. In short, it works.
> 
> Early benchmarking shows that it's a few percent slower than the direct
> bindings through C code, which I think is acceptable compared to the
> other benefits (clearer integration, easier to generalise, no C code at
> all).
> 
> The end result is a unique shared library importable as
> 'mercurial.rustext', which is itself made of several submodules, ie, one
> can do:
> 
>from mercurial.rustext.ancestor import AncestorsIterator

This all sounds very reasonable to me.

One open item is full PyPy/cffi support. Ideally we’d only write the native 
code interface once. But I think that means cffi everywhere and last I looked, 
CPython into cffi was a bit slower compared to native extensions. I’m willing 
to ignore cffi support for now (PyPy can use pure Python and rely on JIT for 
faster execution). Maybe something like milksnake can help us here? But I’m 
content with using the cpython crate to maintain a Rust-based extension: that’s 
little different from what we do today and we shouldn’t let perfect be the 
enemy of good.

Something else we may want to consider is a single Python module exposing the 
Rust code instead of N. Rust’s more aggressive cross function compilation 
optimization could result in better performance if everything is linked/exposed 
in a single shared library/module/extension. Maybe this is what you are 
proposing? It is unclear if Rust code is linked into the Python extension or 
loaded from a shared shared library.

> 
> It will take me some more time, though, to get that experiment into a
> reviewable state (have to switch soon to other, unrelated, works) and
> we're too close to the freeze anyway, but if someone wants to see it, I
> can share it right away.
> 
> Also, I could summarize some of these thoughts on the Oxidation wiki
> page. Greg, are you okay with that ?

Yes, please update the Oxidation wiki! I’ve been meaning to update it with 
results of discussions at the sprint. I’ve just been busy trying to finish my 
patches for 4.8...

> 
> Regards,
> 
> -- 
> Georges Racinet
> Anybox SAS, http://anybox.fr
> Téléphone: +33 6 51 32 07 27
> GPG: B59E 22AB B842 CAED 77F7 7A7F C34F A519 33AB 0A35, sur serveurs publics
> 
> 
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5137: streamclone: new server config and some API changes for narrow stream clones

2018-10-18 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  @martinvonz many thanks for changing things in flight. Any reason why 
https://phab.mercurial-scm.org/D5138 and https://phab.mercurial-scm.org/D5139 
are not considered during review because with them, you won't have to change 
much things except the config knob to experimental.

REPOSITORY
  rHG Mercurial

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

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


I2P anonymous protocol want to use Mercurial

2018-10-18 Thread za3ter
Hi There, 

Im from I2P community and our developers using Monotone to develop the famous 
anonymous protocol I2P (or the invisible internet project).

Sadly monotone project died since 4 years ago, so we want to have alternative. 

our conditions to make the development software to work well (specially with 
I2P) , to have these criteria: 

- supports resume
- key signed checkins
- revocation of keys/trust function implementation
- easy migration of mtn history into new system

does Mercurial support these options? if no, is it on the road map? if no, then 
why not?

Thank You!

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