D6967: shelve: add method for storing mergestate in changeset extras

2019-10-04 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We store mergestate records in `.hg/merge`. This patch adds a method
  of storage in changeset extras. This will help in the exchange of
  mergestate records to other repos. Also, this can be used by
  `shelve --unresolved` to store the mergestate records.
  
  It uses the storage format supported for hg versions 3.7 or later. For the
  time being, I have omitted the storage of the content of the local version
  of unresolved files.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -26,6 +26,7 @@
 import errno
 import itertools
 import stat
+import struct
 
 from .i18n import _
 from . import (
@@ -56,6 +57,9 @@
 stringutil,
 )
 
+_pack = struct.pack
+_unpack = struct.unpack
+
 backupdir = 'shelve-backup'
 shelvedir = 'shelved'
 shelvefileextensions = ['hg', 'patch', 'shelve']
@@ -66,6 +70,47 @@
 # generic user for all shelve operations
 shelveuser = 'shelve@localhost'
 
+# Merge state record types. See ``mergestate`` docs for more.
+RECORD_LOCAL = b'L'
+RECORD_OTHER = b'O'
+RECORD_MERGED = b'F'
+RECORD_CHANGEDELETE_CONFLICT = b'C'
+RECORD_MERGE_DRIVER_MERGE = b'D'
+RECORD_PATH_CONFLICT = b'P'
+RECORD_MERGE_DRIVER_STATE = b'm'
+RECORD_FILE_VALUES = b'f'
+RECORD_LABELS = b'l'
+RECORD_OVERRIDE = b't'
+RECORD_UNSUPPORTED_MANDATORY = b'X'
+RECORD_UNSUPPORTED_ADVISORY = b'x'
+
+MERGE_DRIVER_STATE_UNMARKED = b'u'
+MERGE_DRIVER_STATE_MARKED = b'm'
+MERGE_DRIVER_STATE_SUCCESS = b's'
+
+MERGE_RECORD_UNRESOLVED = b'u'
+MERGE_RECORD_RESOLVED = b'r'
+MERGE_RECORD_UNRESOLVED_PATH = b'pu'
+MERGE_RECORD_RESOLVED_PATH = b'pr'
+MERGE_RECORD_DRIVER_RESOLVED = b'd'
+
+ACTION_FORGET = b'f'
+ACTION_REMOVE = b'r'
+ACTION_ADD = b'a'
+ACTION_GET = b'g'
+ACTION_PATH_CONFLICT = b'p'
+ACTION_PATH_CONFLICT_RESOLVE = b'pr'
+ACTION_ADD_MODIFIED = b'am'
+ACTION_CREATED = b'c'
+ACTION_DELETED_CHANGED = b'dc'
+ACTION_CHANGED_DELETED = b'cd'
+ACTION_MERGE = b'm'
+ACTION_LOCAL_DIR_RENAME_GET = b'dg'
+ACTION_DIR_RENAME_MOVE_LOCAL = b'dm'
+ACTION_KEEP = b'k'
+ACTION_EXEC = b'e'
+ACTION_CREATED_MERGE = b'cm'
+
 class shelvedfile(object):
 """Helper for the file storing a single shelve
 
@@ -413,6 +458,25 @@
 cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True),
match=match)
 
+def _storeunresolvedmerge(ui, repo, name=None, extra=None):
+"""Store the mergestate information in changeset extra
+
+This will clear the mergestate and also stores the mergestate
+information for later restoration.
+"""
+ms = merge.mergestate.read(repo)
+records = ms._readrecords()
+allowlist = (RECORD_LOCAL, RECORD_OTHER, RECORD_MERGED)
+mergedata = ''
+for key, data in records:
+assert len(key) == 1
+if key not in allowlist:
+key, data = RECORD_OVERRIDE, '%s%s' % (key, data)
+format = '>sI%is' % len(data)
+mergedata = ''.join([mergedata, _pack(format, key, len(data), data)])
+extra['mergerecords'] = mergedata
+ms.reset()
+
 def _includeunknownfiles(repo, pats, opts, extra):
 s = repo.status(match=scmutil.match(repo[None], pats, opts),
 unknown=True)



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


D6966: shelve: add method for storing mergestate in changeset extras

2019-10-04 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We store mergestate records in `.hg/merge`. This patch adds a method
  of storage in changeset extras. This will help in the exchange of
  mergestate records to other repos. Also, this can be used by
  `shelve --unresolved` to store the mergestate records.
  
  It uses the storage format supported for hg versions 3.7 or later. For the
  time being, I have omitted the storage of the content of the local version
  of unresolved files.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -26,6 +26,7 @@
 import errno
 import itertools
 import stat
+import struct
 
 from .i18n import _
 from . import (
@@ -56,6 +57,9 @@
 stringutil,
 )
 
+_pack = struct.pack
+_unpack = struct.unpack
+
 backupdir = 'shelve-backup'
 shelvedir = 'shelved'
 shelvefileextensions = ['hg', 'patch', 'shelve']
@@ -66,6 +70,47 @@
 # generic user for all shelve operations
 shelveuser = 'shelve@localhost'
 
+# Merge state record types. See ``mergestate`` docs for more.
+RECORD_LOCAL = b'L'
+RECORD_OTHER = b'O'
+RECORD_MERGED = b'F'
+RECORD_CHANGEDELETE_CONFLICT = b'C'
+RECORD_MERGE_DRIVER_MERGE = b'D'
+RECORD_PATH_CONFLICT = b'P'
+RECORD_MERGE_DRIVER_STATE = b'm'
+RECORD_FILE_VALUES = b'f'
+RECORD_LABELS = b'l'
+RECORD_OVERRIDE = b't'
+RECORD_UNSUPPORTED_MANDATORY = b'X'
+RECORD_UNSUPPORTED_ADVISORY = b'x'
+
+MERGE_DRIVER_STATE_UNMARKED = b'u'
+MERGE_DRIVER_STATE_MARKED = b'm'
+MERGE_DRIVER_STATE_SUCCESS = b's'
+
+MERGE_RECORD_UNRESOLVED = b'u'
+MERGE_RECORD_RESOLVED = b'r'
+MERGE_RECORD_UNRESOLVED_PATH = b'pu'
+MERGE_RECORD_RESOLVED_PATH = b'pr'
+MERGE_RECORD_DRIVER_RESOLVED = b'd'
+
+ACTION_FORGET = b'f'
+ACTION_REMOVE = b'r'
+ACTION_ADD = b'a'
+ACTION_GET = b'g'
+ACTION_PATH_CONFLICT = b'p'
+ACTION_PATH_CONFLICT_RESOLVE = b'pr'
+ACTION_ADD_MODIFIED = b'am'
+ACTION_CREATED = b'c'
+ACTION_DELETED_CHANGED = b'dc'
+ACTION_CHANGED_DELETED = b'cd'
+ACTION_MERGE = b'm'
+ACTION_LOCAL_DIR_RENAME_GET = b'dg'
+ACTION_DIR_RENAME_MOVE_LOCAL = b'dm'
+ACTION_KEEP = b'k'
+ACTION_EXEC = b'e'
+ACTION_CREATED_MERGE = b'cm'
+
 class shelvedfile(object):
 """Helper for the file storing a single shelve
 
@@ -413,6 +458,25 @@
 cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True),
match=match)
 
+def _storeunresolvedmerge(ui, repo, name=None, extra=None):
+"""Store the mergestate information in changeset extra
+
+This will clear the mergestate and also stores the mergestate
+information for later restoration.
+"""
+ms = merge.mergestate.read(repo)
+records = ms._readrecords()
+allowlist = (RECORD_LOCAL, RECORD_OTHER, RECORD_MERGED)
+mergedata = ''
+for key, data in records:
+assert len(key) == 1
+if key not in allowlist:
+key, data = RECORD_OVERRIDE, '%s%s' % (key, data)
+format = '>sI%is' % len(data)
+mergedata = ''.join([mergedata, _pack(format, key, len(data), data)])
+extra['mergerecords'] = mergedata
+ms.reset()
+
 def _includeunknownfiles(repo, pats, opts, extra):
 s = repo.status(match=scmutil.match(repo[None], pats, opts),
 unknown=True)



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


D6958: hg: move hg script to be a template that gets filled in via make

2019-10-04 Thread mharbison72 (Matt Harbison)
mharbison72 added inline comments.

INLINE COMMENTS

> Makefile:50
> +hg: hg.in.py
> + $(PYTHON) -c "import sys; 
> sys.stdout.write(sys.stdin.read().replace('%(interpreter)s', 
> sys.executable))" < hg.in.py > hg
> + chmod +x hg

Any sane way to get this to strip $(DESTDIR) from the lead?  (Or maybe just 
override it via another parameter.)  That would solve one of the issues with 
the custom Mac install builder (D6846 ), 
but probably causes a problem running `contrib/genosxversion.py` (which wants 
to exec `hg`).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6958/new/

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

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


D6709: config: add --registered flag to show all known configs

2019-10-04 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  Now I understand that this patch does an enormous number of changes. I've 
split this patch into three. Will be working on each of them separately from 
now on.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6709/new/

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

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


D6963: config: show config options in a user-friendly format

2019-10-04 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch does the following things to display the output in a
  user-friendly format:
  
  - Replace bool by yes/no.
  - Converts list to string.
  
  I will be modifying this soon to handle list values in a better way.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/ui.py
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -228,125 +228,125 @@
 test --registered flag
 
   $ hg showconfig --registered
-  annotate.git=False
-  annotate.ignoreblanklines=False
-  annotate.ignorews=False
-  annotate.ignorewsamount=False
-  annotate.ignorewseol=False
-  annotate.nobinary=False
-  annotate.nodates=False
-  annotate.noprefix=False
-  annotate.showfunc=False
+  annotate.git=no
+  annotate.ignoreblanklines=no
+  annotate.ignorews=no
+  annotate.ignorewsamount=no
+  annotate.ignorewseol=no
+  annotate.nobinary=no
+  annotate.nodates=no
+  annotate.noprefix=no
+  annotate.showfunc=no
   annotate.unified=None
-  annotate.word-diff=False
+  annotate.word-diff=no
   auth.cookiefile=None
-  bookmarks.pushing=[]
+  bookmarks.pushing=
   bundle.mainreporoot=$TESTTMP
   chgserver.idletimeout=3600
-  chgserver.skiphash=False
+  chgserver.skiphash=no
   cmdserver.log=None
   cmdserver.max-log-files=7
   cmdserver.max-log-size=1 MB
-  cmdserver.track-log=[b'chgserver', b'cmdserver', b'repocache']
+  cmdserver.track-log=chgserver cmdserver repocache
   color.mode=auto
-  commands.commit.interactive.git=False
-  commands.commit.interactive.ignoreblanklines=False
-  commands.commit.interactive.ignorews=False
-  commands.commit.interactive.ignorewsamount=False
-  commands.commit.interactive.ignorewseol=False
-  commands.commit.interactive.nobinary=False
-  commands.commit.interactive.nodates=False
-  commands.commit.interactive.noprefix=False
-  commands.commit.interactive.showfunc=False
+  commands.commit.interactive.git=no
+  commands.commit.interactive.ignoreblanklines=no
+  commands.commit.interactive.ignorews=no
+  commands.commit.interactive.ignorewsamount=no
+  commands.commit.interactive.ignorewseol=no
+  commands.commit.interactive.nobinary=no
+  commands.commit.interactive.nodates=no
+  commands.commit.interactive.noprefix=no
+  commands.commit.interactive.showfunc=no
   commands.commit.interactive.unified=None
-  commands.commit.interactive.word-diff=False
-  commands.commit.post-status=False
-  commands.rebase.requiredest=False
-  commands.resolve.confirm=False
-  commands.resolve.explicit-re-merge=False
+  commands.commit.interactive.word-diff=no
+  commands.commit.post-status=no
+  commands.rebase.requiredest=no
+  commands.resolve.confirm=no
+  commands.resolve.explicit-re-merge=no
   commands.resolve.mark-check=none
-  commands.revert.interactive.git=False
-  commands.revert.interactive.ignoreblanklines=False
-  commands.revert.interactive.ignorews=False
-  commands.revert.interactive.ignorewsamount=False
-  commands.revert.interactive.ignorewseol=False
-  commands.revert.interactive.nobinary=False
-  commands.revert.interactive.nodates=False
-  commands.revert.interactive.noprefix=False
-  commands.revert.interactive.showfunc=False
+  commands.revert.interactive.git=no
+  commands.revert.interactive.ignoreblanklines=no
+  commands.revert.interactive.ignorews=no
+  commands.revert.interactive.ignorewsamount=no
+  commands.revert.interactive.ignorewseol=no
+  commands.revert.interactive.nobinary=no
+  commands.revert.interactive.nodates=no
+  commands.revert.interactive.noprefix=no
+  commands.revert.interactive.showfunc=no
   commands.revert.interactive.unified=None
-  commands.revert.interactive.word-diff=False
-  commands.show.aliasprefix=[]
-  commands.status.relative=False
+  commands.revert.interactive.word-diff=no
+  commands.show.aliasprefix=
+  commands.status.relative=no
   commands.status.terse=
-  commands.status.verbose=False
+  commands.status.verbose=no
   commands.update.check=None
-  commands.update.requiredest=False
-  convert.bzr.saverev=True
-  convert.cvsps.cache=True
+  commands.update.requiredest=no
+  convert.bzr.saverev=yes
+  convert.cvsps.cache=yes
   convert.cvsps.fuzz=60
   convert.cvsps.logencoding=None
   convert.cvsps.mergefrom=None
   convert.cvsps.mergeto=None
-  convert.git.committeractions=[b'messagedifferent']
-  convert.git.extrakeys=[]
-  convert.git.findcopiesharder=False
+  convert.git.committeractions=messagedifferent
+  convert.git.extrakeys=
+  convert.git.findcopiesharder=no
   convert.git.remoteprefix=remote
   convert.git.renamelimit=400
-  convert.git.saverev=True
+  convert.git.saverev=yes
   convert.git.similarity=50
-  convert.git.skipsubmodules=False
-  convert.hg.clonebranches=False
-  convert.hg.ignoreerrors=False
-  

mercurial@43043: new changeset

2019-10-04 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/e370f9e4bfad
changeset:   43043:e370f9e4bfad
bookmark:@
tag: tip
parent:  43042:03e769278ef3
parent:  43029:c5dc122fdc2b
user:Yuya Nishihara 
date:Thu Oct 03 23:39:29 2019 -0400
summary: merge with stable

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


D6962: config: add defaults and experimental status for --debug flag

2019-10-04 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds `EXPERIMENTAL` to the output of 'showconfig --debug'
  for experimental flags which are not under the `section == 'experimental'`.
  This also adds the default value of the config item if it differs from
  the current value.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/ui.py
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -972,3 +972,11 @@
   diff.showfunc=False
   diff.unified=None
   diff.word-diff=False
+
+  $ hg showconfig --debug --registered | grep 'cmdserver'
+  none: cmdserver.log=None
+  none: cmdserver.max-log-files=7
+  none: cmdserver.max-log-size=1 MB
+  none: cmdserver.max-repo-cache(EXPERIMENTAL)=0 (default: None)
+  none: cmdserver.message-encodings(EXPERIMENTAL)=[] (default: None)
+  none: cmdserver.track-log=[b'chgserver', b'cmdserver', b'repocache']
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -833,6 +833,9 @@
 # --verbose is specified.
 continue
 value = self._config(section, name, untrusted=untrusted)
+if self.debugflag:
+if item.experimental or 'experimental' in name:
+name = ''.join([name, '(EXPERIMENTAL)'])
 yield section, name, value
 
 def plain(self, feature=None):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1890,7 +1890,12 @@
 fm.data(name=entryname)
 fm.write('value', '%s\n', value)
 else:
-fm.write('name value', '%s=%s\n', entryname, value)
+if (opts.get('registered') and
+value != pycompat.bytestr(defaultvalue) and ui.debugflag):
+fm.write('name value defaultvalue', '%s=%s (default: %s)\n',
+  entryname, value, pycompat.bytestr(defaultvalue))
+else:
+fm.write('name value', '%s=%s\n', entryname, value)
 matched = True
 fm.end()
 if matched:



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


D6961: py3: fix phabricator's use of json.loads() for py3.5

2019-10-04 Thread Kwan (Ian Moody)
Closed by commit rHG0f90c2d2d7e8: py3: fix phabricators use of 
json.loads() for py3.5 (authored by Kwan).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6961?vs=16799=16801

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6961/new/

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -251,7 +251,8 @@
 parsed = pycompat.rapply(
 lambda x: encoding.unitolocal(x) if isinstance(x, pycompat.unicode)
 else x,
-json.loads(body)
+# json.loads only accepts bytes from py3.6+
+json.loads(encoding.unifromlocal(body))
 )
 if parsed.get(b'error_code'):
 msg = (_(b'Conduit Error (%s): %s')



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


D6709: config: add --registered flag to show all known configs

2019-10-04 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh edited the summary of this revision.
navaneeth.suresh updated this revision to Diff 16800.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6709?vs=16306=16800

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6709/new/

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/ui.py
  tests/test-basic.t
  tests/test-commandserver.t
  tests/test-completion.t
  tests/test-config.t

CHANGE DETAILS

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -224,3 +224,751 @@
   > done
   $ HGRCPATH=configs hg config section.key
   99
+
+test --registered flag
+
+  $ hg showconfig --registered
+  annotate.git=False
+  annotate.ignoreblanklines=False
+  annotate.ignorews=False
+  annotate.ignorewsamount=False
+  annotate.ignorewseol=False
+  annotate.nobinary=False
+  annotate.nodates=False
+  annotate.noprefix=False
+  annotate.showfunc=False
+  annotate.unified=None
+  annotate.word-diff=False
+  auth.cookiefile=None
+  bookmarks.pushing=[]
+  bundle.mainreporoot=$TESTTMP
+  chgserver.idletimeout=3600
+  chgserver.skiphash=False
+  cmdserver.log=None
+  cmdserver.max-log-files=7
+  cmdserver.max-log-size=1 MB
+  cmdserver.track-log=[b'chgserver', b'cmdserver', b'repocache']
+  color.mode=auto
+  commands.commit.interactive.git=False
+  commands.commit.interactive.ignoreblanklines=False
+  commands.commit.interactive.ignorews=False
+  commands.commit.interactive.ignorewsamount=False
+  commands.commit.interactive.ignorewseol=False
+  commands.commit.interactive.nobinary=False
+  commands.commit.interactive.nodates=False
+  commands.commit.interactive.noprefix=False
+  commands.commit.interactive.showfunc=False
+  commands.commit.interactive.unified=None
+  commands.commit.interactive.word-diff=False
+  commands.commit.post-status=False
+  commands.rebase.requiredest=False
+  commands.resolve.confirm=False
+  commands.resolve.explicit-re-merge=False
+  commands.resolve.mark-check=none
+  commands.revert.interactive.git=False
+  commands.revert.interactive.ignoreblanklines=False
+  commands.revert.interactive.ignorews=False
+  commands.revert.interactive.ignorewsamount=False
+  commands.revert.interactive.ignorewseol=False
+  commands.revert.interactive.nobinary=False
+  commands.revert.interactive.nodates=False
+  commands.revert.interactive.noprefix=False
+  commands.revert.interactive.showfunc=False
+  commands.revert.interactive.unified=None
+  commands.revert.interactive.word-diff=False
+  commands.show.aliasprefix=[]
+  commands.status.relative=False
+  commands.status.terse=
+  commands.status.verbose=False
+  commands.update.check=None
+  commands.update.requiredest=False
+  convert.bzr.saverev=True
+  convert.cvsps.cache=True
+  convert.cvsps.fuzz=60
+  convert.cvsps.logencoding=None
+  convert.cvsps.mergefrom=None
+  convert.cvsps.mergeto=None
+  convert.git.committeractions=[b'messagedifferent']
+  convert.git.extrakeys=[]
+  convert.git.findcopiesharder=False
+  convert.git.remoteprefix=remote
+  convert.git.renamelimit=400
+  convert.git.saverev=True
+  convert.git.similarity=50
+  convert.git.skipsubmodules=False
+  convert.hg.clonebranches=False
+  convert.hg.ignoreerrors=False
+  convert.hg.preserve-hash=False
+  convert.hg.revs=None
+  convert.hg.saverev=False
+  convert.hg.sourcename=None
+  convert.hg.startrev=None
+  convert.hg.tagsbranch=default
+  convert.hg.usebranchnames=True
+  convert.localtimezone=False
+  convert.p4.startrev=0
+  convert.skiptags=False
+  convert.svn.branches=None
+  convert.svn.debugsvnlog=True
+  convert.svn.startrev=0
+  convert.svn.tags=None
+  convert.svn.trunk=None
+  diff.git=False
+  diff.ignoreblanklines=False
+  diff.ignorews=False
+  diff.ignorewsamount=False
+  diff.ignorewseol=False
+  diff.nobinary=False
+  diff.nodates=False
+  diff.noprefix=False
+  diff.showfunc=False
+  diff.unified=None
+  diff.word-diff=False
+  email.bcc=None
+  email.cc=None
+  email.charsets=[]
+  email.from=None
+  email.method=smtp
+  email.reply-to=None
+  email.to=None
+  format.bookmarks-in-store=False
+  format.dotencode=True
+  format.obsstore-version=None
+  format.revlog-compression=$BUNDLE2_COMPRESSIONS$
+  format.sparse-revlog=True
+  format.usefncache=True
+  format.usegeneraldelta=True
+  format.usestore=True
+  fsmonitor.warn_update_file_count=5
+  fsmonitor.warn_when_unused=True
+  hostsecurity.ciphers=None
+  hostsecurity.disabletls10warning=False
+  http.timeout=None
+  http_proxy.always=False
+  http_proxy.host=None
+  http_proxy.no=[]
+  http_proxy.passwd=None
+  http_proxy.user=None
+  logtoprocess.command=None
+  logtoprocess.commandexception=None
+  logtoprocess.commandfinish=None
+  logtoprocess.develwarn=None
+  logtoprocess.uiblocked=None
+  merge.checkignored=abort
+  merge.checkunknown=abort
+  merge.followcopies=True
+  merge.on-failure=continue
+  

D6961: py3: fix phabricator's use of json.loads() for py3.5

2019-10-04 Thread Kwan (Ian Moody)
Kwan created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Missed this in c340a8ac7ef3 
 
since `loads()` takes bytes from 3.6 onwards.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -251,7 +251,8 @@
 parsed = pycompat.rapply(
 lambda x: encoding.unitolocal(x) if isinstance(x, pycompat.unicode)
 else x,
-json.loads(body)
+# json.loads only accepts bytes from py3.6+
+json.loads(encoding.unifromlocal(body))
 )
 if parsed.get(b'error_code'):
 msg = (_(b'Conduit Error (%s): %s')



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


D6960: run-tests: make coverage work out of tree

2019-10-04 Thread Kwan (Ian Moody)
Closed by commit rHGe360acfaf210: run-tests: make coverage work out of tree 
(authored by Kwan).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6960?vs=16796=16798

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6960/new/

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3170,7 +3170,7 @@
 print('WARNING: cannot fix hg.bat reference to python.exe')
 
 if self.options.anycoverage:
-custom = os.path.join(self._testdir, 'sitecustomize.py')
+custom = os.path.join(osenvironb[b'RUNTESTDIR'], 
'sitecustomize.py')
 target = os.path.join(self._pythondir, 'sitecustomize.py')
 vlog('# Installing coverage trigger to %s' % target)
 shutil.copyfile(custom, target)



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


D6959: setup: switch to having setup.py generate an hg script

2019-10-04 Thread durin42 (Augie Fackler)
durin42 added a comment.
durin42 planned changes to this revision.


  This currently breaks a bunch of stuff, I think because the installed hg 
isn't on $PATH?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6959/new/

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

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


D6959: setup: switch to having setup.py generate an hg script

2019-10-04 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 16797.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6959?vs=16795=16797

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6959/new/

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

AFFECTED FILES
  hg
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -206,7 +206,7 @@
 with open(path, 'wb') as fh:
 fh.write(content)
 
-scripts = ['hg']
+scripts = []
 if os.name == 'nt':
 # We remove hg.bat if we are able to build hg.exe.
 scripts.append('contrib/win32/hg.bat')
@@ -1504,6 +1504,11 @@
   package_data=packagedata,
   cmdclass=cmdclass,
   distclass=hgdist,
+  entry_points={
+  'console_scripts': [
+  'hg = mercurial.main:main',
+  ],
+  },
   options={
   'py2exe': {
   'bundle_files': 3,
diff --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -27,17 +27,5 @@
 libdir = os.path.abspath(libdir)
 sys.path.insert(0, libdir)
 
-from hgdemandimport import tracing
-with tracing.log('hg script'):
-# enable importing on demand to reduce startup time
-try:
-if sys.version_info[0] < 3 or sys.version_info >= (3, 6):
-import hgdemandimport; hgdemandimport.enable()
-except ImportError:
-sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
- ' '.join(sys.path))
-sys.stderr.write("(check your install and PYTHONPATH)\n")
-sys.exit(-1)
-
-from mercurial import dispatch
-dispatch.run()
+from mercurial import main
+main.main()



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


D6960: run-tests: make coverage work out of tree

2019-10-04 Thread Kwan (Ian Moody)
Kwan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Currently coverage fails when run on an out-of-tree extension since
  run-tests.py tries to load sitecustomize.py from self._testdir, which is the
  dir for the extension's tests.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3170,7 +3170,7 @@
 print('WARNING: cannot fix hg.bat reference to python.exe')
 
 if self.options.anycoverage:
-custom = os.path.join(self._testdir, 'sitecustomize.py')
+custom = os.path.join(osenvironb[b'RUNTESTDIR'], 
'sitecustomize.py')
 target = os.path.join(self._pythondir, 'sitecustomize.py')
 vlog('# Installing coverage trigger to %s' % target)
 shutil.copyfile(custom, target)



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


D6959: setup: switch to having setup.py generate an hg script

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

REVISION SUMMARY
  This gives us a more-standard entry_points setup and lets us skip the
  step of generating the interpreter shebang etc, easing some Python 3
  work.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hg
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -206,7 +206,7 @@
 with open(path, 'wb') as fh:
 fh.write(content)
 
-scripts = ['hg']
+scripts = []
 if os.name == 'nt':
 # We remove hg.bat if we are able to build hg.exe.
 scripts.append('contrib/win32/hg.bat')
@@ -1504,6 +1504,11 @@
   package_data=packagedata,
   cmdclass=cmdclass,
   distclass=hgdist,
+  entry_points=[
+  'console_scripts': [
+  'hg = mercurial.main:main',
+  ],
+  ],
   options={
   'py2exe': {
   'bundle_files': 3,
diff --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -27,17 +27,5 @@
 libdir = os.path.abspath(libdir)
 sys.path.insert(0, libdir)
 
-from hgdemandimport import tracing
-with tracing.log('hg script'):
-# enable importing on demand to reduce startup time
-try:
-if sys.version_info[0] < 3 or sys.version_info >= (3, 6):
-import hgdemandimport; hgdemandimport.enable()
-except ImportError:
-sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
- ' '.join(sys.path))
-sys.stderr.write("(check your install and PYTHONPATH)\n")
-sys.exit(-1)
-
-from mercurial import dispatch
-dispatch.run()
+from mercurial import main
+main.main()



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


D6958: hg: move hg script to be a template that gets filled in via make

2019-10-04 Thread indygreg (Gregory Szorc)
This revision now requires changes to proceed.
indygreg added a comment.
indygreg requested changes to this revision.


  Changes are coming.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6958/new/

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

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


D6956: unfinishedstate: suggested `hg update .` (including `.`) to complete update

2019-10-04 Thread spectral (Kyle Lippincott)
spectral added inline comments.

INLINE COMMENTS

> state.py:204
>  cmdhint=_("use 'hg update' to get a consistent checkout"),
> -statushint=_("To continue:hg update")
> +statushint=_("To continue:hg update .")
>  )

I wonder if it would be possible to portably quote the `.` so that users don't 
think it's just sitting on the end there.  Something like `hg update '.'` If 
not, then we should surround the entire thing in quotes if possible, something 
like `To continue:   'hg update .'`

Thoughts?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6956/new/

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

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


Re: Interest in integrating hg-git into Mercurial

2019-10-04 Thread Benito van der Zander

Hi,

there are also distribution issues with a non-integrated hg-git.

For example I have been using OpenSUSE Tumbleweed, and they updated to 
Mercurial 5, but did not update hg-git. The hg-git for hg 4 does not 
seem to work with hg 5, so I have not been able to use hg-git for 
months, till I switched to Ubuntu, which still only has hg 4.


Arch and Manjaro look like they have the same problem, hg is in their 
official repository and version 5, but I can only find hg-git in AUR 
with version 4.


(tortoise-hg had the same problem. If not all hg packages are 
integrated, they need to have the same maintainer or the linux 
distributions screw it up)


Bye,

Benito

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


D6956: unfinishedstate: suggested `hg update .` (including `.`) to complete update

2019-10-04 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG8c4f32b907e6: unfinishedstate: suggested `hg update .` 
(including `.`) to complete update (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6956?vs=16788=16793

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6956/new/

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

AFFECTED FILES
  mercurial/state.py
  tests/test-merge1.t

CHANGE DETAILS

diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -49,7 +49,7 @@
   ? b/nonempty
   # The repository is in an unfinished *update* state.
   
-  # To continue:hg update
+  # To continue:hg update .
   
 
   $ rm b/nonempty
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -201,7 +201,7 @@
 'update', fname='updatestate', clearable=True,
 cmdmsg=_('last update was interrupted'),
 cmdhint=_("use 'hg update' to get a consistent checkout"),
-statushint=_("To continue:hg update")
+statushint=_("To continue:hg update .")
 )
 addunfinished(
 'bisect', fname='bisect.state', allowcommit=True, reportonly=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


D6957: rebase: unconditionally clear merge state when `--stop`ing a rebase

2019-10-04 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In D6957#101985 , @martinvonz 
wrote:
  
  > In D6957#101984 , @marmoute 
wrote:
  >
  >> In D6957#101977 , @martinvonz 
wrote:
  >>
  >>> How was it failing for you?
  >>> I don't think I've used `hg rebase --stop`, but I had been wondering what 
it would do with the working directory. It's unclear to me what it should do, 
and now after looking at the code, it's also unclear what the author meant it 
to do. Maybe it would be best to just leave the working directory untouched? 
Oh, we should also compare to what `hg evolve --stop` does (I haven't checked).
  >>
  >> The evolve semantic, is to:
  >>
  >> - get out of the current conflict (so, reverting the working copy)
  >> - preserve all successful evolution so far.
  >>
  >> Since you cannot `continue` after the --stop, we would not be able to do 
anything good with the conflict if the user resolved it anyway.
  >> I think rebase should have the same logic and revert the current conflict 
(preserving all successfully rebased revision)
  >
  > True, you'd get to resolve the conflicts on the next `hg rebase/evolve` 
anyway, so I agree there's no need to preserve the working copy.
  > @durin42, any idea how you ended up with just one working copy parent?
  
  I don't have just one parent. If you want to inspect the state, look at 
`augie/a 59473`;)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6957/new/

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

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


D6957: rebase: unconditionally clear merge state when `--stop`ing a rebase

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


  In D6957#101984 , @marmoute 
wrote:
  
  > In D6957#101977 , @martinvonz 
wrote:
  >
  >> How was it failing for you?
  >> I don't think I've used `hg rebase --stop`, but I had been wondering what 
it would do with the working directory. It's unclear to me what it should do, 
and now after looking at the code, it's also unclear what the author meant it 
to do. Maybe it would be best to just leave the working directory untouched? 
Oh, we should also compare to what `hg evolve --stop` does (I haven't checked).
  >
  > The evolve semantic, is to:
  >
  > - get out of the current conflict (so, reverting the working copy)
  > - preserve all successful evolution so far.
  >
  > Since you cannot `continue` after the --stop, we would not be able to do 
anything good with the conflict if the user resolved it anyway.
  > I think rebase should have the same logic and revert the current conflict 
(preserving all successfully rebased revision)
  
  True, you'd get to resolve the conflicts on the next `hg rebase/evolve` 
anyway, so I agree there's no need to preserve the working copy.
  
  @durin42, any idea how you ended up with just one working copy parent?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6957/new/

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

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


D6957: rebase: unconditionally clear merge state when `--stop`ing a rebase

2019-10-04 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  In D6957#101977 , @martinvonz 
wrote:
  
  > How was it failing for you?
  > I don't think I've used `hg rebase --stop`, but I had been wondering what 
it would do with the working directory. It's unclear to me what it should do, 
and now after looking at the code, it's also unclear what the author meant it 
to do. Maybe it would be best to just leave the working directory untouched? 
Oh, we should also compare to what `hg evolve --stop` does (I haven't checked).
  
  The evolve semantic, is to:
  
  - get out of the current conflict (so, reverting the working copy)
  - preserve all successful evolution so far.
  
  Since you cannot `continue` after the --stop, we would not be able to do 
anything good with the conflict if the user resolved it anyway.
  
  I think rebase should have the same logic and revert the current conflict 
(preserving all successfully rebased revision)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6957/new/

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

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


Re: [PATCH] patchcopies: backout and optimisation that backfired

2019-10-04 Thread Pierre-Yves David

On 10/4/19 2:18 PM, Yuya Nishihara wrote:

On Fri, 04 Oct 2019 00:05:44 -0400, Pierre-Yves David wrote:

# HG changeset patch
# User Pierre-Yves David 
# Date 1570072771 14400
#  Wed Oct 02 23:19:31 2019 -0400
# Node ID 07010e0cae5cab2ff0c375f24c1d8185ead8e957
# Parent  03e769278ef31f648ba5c49be719da5b73587607
# EXP-Topic patchcopies-regression
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
07010e0cae5c
patchcopies: backout and optimisation that backfired

In 8a0136f69027 we introduced a new "introrev" function. And in d98fb3f42f33, we
made it smart enough to speedup various pathological case.

However, it turns out that is can also introduce massive slow down in some other
cases. To clarify the situation, I ran `perfpathcopies` on 6989 pair of revision
in the pypy repository (`hg perfhelper-pathcopies`. The result is massively in 
favor of dropping this
condition:

Here are various numbers (before this changeset/after this changesets)

 source   destination  before  afterabs-timeratio
worth cases 0c90acafea5d 7a260b2c45111.251143 1.775874   -0.524731 1.419401
 795743bd02b0 daa08b2d951c1.276092 1.722316   -0.446224 1.349680
 d7b4ace71d7e a4fedb1664ee1.046802 1.491993   -0.445191 1.425287
 464d641a9035 4d87b3d82dc21.072234 1.509769   -0.437535 1.408059
 a305590465d6 a84f8ceb87401.322278 1.738900   -0.416622 1.315079
worse  1%   dbfbfcf077e9 89183b3a84f31.471880 1.735137   -0.263257 1.178858
worth  5%   688a132b06b6 573e529840d70.090268 0.118713   -0.028445 1.315117
worth 10%   0bfaff4207c3 dca96cba7aee1.790686 1.795441   -0.004755 1.002655
worth 25%   e99ce6af254c a7dedcc55d550.001954 0.002108   -0.000154 1.078813
median  9e7c5b33e755 c6c97bf468460.001925 0.0019010.24 0.987532
best 25%3f055112fae9 df1447de24d70.002923 0.0021630.000760 0.739993
best 10%da67e5b7be9e f2d3714715880.473663 0.4413570.032306 0.931795
best  5%b02f6ce0d05b 9b4bd629bb441.664841 1.4273230.237518 0.857333
best  1%73ea83bf410b ed910c5221d93.005100 0.1389982.866102 0.046254
best cases  80b492d79663 1456861b1ea6 1464.845562 3.942297 1460.903265 0.002691
 ace7255d9a26 682589af6612 1594.849940 2.467435 1592.382505 0.001547
 c3b14617fbd7 743a0fcaa4eb 1618.130257 2.636641 1615.493616 0.001629
 c3b14617fbd7 9ba6ab77fd29 1621.882135 2.670315 1619.211820 0.001646
 ef865da04745 421ca854cd86 1631.803875 2.646586 1629.157289 0.001622


As one can see, the average case is not really impacted. However, the worth case
we get after this changeset are much better than the one we had before it. We
have 30 pairs where improvement is > 10 minutes.


This reflect in the combined time for all pairs
before: 37700s
after:   1898s (-95%)

If we remove these last 30 case, we still see a significant improvements:

before: 2347s
after:  1898s (-20%)

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -160,8 +160,6 @@ def _tracefile(fctx, am, basemf, limit):
  return path
  if basemf and basemf.get(path, None) == f.filenode():
  return path
-if not f.isintroducedafter(limit):
-return None


So, _tracefile() no longer stops at the limit. Maybe we can remove
_findlimit() as well if it's worth nothing.

Alternatively, maybe the limit could be enforced by linkrev(), e.g.
f.linkrev() < repo[limit][path].linkrev(). I don't know if it's good for
mitigation of the worst case, and we'll probably need to adjust _findlimit()
to make sure repo[limit][path].linkrev() is the lowest revision.


oh, right. The code using introrev was supposed to be a "better" version 
of something based on linkrev. I suppose that using linkrev will still 
yield some benefit without falling into huge slowdown.


I'll update the patch and gather new timing. Thanks


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


Re: [PATCH] patchcopies: backout and optimisation that backfired

2019-10-04 Thread Yuya Nishihara
On Fri, 04 Oct 2019 00:05:44 -0400, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1570072771 14400
> #  Wed Oct 02 23:19:31 2019 -0400
> # Node ID 07010e0cae5cab2ff0c375f24c1d8185ead8e957
> # Parent  03e769278ef31f648ba5c49be719da5b73587607
> # EXP-Topic patchcopies-regression
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 07010e0cae5c
> patchcopies: backout and optimisation that backfired
> 
> In 8a0136f69027 we introduced a new "introrev" function. And in d98fb3f42f33, 
> we
> made it smart enough to speedup various pathological case.
> 
> However, it turns out that is can also introduce massive slow down in some 
> other
> cases. To clarify the situation, I ran `perfpathcopies` on 6989 pair of 
> revision
> in the pypy repository (`hg perfhelper-pathcopies`. The result is massively 
> in favor of dropping this
> condition:
> 
> Here are various numbers (before this changeset/after this changesets)
> 
> source   destination  before  afterabs-timeratio
> worth cases 0c90acafea5d 7a260b2c45111.251143 1.775874   -0.524731 
> 1.419401
> 795743bd02b0 daa08b2d951c1.276092 1.722316   -0.446224 
> 1.349680
> d7b4ace71d7e a4fedb1664ee1.046802 1.491993   -0.445191 
> 1.425287
> 464d641a9035 4d87b3d82dc21.072234 1.509769   -0.437535 
> 1.408059
> a305590465d6 a84f8ceb87401.322278 1.738900   -0.416622 
> 1.315079
> worse  1%   dbfbfcf077e9 89183b3a84f31.471880 1.735137   -0.263257 
> 1.178858
> worth  5%   688a132b06b6 573e529840d70.090268 0.118713   -0.028445 
> 1.315117
> worth 10%   0bfaff4207c3 dca96cba7aee1.790686 1.795441   -0.004755 
> 1.002655
> worth 25%   e99ce6af254c a7dedcc55d550.001954 0.002108   -0.000154 
> 1.078813
> median  9e7c5b33e755 c6c97bf468460.001925 0.0019010.24 
> 0.987532
> best 25%3f055112fae9 df1447de24d70.002923 0.0021630.000760 
> 0.739993
> best 10%da67e5b7be9e f2d3714715880.473663 0.4413570.032306 
> 0.931795
> best  5%b02f6ce0d05b 9b4bd629bb441.664841 1.4273230.237518 
> 0.857333
> best  1%73ea83bf410b ed910c5221d93.005100 0.1389982.866102 
> 0.046254
> best cases  80b492d79663 1456861b1ea6 1464.845562 3.942297 1460.903265 
> 0.002691
> ace7255d9a26 682589af6612 1594.849940 2.467435 1592.382505 
> 0.001547
> c3b14617fbd7 743a0fcaa4eb 1618.130257 2.636641 1615.493616 
> 0.001629
> c3b14617fbd7 9ba6ab77fd29 1621.882135 2.670315 1619.211820 
> 0.001646
> ef865da04745 421ca854cd86 1631.803875 2.646586 1629.157289 
> 0.001622
> 
> 
> As one can see, the average case is not really impacted. However, the worth 
> case
> we get after this changeset are much better than the one we had before it. We
> have 30 pairs where improvement is > 10 minutes.
> 
> 
> This reflect in the combined time for all pairs
> before: 37700s
> after:   1898s (-95%)
> 
> If we remove these last 30 case, we still see a significant improvements:
> 
> before: 2347s
> after:  1898s (-20%)
> 
> diff --git a/mercurial/copies.py b/mercurial/copies.py
> --- a/mercurial/copies.py
> +++ b/mercurial/copies.py
> @@ -160,8 +160,6 @@ def _tracefile(fctx, am, basemf, limit):
>  return path
>  if basemf and basemf.get(path, None) == f.filenode():
>  return path
> -if not f.isintroducedafter(limit):
> -return None

So, _tracefile() no longer stops at the limit. Maybe we can remove
_findlimit() as well if it's worth nothing.

Alternatively, maybe the limit could be enforced by linkrev(), e.g.
f.linkrev() < repo[limit][path].linkrev(). I don't know if it's good for
mitigation of the worst case, and we'll probably need to adjust _findlimit()
to make sure repo[limit][path].linkrev() is the lowest revision.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6665: continue: added support for graft

2019-10-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 16792.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6665?vs=16173=16792

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6665/new/

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

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

CHANGE DETAILS

diff --git a/tests/test-issue1175.t b/tests/test-issue1175.t
--- a/tests/test-issue1175.t
+++ b/tests/test-issue1175.t
@@ -1,3 +1,11 @@
+#testcases continueflag continuecommand
+#if continueflag
+  $ cat >> $HGRCPATH < [alias]
+  > continue = graft --continue
+  > EOF
+#endif
+
 https://bz.mercurial-scm.org/1175
 
   $ hg init
@@ -80,7 +88,7 @@
   $ hg resolve --mark b
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+  $ hg continue
   grafting 1:5974126fad84 "b1"
   warning: can't find ancestor for 'b' copied from 'a'!
   $ hg log -f b -T 'changeset:   {rev}:{node|short}\nsummary: {desc}\n\n'
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -1,4 +1,4 @@
-#testcases abortcommand abortflag
+#testcases commandmode abortflag continueflag
 
   $ cat >> $HGRCPATH < [extdiff]
@@ -13,6 +13,13 @@
   > EOF
 #endif
 
+#if continueflag
+  $ cat >> $HGRCPATH < [alias]
+  > continue = graft --continue
+  > EOF
+#endif
+
 Create a repo with some stuff in it:
 
   $ hg init a
@@ -92,9 +99,11 @@
 
   $ hg -q up -cr tip
   $ hg rm -q e
-  $ hg graft --continue
-  abort: no graft in progress
-  [255]
+  $ hg continue
+  abort: no graft in progress (continueflag !)
+  abort: no operation in progress (no-continueflag !)
+  [255]
+
   $ hg revert -r . -q e
 
 Need to specify a rev:
@@ -1697,7 +1706,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+
+#if commandmode
+  $ hg continue --dry-run
+  graft in progress, will be resumed
+#endif
+
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1754,7 +1769,7 @@
   (no more unresolved files)
   continue: hg graft --continue
 
-  $ hg graft --continue
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1803,7 +1818,7 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1843,7 +1858,7 @@
   (no more unresolved files)
   continue: hg graft --continue
 
-  $ hg graft --continue
+  $ hg continue
   grafting 1:80e6d2c47cfe "added b"
   grafting 2:8be98ac1a569 "added c"
 
@@ -1997,7 +2012,7 @@
 
   $ hg abort
   abort: no interrupted graft to abort (abortflag !)
-  abort: no operation in progress (abortcommand !)
+  abort: no operation in progress (no-abortflag !)
   [255]
 
 when stripping is required
@@ -2026,7 +2041,7 @@
   abort: cannot specify any other flag with '--abort'
   [255]
 
-#if abortcommand
+#if commandmode
 when in dry-run mode
   $ hg abort --dry-run
   graft in progress, will be aborted
@@ -2273,7 +2288,7 @@
   (no more unresolved files)
   continue: hg graft --continue
 
-  $ hg graft --continue
+  $ hg continue
   grafting 3:09e253b87e17 "A in file a"
   $ hg log -GT "{rev}:{node|short} {desc}\n"
   @  4:2aa9ad1006ff B in file a
@@ -2350,7 +2365,7 @@
   $ hg resolve --mark
   (no more unresolved files)
   continue: hg graft --continue
-  $ hg graft --continue
+  $ hg continue
   grafting 3:09e253b87e17 "A in file a"
   $ hg diff
   diff -r 2aa9ad1006ff a
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2630,6 +2630,7 @@
 statemod.addunfinished(
 'graft', fname='graftstate', clearable=True, stopflag=True,
 continueflag=True, abortfunc=cmdutil.hgabortgraft,
+continuefunc=cmdutil.continuegraft,
 cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
 )
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3426,6 +3426,29 @@
 graftstate = statemod.cmdstate(repo, 'graftstate')
 return abortgraft(ui, repo, graftstate)
 
+def continuegraft(ui, repo):
+"""logic to resume interrupted graft using 'hg continue'"""
+with repo.wlock():
+graftstate = statemod.cmdstate(repo, 'graftstate')
+opts = {}
+statedata = {}
+cont = True
+basectx = None
+nodes, opts = updateopts(repo, graftstate, opts)
+revs = [repo[node].rev() for node in nodes]
+skipped = set()
+if basectx is None:
+# check for merges
+for rev in repo.revs('%ld and merge()', revs):
+ui.warn(_('skipping ungraftable merge revision %d\n') % rev)
+skipped.add(rev)
+revs = [r for r in revs if r not in 

D6659: graft: split graft code into seperate functions

2019-10-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 16791.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6659?vs=16155=16791

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6659/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2470,9 +2470,6 @@
 if not opts.get('date') and opts.get('currentdate'):
 opts['date'] = "%d %d" % dateutil.makedate()
 
-editor = cmdutil.getcommiteditor(editform='graft',
- **pycompat.strkwargs(opts))
-
 cont = False
 if opts.get('no_commit'):
 if opts.get('edit'):
@@ -2518,16 +2515,7 @@
 raise error.Abort(_("can't specify --continue and revisions"))
 # read in unfinished revisions
 if graftstate.exists():
-statedata = cmdutil.readgraftstate(repo, graftstate)
-if statedata.get('date'):
-opts['date'] = statedata['date']
-if statedata.get('user'):
-opts['user'] = statedata['user']
-if statedata.get('log'):
-opts['log'] = True
-if statedata.get('no_commit'):
-opts['no_commit'] = statedata.get('no_commit')
-nodes = statedata['nodes']
+nodes, opts = cmdutil.updateopts(repo, graftstate, opts)
 revs = [repo[node].rev() for node in nodes]
 else:
 cmdutil.wrongtooltocontinue(repo, _('graft'))
@@ -2619,69 +2607,9 @@
 
 if opts.get('no_commit'):
 statedata['no_commit'] = True
-for pos, ctx in enumerate(repo.set("%ld", revs)):
-desc = '%d:%s "%s"' % (ctx.rev(), ctx,
-   ctx.description().split('\n', 1)[0])
-names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
-if names:
-desc += ' (%s)' % ' '.join(names)
-ui.status(_('grafting %s\n') % desc)
-if opts.get('dry_run'):
-continue
-
-source = ctx.extra().get('source')
-extra = {}
-if source:
-extra['source'] = source
-extra['intermediate-source'] = ctx.hex()
-else:
-extra['source'] = ctx.hex()
-user = ctx.user()
-if opts.get('user'):
-user = opts['user']
-statedata['user'] = user
-date = ctx.date()
-if opts.get('date'):
-date = opts['date']
-statedata['date'] = date
-message = ctx.description()
-if opts.get('log'):
-message += '\n(grafted from %s)' % ctx.hex()
-statedata['log'] = True
-
-# we don't merge the first commit when continuing
-if not cont:
-# perform the graft merge with p1(rev) as 'ancestor'
-overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
-base = ctx.p1() if basectx is None else basectx
-with ui.configoverride(overrides, 'graft'):
-stats = mergemod.graft(repo, ctx, base, ['local', 'graft'])
-# report any conflicts
-if stats.unresolvedcount > 0:
-# write out state for --continue
-nodes = [repo[rev].hex() for rev in revs[pos:]]
-statedata['nodes'] = nodes
-stateversion = 1
-graftstate.save(stateversion, statedata)
-hint = _("use 'hg resolve' and 'hg graft --continue'")
-raise error.Abort(
-_("unresolved conflicts, can't continue"),
-hint=hint)
-else:
-cont = False
-
-# commit if --no-commit is false
-if not opts.get('no_commit'):
-node = repo.commit(text=message, user=user, date=date, extra=extra,
-   editor=editor)
-if node is None:
-ui.warn(
-_('note: graft of %d:%s created no changes to commit\n') %
-(ctx.rev(), ctx))
-# checking that newnodes exist because old state files won't have 
it
-elif statedata.get('newnodes') is not None:
-statedata['newnodes'].append(node)
-
+
+cmdutil.finishgraft(repo, ui, basectx, revs, statedata, cont, opts,
+graftstate)
 # remove state when we complete successfully
 if not opts.get('dry_run'):
 graftstate.delete()
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3425,3 +3425,87 @@
 with repo.wlock():
 graftstate = statemod.cmdstate(repo, 'graftstate')
 return abortgraft(ui, repo, graftstate)
+
+def finishgraft(repo, ui, basectx, revs, statedata, cont, opts,
+graftstate=None):
+"""logic to 

D6659: graft: split graft code into seperate functions

2019-10-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 added a comment.
taapas1128 marked an inline comment as done.


  @durin42 done.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6659/new/

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

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


D6957: rebase: unconditionally clear merge state when `--stop`ing a rebase

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


  How was it failing for you?
  
  I don't think I've used `hg rebase --stop`, but I had been wondering what it 
would do with the working directory. It's unclear to me what it should do, and 
now after looking at the code, it's also unclear what the author meant it to 
do. Maybe it would be best to just leave the working directory untouched? Oh, 
we should also compare to what `hg evolve --stop` does (I haven't checked).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6957/new/

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

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