D230: http: add a test of actually pushing with httppostargs

2017-08-07 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG970967e0a917: http: add a test of actually pushing with 
httppostargs (authored by durin42).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D230?vs=558=620

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

AFFECTED FILES
  tests/test-push-http.t

CHANGE DETAILS

diff --git a/tests/test-push-http.t b/tests/test-push-http.t
--- a/tests/test-push-http.t
+++ b/tests/test-push-http.t
@@ -172,4 +172,20 @@
   % serve errors
   [255]
 
+  $ cat > .hg/hgrc < [web]
+  > push_ssl = false
+  > allow_push = *
+  > [experimental]
+  > httppostargs=true
+  > EOF
+  $ req
+  pushing to http://localhost:$HGPORT/
+  searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+  % serve errors
+
   $ cd ..



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


D241: context: rename bumped into phasedivergent

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> context.py:220
> +self._repo.ui.deprecwarn(msg, '4.4')
> +return self.orphan()
> +

Shouldn't this be `self.phasedivergent()`?

REPOSITORY
  rHG Mercurial

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

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


D240: context: rename divergent into contentdivergent

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> context.py:227
> +self._repo.ui.deprecwarn(msg, '4.4')
> +return self.orphan()
> +

This should be `self.contentdivergent()` no?

REPOSITORY
  rHG Mercurial

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

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


D267: httppeer: remove unused handler attribute

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The consumer of this attribute was removed by 
https://phab.mercurial-scm.org/rHGb6bd4ee6ed85628b26d6cd7186b76624f40548bf in 
2008.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -90,7 +90,6 @@
 def __init__(self, ui, path):
 self.path = path
 self.caps = None
-self.handler = None
 self.urlopener = None
 self.requestbuilder = None
 u = util.url(path)



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


D266: localrepo: remove unused requirements attributes on localpeer (API)

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The previous changeset removed the last consumer of requirements. I'm
  not sure when supportedformats became unused. But I couldn't find
  any obvious instances where it is being used. It likely stems from
  peers being derived from repository instances several years ago and
  is a holdover from that day.

REPOSITORY
  rHG Mercurial

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

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
@@ -154,8 +154,6 @@
 self._repo = repo.filtered('served')
 self.ui = repo.ui
 self._caps = repo._restrictcapabilities(caps)
-self.requirements = repo.requirements
-self.supportedformats = repo.supportedformats
 
 def close(self):
 self._repo.close()



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


D268: httppeer: make several instance attributes internal (API)

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Peer instances are supposed to conform to a well-defined API so
  consumers can be agnostic about the underlying peer type.
  
  To reinforce this, this commit renames a handful of instance
  attributes on httpeer so they no longer have a "public" name.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -88,10 +88,10 @@
 
 class httppeer(wireproto.wirepeer):
 def __init__(self, ui, path):
-self.path = path
-self.caps = None
-self.urlopener = None
-self.requestbuilder = None
+self._path = path
+self._caps = None
+self._urlopener = None
+self._requestbuilder = None
 u = util.url(path)
 if u.query or u.fragment:
 raise error.Abort(_('unsupported URL component: "%s"') %
@@ -103,33 +103,33 @@
 self.ui = ui
 self.ui.debug('using %s\n' % self._url)
 
-self.urlopener = url.opener(ui, authinfo)
-self.requestbuilder = urlreq.request
+self._urlopener = url.opener(ui, authinfo)
+self._requestbuilder = urlreq.request
 
 def __del__(self):
-urlopener = getattr(self, 'urlopener', None)
+urlopener = getattr(self, '_urlopener', None)
 if urlopener:
 for h in urlopener.handlers:
 h.close()
 getattr(h, "close_all", lambda : None)()
 
 def url(self):
-return self.path
+return self._path
 
 # look up capabilities only when needed
 
 def _fetchcaps(self):
-self.caps = set(self._call('capabilities').split())
+self._caps = set(self._call('capabilities').split())
 
 def _capabilities(self):
-if self.caps is None:
+if self._caps is None:
 try:
 self._fetchcaps()
 except error.RepoError:
-self.caps = set()
+self._caps = set()
 self.ui.debug('capabilities: %s\n' %
-  (' '.join(self.caps or ['none'])))
-return self.caps
+  (' '.join(self._caps or ['none'])))
+return self._caps
 
 def _callstream(self, cmd, _compressible=False, **args):
 if cmd == 'pushkey':
@@ -144,7 +144,7 @@
 # Important: don't use self.capable() here or else you end up
 # with infinite recursion when trying to look up capabilities
 # for the first time.
-postargsok = self.caps is not None and 'httppostargs' in self.caps
+postargsok = self._caps is not None and 'httppostargs' in self._caps
 # TODO: support for httppostargs when data is a file-like
 # object rather than a basestring
 canmungedata = not data or isinstance(data, basestring)
@@ -189,7 +189,7 @@
 protoparams = []
 
 mediatypes = set()
-if self.caps is not None:
+if self._caps is not None:
 mt = self.capable('httpmediatype')
 if mt:
 protoparams.append('0.1')
@@ -217,13 +217,13 @@
 if varyheaders:
 headers['Vary'] = ','.join(varyheaders)
 
-req = self.requestbuilder(cu, data, headers)
+req = self._requestbuilder(cu, data, headers)
 
 if data is not None:
 self.ui.debug("sending %s bytes\n" % size)
 req.add_unredirected_header('Content-Length', '%d' % size)
 try:
-resp = self.urlopener.open(req)
+resp = self._urlopener.open(req)
 except urlerr.httperror as inst:
 if inst.code == 401:
 raise error.Abort(_('authorization failed'))



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


D265: exchange: access requirements on repo instead of peer

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As part of formalizing the peer interface, I audited for attribute
  accesses for non-internal names to find API violations. This
  uncovered the code changed in this commit.
  
  localpeer.requirements is just an alias to the repo's requirements
  attribute. So, change the code to get the data from the source
  instead of relying on a one-off attribute in the localpeer type.

REPOSITORY
  rHG Mercurial

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

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
@@ -1216,8 +1216,10 @@
 opargs = {}
 pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
streamclonerequested=streamclonerequested, **opargs)
-if pullop.remote.local():
-missing = set(pullop.remote.requirements) - pullop.repo.supported
+
+peerlocal = pullop.remote.local()
+if peerlocal:
+missing = set(peerlocal.requirements) - pullop.repo.supported
 if missing:
 msg = _("required features are not"
 " supported in the destination:"



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


D238: context: rename troubles into instabilities

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> context.py:246-248
> +"""return the list of instabilities affecting this changeset.
> +
> +Instabilities are returned as strings. possible values are:

This feels like it should be a set not a list.

Should this be changed as part of changing the API?

> exchange.py:694
>  elif ctx.troubled():
> -raise error.Abort(mst[ctx.troubles()[0]] % ctx)
> +raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
>  

Why does this only print 1 instability?

REPOSITORY
  rHG Mercurial

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

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


D239: context: rename unstable into orphan

2017-08-07 Thread indygreg (Gregory Szorc)
indygreg accepted this revision.
indygreg added inline comments.
This revision is now accepted and ready to land.

INLINE COMMENTS

> context.py:208
> +msg = ("'context.unstable' is deprecated, "
> +   "use 'context.oprhan'")
> +self._repo.ui.deprecwarn(msg, '4.4')

Typo. Can be fixed in flight if you don't submit a new series.

REPOSITORY
  rHG Mercurial

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

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


D264: exchange: drop support for lock-based unbundling (BC)

2017-08-07 Thread martinvonz (Martin von Zweigbergk)
martinvonz accepted this revision as: martinvonz.
martinvonz added a comment.


  Looks great to me. I also can't see this being a problem for anyone.

REPOSITORY
  rHG Mercurial

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

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


D152: repo: skip invalidation of changelog if it has 'delayed' changes (API)

2017-08-07 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 619.
martinvonz marked an inline comment as done.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D152?vs=321=619

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-context.py

CHANGE DETAILS

diff --git a/tests/test-context.py b/tests/test-context.py
--- a/tests/test-context.py
+++ b/tests/test-context.py
@@ -179,3 +179,14 @@
 print('data mismatch')
 except Exception as ex:
 print('cannot read data: %r' % ex)
+
+with repo.wlock(), repo.lock(), repo.transaction('test'):
+with open(b'4', 'wb') as f:
+f.write(b'4')
+repo.dirstate.normal('4')
+repo.commit('4')
+revsbefore = len(repo.changelog)
+repo.invalidate(clearfilecache=True)
+revsafter = len(repo.changelog)
+if revsbefore != revsafter:
+print('changeset lost by repo.invalidate()')
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1466,6 +1466,13 @@
 # dirstate is invalidated separately in invalidatedirstate()
 if k == 'dirstate':
 continue
+if (k == 'changelog' and
+self.currenttransaction() and
+self.changelog._delayed):
+# The changelog object may store unwritten revisions. We don't
+# want to lose them.
+# TODO: Solve the problem instead of working around it.
+continue
 
 if clearfilecache:
 del self._filecache[k]



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


Re: [PATCH] contrib: add check for use of admonitions and its validity

2017-08-07 Thread Augie Fackler
On Sat, Aug 05, 2017 at 10:36:46PM +0900, Yuya Nishihara wrote:
> On Sat, 05 Aug 2017 08:54:13 +0530, Rishabh Madan wrote:
> > # HG changeset patch
> > # User Rishabh Madan 
> > # Date 1501903168 -19800
> > #  Sat Aug 05 08:49:28 2017 +0530
> > # Node ID cc695f1458baf2c39ffdec4a1256a93fd659d62d
> > # Parent  609606d217659e0a6c1cf6f907b6512be5340e57
> > contrib: add check for use of admonitions and its validity
> >
> > While using releasenotes extension, we will be using admonitions in commit 
> > messages.
> > This check will look for an admonition within the message. If it exists, it 
> > will
> > verify if it is stated under default or custom admonition. The check fails 
> > if the
> > admonition is not present in any of them.
> >
> > diff -r 609606d21765 -r cc695f1458ba contrib/check-commit
> > --- a/contrib/check-commit  Thu Jul 20 01:30:41 2017 -0700
> > +++ b/contrib/check-commit  Sat Aug 05 08:49:28 2017 +0530
> > @@ -21,9 +21,16 @@
> >  import re
> >  import sys
> >
> > +from mercurial import (
> > +config,
> > +hg,
> > +ui as uimod,
> > +)
>
> check-commit seems to try not depending on mercurial modules. Maybe it's 
> easier
> to implement the check function as a command of the releasenotes extension?

Good idea! I like that.

>
> >  if __name__ == "__main__":
> >  exitcode = 0
> >  node = os.environ.get("HG_NODE")
> > -
> >  if node:
> >  commit = readcommit(node)
> > -exitcode = checkcommit(commit)
> > +exitcode = checkcommit(commit, node)
> >  elif sys.argv[1:]:
> >  for node in sys.argv[1:]:
> >  exitcode |= checkcommit(readcommit(node), node)
>
> test-check-commit.t feeds patches to stdin, in which case, no node value
> is available.
> ___
> 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


[Bug 5649] New: gpg should handle revoked keys more gracefully

2017-08-07 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5649

Bug ID: 5649
   Summary: gpg should handle revoked keys more gracefully
   Product: Mercurial
   Version: 4.1.3
  Hardware: PC
OS: Other
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: gpg
  Assignee: bugzi...@mercurial-scm.org
  Reporter: jef...@josefsipek.net
CC: mercurial-devel@mercurial-scm.org

gpg lets you have multiple subkeys.  This lets people use a subkey for signing
commits, and a different subkey for encrypting emails, etc.  Each subkey can be
revoked.  I'm not sure if subkeys are a necessary part for this, but I suspect
they are not.

The hg gpg extension doesn't differentiate between:

(1) unsigned commit
(2) signed commit with a revoked key

For example:

$ gpg2 --gen-key 
...
$ gpg2 --edit-key test
> addkey
...
pub  2048R/B53D3C4C  created: 2017-08-07  expires: never   usage: SC  
 trust: ultimate  validity: ultimate
sub  2048R/AC64D35C  created: 2017-08-07  expires: never   usage: E   
sub  2048R/DDD9A222  created: 2017-08-07  expires: never   usage: S   
> save
$ hg init
$ echo test > test
$ hg add test 
$ hg commit -m "abc"
$ hg sign -u ddd9a222
signing 0:f67953b995b0
$ hg sigcheck 0
f67953b995b0 is signed by:
 test test
$ hg sigs
test test  0:f67953b995b0f18308bc294cfdcd07b4852f7cdf
$ gpg2 --edit-key test
> key 2
> revkey
...
pub  2048R/B53D3C4C  created: 2017-08-07  expires: never   usage: SC  
 trust: ultimate  validity: ultimate
sub  2048R/AC64D35C  created: 2017-08-07  expires: never   usage: E   
The following key was revoked on 2017-08-07 by RSA key B53D3C4C test test
sub  2048R/DDD9A222  created: 2017-08-07  revoked: 2017-08-07  usage: S   
[ultimate] (1). test test
> save
$ hg sigcheck 0
no valid signature for f67953b995b0
$ hg sigs  
$

I am *not* a security expert, but from usability standpoint, I'd expect hg to
tell me that the signature is valid but that the (sub)key has been
revoked/expired.  Ideally, it could also print the reason the key was revoked.

Note that there are several reasons a subkey can be revoked.  gpg2 suggests:

  0 = No reason specified
  1 = Key has been compromised
  2 = Key is superseded
  3 = Key is no longer used

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


D260: chg: define _GNU_SOURCE to allow CentOS 5 compilation

2017-08-07 Thread Mathias De Maré
Mathiasdm 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/D260

AFFECTED FILES
  contrib/chg/Makefile

CHANGE DETAILS

diff --git a/contrib/chg/Makefile b/contrib/chg/Makefile
--- a/contrib/chg/Makefile
+++ b/contrib/chg/Makefile
@@ -5,7 +5,7 @@
 OBJS = $(SRCS:.c=.o)
 
 CFLAGS ?= -O2 -Wall -Wextra -pedantic -g
-CPPFLAGS ?= -D_FORTIFY_SOURCE=2
+CPPFLAGS ?= -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
 override CFLAGS += -std=gnu99
 ifdef HGPATH
 override CPPFLAGS += -DHGPATH=\"$(HGPATH)\"



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


D260: chg: define _GNU_SOURCE to allow CentOS 5 compilation

2017-08-07 Thread Mathias De Maré
Mathiasdm reclaimed this revision.
Mathiasdm added a comment.


  Alright, it appears this does not work like I expected...

REPOSITORY
  rHG Mercurial

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

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


D261: centos5: use vault urls

2017-08-07 Thread Mathias De Maré
Mathiasdm created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  CentOS 5 has reached end-of-life. A working build for it is still
  possible using 'vault.centos.org'.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/docker/centos5

CHANGE DETAILS

diff --git a/contrib/docker/centos5 b/contrib/docker/centos5
--- a/contrib/docker/centos5
+++ b/contrib/docker/centos5
@@ -1,4 +1,7 @@
 FROM centos:centos5
+RUN sed -i 's/^mirrorlist/#mirrorlist/' /etc/yum.repos.d/*.repo
+RUN sed -i 
's/^#\(baseurl=\)http:\/\/mirror.centos.org\/centos/\1http:\/\/vault.centos.org/'
 /etc/yum.repos.d/*.repo
+RUN sed -i 's/\$releasever/5.11/' /etc/yum.repos.d/*.repo
 RUN yum install -y gcc make rpm-build gettext tar
 RUN yum install -y python-devel python-docutils
 # For creating repo meta data



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


D260: chg: define _GNU_SOURCE to allow CentOS 5 compilation

2017-08-07 Thread Mathias De Maré
Mathiasdm abandoned this revision.
Mathiasdm added a comment.


  My mistake, I meant to send 2 changesets and forgot to modify the revset.

REPOSITORY
  rHG Mercurial

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

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


D240: context: rename divergent into contentdivergent

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rename divergent context method into contentdivergent and add a deprecation
  warning on divergent.
  
  Only update all callers to keep the patch straightforward.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -221,15 +221,21 @@
 return self.rev() in obsmod.getrevs(self._repo, 'bumped')
 
 def divergent(self):
+msg = ("'context.divergent' is deprecated, "
+   "use 'context.contentdivergent'")
+self._repo.ui.deprecwarn(msg, '4.4')
+return self.orphan()
+
+def contentdivergent(self):
 """Is a successors of a changeset with multiple possible successors set
 
 Only non-public and non-obsolete changesets may be divergent.
 """
 return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
 def troubled(self):
 """True if the changeset is either unstable, bumped or divergent"""
-return self.orphan() or self.bumped() or self.divergent()
+return self.orphan() or self.bumped() or self.contentdivergent()
 
 def troubles(self):
 """Keep the old version around in order to avoid breaking extensions
@@ -244,7 +250,7 @@
 troubles.append('orphan')
 if self.bumped():
 troubles.append('bumped')
-if self.divergent():
+if self.contentdivergent():
 troubles.append('divergent')
 return troubles
 
@@ -261,7 +267,7 @@
 instabilities.append('orphan')
 if self.bumped():
 instabilities.append('phase-divergent')
-if self.divergent():
+if self.contentdivergent():
 instabilities.append('content-divergent')
 return instabilities
 



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


D239: context: rename unstable into orphan

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rename unstable context method into orphan and add a deprecation
  warning on unstable.
  
  Only update all callers to keep the patch straightforward.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -204,6 +204,12 @@
 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
 
 def unstable(self):
+msg = ("'context.unstable' is deprecated, "
+   "use 'context.oprhan'")
+self._repo.ui.deprecwarn(msg, '4.4')
+return self.orphan()
+
+def orphan(self):
 """True if the changeset is not obsolete but it's ancestor are"""
 return self.rev() in obsmod.getrevs(self._repo, 'unstable')
 
@@ -223,7 +229,7 @@
 
 def troubled(self):
 """True if the changeset is either unstable, bumped or divergent"""
-return self.unstable() or self.bumped() or self.divergent()
+return self.orphan() or self.bumped() or self.divergent()
 
 def troubles(self):
 """Keep the old version around in order to avoid breaking extensions
@@ -234,7 +240,7 @@
 self._repo.ui.deprecwarn(msg, '4.4')
 
 troubles = []
-if self.unstable():
+if self.orphan():
 troubles.append('orphan')
 if self.bumped():
 troubles.append('bumped')
@@ -251,7 +257,7 @@
 - content-divergent.
 """
 instabilities = []
-if self.unstable():
+if self.orphan():
 instabilities.append('orphan')
 if self.bumped():
 instabilities.append('phase-divergent')



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


D241: context: rename bumped into phasedivergent

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rename bumped context method into phasedivergent and add a deprecation warning
  on bumped.
  
  Only update all callers to keep the patch straightforward.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -214,6 +214,12 @@
 return self.rev() in obsmod.getrevs(self._repo, 'unstable')
 
 def bumped(self):
+msg = ("'context.bumped' is deprecated, "
+   "use 'context.phasedivergent'")
+self._repo.ui.deprecwarn(msg, '4.4')
+return self.orphan()
+
+def phasedivergent(self):
 """True if the changeset try to be a successor of a public changeset
 
 Only non-public and non-obsolete changesets may be bumped.
@@ -235,7 +241,7 @@
 
 def troubled(self):
 """True if the changeset is either unstable, bumped or divergent"""
-return self.orphan() or self.bumped() or self.contentdivergent()
+return self.orphan() or self.phasedivergent() or 
self.contentdivergent()
 
 def troubles(self):
 """Keep the old version around in order to avoid breaking extensions
@@ -248,7 +254,7 @@
 troubles = []
 if self.orphan():
 troubles.append('orphan')
-if self.bumped():
+if self.phasedivergent():
 troubles.append('bumped')
 if self.contentdivergent():
 troubles.append('divergent')
@@ -265,7 +271,7 @@
 instabilities = []
 if self.orphan():
 instabilities.append('orphan')
-if self.bumped():
+if self.phasedivergent():
 instabilities.append('phase-divergent')
 if self.contentdivergent():
 instabilities.append('content-divergent')



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


D216: evolution: rename bumped to phase-divergent

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 581.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D216?vs=561=581

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -207,7 +207,7 @@
 
   $ hg --hidden phase --public 2
   $ hg log -G
-  @  5:5601fb93a350 (draft bumped) [tip ] add new_3_c
+  @  5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
   |
   | o  2:245bde4270cd (public) [ ] add original_c
   |/
@@ -224,7 +224,7 @@
 the public changeset
 
   $ hg log --hidden -r 'bumped()'
-  5:5601fb93a350 (draft bumped) [tip ] add new_3_c
+  5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
 
 And that we can't push bumped changeset
 
@@ -239,20 +239,20 @@
   $ hg push ../tmpa
   pushing to ../tmpa
   searching for changes
-  abort: push includes bumped changeset: 5601fb93a350!
+  abort: push includes phase-divergent changeset: 5601fb93a350!
   [255]
 
 Fixing "bumped" situation
 We need to create a clone of 5 and add a special marker with a flag
 
   $ hg summary
-  parent: 5:5601fb93a350 tip (bumped)
+  parent: 5:5601fb93a350 tip (phase-divergent)
add new_3_c
   branch: default
   commit: (clean)
   update: 1 new changesets, 2 branch heads (merge)
   phases: 1 draft
-  bumped: 1 changesets
+  phase-divergent: 1 changesets
   $ hg up '5^'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg revert -ar 5
@@ -914,7 +914,7 @@
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  instability: orphan, bumped
+  instability: orphan, phase-divergent
   summary: add babar
   
 
@@ -926,15 +926,15 @@
 test the "troubles" templatekw
 
   $ hg log -r 'bumped() and unstable()'
-  7:50c51b361e60 (draft orphan bumped) [ ] add babar
+  7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
 
 test the default cmdline template
 
   $ hg log -T default -r 'bumped()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  trouble: orphan, bumped
+  trouble: orphan, phase-divergent
   summary: add babar
   
   $ hg log -T default -r 'obsolete()'
@@ -950,14 +950,14 @@
   $ hg up -r 'bumped() and unstable()'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg summary
-  parent: 7:50c51b361e60  (orphan, bumped)
+  parent: 7:50c51b361e60  (orphan, phase-divergent)
add babar
   branch: default
   commit: (clean)
   update: 2 new changesets (update)
   phases: 4 draft
   orphan: 2 changesets
-  bumped: 1 changesets
+  phase-divergent: 1 changesets
   $ hg up -r 'obsolete()'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg summary
@@ -968,7 +968,7 @@
   update: 3 new changesets (update)
   phases: 4 draft
   orphan: 2 changesets
-  bumped: 1 changesets
+  phase-divergent: 1 changesets
 
 Test incoming/outcoming with changesets obsoleted remotely, known locally
 ===
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -677,9 +677,10 @@
 if unfi.obsstore:
 # this message are here for 80 char limit reason
 mso = _("push includes obsolete changeset: %s!")
+mspd = _("push includes phase-divergent changeset: %s!")
 mscd = _("push includes content-divergent changeset: %s!")
 mst = {"orphan": _("push includes orphan changeset: %s!"),
-   "bumped": _("push includes bumped changeset: %s!"),
+   "phase-divergent": mspd,
"content-divergent": mscd}
 # If we are to push if there is at least one
 # obsolete or unstable changeset in missing, at
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -230,14 +230,14 @@
 
 Troubles are returned as strings. possible values are:
 - orphan,
-- bumped,
+- phase-divergent,
 - content-divergent.
 """
 troubles = []
 if self.unstable():
 troubles.append('orphan')
 if self.bumped():
-troubles.append('bumped')
+troubles.append('phase-divergent')
 if self.divergent():
 troubles.append('content-divergent')
 return troubles
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4943,7 +4943,7 @@
 troublemsg = {
"unstable": _("orphan: %d changesets"),
"divergent": _("content-divergent: %d changesets"),
-   "bumped": _("bumped: 

D215: evolution: rename divergent to content-divergent

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 580.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D215?vs=560=580

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py
  tests/test-obsmarker-template.t
  tests/test-obsolete-divergent.t
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -833,7 +833,7 @@
   commit: (clean)
   update: 1 new changesets, 2 branch heads (merge)
   phases: 8 draft
-  divergent: 2 changesets
+  content-divergent: 2 changesets
 
 rebase --continue + skipped rev because their successors are in destination
 we make a change in trunk and work on conflicting changes to make rebase abort.
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -107,7 +107,7 @@
   $ hg push ../other
   pushing to ../other
   searching for changes
-  abort: push includes divergent changeset: 392fd25390da!
+  abort: push includes content-divergent changeset: 392fd25390da!
   [255]
 
   $ cd ..
@@ -671,9 +671,9 @@
   $ rm .hg/localtags
   $ hg cleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
   $ hg log -G -T '{rev}:{node|short} {desc} {troubles}' -r 'sort(all(), topo)'
-  @  5:1a2a9b5b0030 B2 divergent
+  @  5:1a2a9b5b0030 B2 content-divergent
   |
-  | o  4:70d5a63ca112 B4 divergent
+  | o  4:70d5a63ca112 B4 content-divergent
   | |
   | o  1:48b9aae0607f Z
   |
diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -442,14 +442,14 @@
   |  parent:  0:ea207398892e
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  instability: divergent
+  |  instability: content-divergent
   |  summary: A2
   |
   | o  changeset:   2:fdf9bde5129a
   |/   parent:  0:ea207398892e
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |instability: divergent
+  |instability: content-divergent
   |summary: A1
   |
   | x  changeset:   1:471f378eab4c
@@ -469,7 +469,7 @@
   |  parent:  0:ea207398892e
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  instability: divergent
+  |  instability: content-divergent
   |  summary: A3
   |
   | x  changeset:   3:65b757b745b9
@@ -482,7 +482,7 @@
   |/   parent:  0:ea207398892e
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |instability: divergent
+  |instability: content-divergent
   |summary: A1
   |
   | x  changeset:   1:471f378eab4c
@@ -1086,20 +1086,20 @@
   |  parent:  5:dd800401bd8c
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  instability: divergent
+  |  instability: content-divergent
   |  summary: Add B only
   |
   | o  changeset:   8:b18bc8331526
   |/   parent:  5:dd800401bd8c
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |instability: divergent
+  |instability: content-divergent
   |summary: Add only B
   |
   | o  changeset:   7:ba2ed02b0c9a
   | |  user:test
   | |  date:Thu Jan 01 00:00:00 1970 +
-  | |  instability: orphan, divergent
+  | |  instability: orphan, content-divergent
   | |  summary: Add A,B,C
   | |
   | x  changeset:   6:4a004186e638
@@ -,7 +,7 @@
   |  parent:  3:f897c6137566
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  instability: divergent
+  |  instability: content-divergent
   |  summary: Add A,B,C
   |
   o  changeset:   3:f897c6137566
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -677,9 +677,10 @@
 if unfi.obsstore:
 # this message are here for 80 char limit reason
 mso = _("push includes obsolete changeset: %s!")
+mscd = _("push includes content-divergent changeset: %s!")
 mst = {"orphan": _("push includes orphan changeset: %s!"),
"bumped": _("push includes bumped changeset: %s!"),
-   "divergent": _("push includes divergent changeset: %s!")}
+   "content-divergent": mscd}
 # If we are to push if there is at least one
 # obsolete or unstable changeset in missing, at
 # least one of the missinghead will be obsolete or
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -231,15 +231,15 @@
 Troubles are returned as strings. possible values are:
 - orphan,
 - bumped,
-- divergent.
+- content-divergent.
 """
 

D214: evolution: rename unstable to orphan

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 579.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D214?vs=505=579

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py
  tests/test-commit-amend.t
  tests/test-obsmarker-template.t
  tests/test-obsolete.t
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -793,13 +793,13 @@
   o  0:4a2df7238c3b A
   
   $ hg summary
-  parent: 15:73568ab6879d tip (unstable)
+  parent: 15:73568ab6879d tip (orphan)
bar foo
   branch: default
   commit: (clean)
   update: 2 new changesets, 3 branch heads (merge)
   phases: 8 draft
-  unstable: 1 changesets
+  orphan: 1 changesets
   $ hg rebase -s 10 -d 12
   abort: this rebase will cause divergences from: 121d9e3bc4c6
   (to force the rebase please set experimental.allowdivergence=True)
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -520,15 +520,15 @@
   $ hg log -r 'obsolete()'
   4:94b33453f93b (draft *obsolete*) [ ] add original_d
   $ hg summary
-  parent: 5:cda648ca50f5 tip (unstable)
+  parent: 5:cda648ca50f5 tip (orphan)
add original_e
   branch: default
   commit: (clean)
   update: 1 new changesets, 2 branch heads (merge)
   phases: 3 draft
-  unstable: 1 changesets
+  orphan: 1 changesets
   $ hg log -G -r '::unstable()'
-  @  5:cda648ca50f5 (draft unstable) [tip ] add original_e
+  @  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   |
   x  4:94b33453f93b (draft *obsolete*) [ ] add original_d
   |
@@ -552,7 +552,7 @@
   $ hg push ../tmpc/
   pushing to ../tmpc/
   searching for changes
-  abort: push includes unstable changeset: cda648ca50f5!
+  abort: push includes orphan changeset: cda648ca50f5!
   [255]
 
 Test that extinct changeset are properly detected
@@ -570,7 +570,7 @@
   2:245bde4270cd (public) [ ] add original_c
   3:6f9641995072 (draft) [ ] add n3w_3_c
   4:94b33453f93b (draft *obsolete*) [ ] add original_d
-  5:cda648ca50f5 (draft unstable) [tip ] add original_e
+  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   $ hg push ../tmpf -f # -f because be push unstable too
   pushing to ../tmpf
   searching for changes
@@ -591,7 +591,7 @@
 Do not warn about new head when the new head is a successors of a remote one
 
   $ hg log -G
-  @  5:cda648ca50f5 (draft unstable) [tip ] add original_e
+  @  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   |
   x  4:94b33453f93b (draft *obsolete*) [ ] add original_d
   |
@@ -914,7 +914,7 @@
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  trouble: unstable, bumped
+  instability: orphan, bumped
   summary: add babar
   
 
@@ -926,15 +926,15 @@
 test the "troubles" templatekw
 
   $ hg log -r 'bumped() and unstable()'
-  7:50c51b361e60 (draft unstable bumped) [ ] add babar
+  7:50c51b361e60 (draft orphan bumped) [ ] add babar
 
 test the default cmdline template
 
   $ hg log -T default -r 'bumped()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  trouble: unstable, bumped
+  trouble: orphan, bumped
   summary: add babar
   
   $ hg log -T default -r 'obsolete()'
@@ -950,13 +950,13 @@
   $ hg up -r 'bumped() and unstable()'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg summary
-  parent: 7:50c51b361e60  (unstable, bumped)
+  parent: 7:50c51b361e60  (orphan, bumped)
add babar
   branch: default
   commit: (clean)
   update: 2 new changesets (update)
   phases: 4 draft
-  unstable: 2 changesets
+  orphan: 2 changesets
   bumped: 1 changesets
   $ hg up -r 'obsolete()'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -967,7 +967,7 @@
   commit: (clean)
   update: 3 new changesets (update)
   phases: 4 draft
-  unstable: 2 changesets
+  orphan: 2 changesets
   bumped: 1 changesets
 
 Test incoming/outcoming with changesets obsoleted remotely, known locally
diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -1099,7 +1099,7 @@
   | o  changeset:   7:ba2ed02b0c9a
   | |  user:test
   | |  date:Thu Jan 01 00:00:00 1970 +
-  | |  instability: unstable, divergent
+  | |  instability: orphan, divergent
   | |  summary: Add A,B,C
   | |
   | x  changeset:   6:4a004186e638
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -610,7 +610,7 @@
   parent:  11:3334b7925910
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  instability: unstable
+  instability: orphan
   summary: babar
   
 
diff --git 

D247: obsutil: rename allprecursors into allpredecessors

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Use util.nouideprecwarn because obsstore doesn't have easy access to an ui
  object.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/phabricator.py
  mercurial/obsolete.py
  mercurial/obsutil.py

CHANGE DETAILS

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -102,7 +102,16 @@
 else:
 stack.append(precnodeid)
 
-def allprecursors(obsstore, nodes, ignoreflags=0):
+def allprecursors(*args, **kwargs):
+""" (DEPRECATED)
+"""
+msg = ("'obsutil.allprecursors' is deprecated, "
+   "use 'obsutil.allpredecessors'")
+util.nouideprecwarn(msg, '4.4')
+
+return allpredecessors(*args, **kwargs)
+
+def allpredecessors(obsstore, nodes, ignoreflags=0):
 """Yield node for every precursors of .
 
 Some precursors may be unknown locally.
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -949,7 +949,7 @@
 # We only evaluate mutable, non-obsolete revision
 node = ctx.node()
 # (future) A cache of predecessors may worth if split is very common
-for pnode in obsutil.allprecursors(repo.obsstore, [node],
+for pnode in obsutil.allpredecessors(repo.obsstore, [node],
ignoreflags=bumpedfix):
 prev = torev(pnode) # unfiltered! but so is phasecache
 if (prev is not None) and (phase(repo, prev) <= public):
diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -41,7 +41,7 @@
 encoding,
 error,
 mdiff,
-obsolete,
+obsutil,
 patch,
 registrar,
 scmutil,
@@ -167,7 +167,7 @@
 for node in nodelist:
 ctx = unfi[node]
 # For tags like "D123", put them into "toconfirm" to verify later
-precnodes = list(obsolete.allprecursors(unfi.obsstore, [node]))
+precnodes = list(obsutil.allpredecessors(unfi.obsstore, [node]))
 for n in precnodes:
 if n in nodemap:
 for tag in unfi.nodetags(n):



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


D244: obsolete: rename _addprecursors into _addpredecessors

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Use util.nouideprecwarn because _addpredecessors doesn't have easy access to
  an ui object.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/obsolete.py

CHANGE DETAILS

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -470,11 +470,18 @@
 for mark in markers:
 successors.setdefault(mark[0], set()).add(mark)
 
+def _addprecursors(*args, **kwargs):
+msg = ("'obsolete._addprecursors' is deprecated, "
+   "use 'obsolete._addpredecessors'")
+util.nouideprecwarn(msg, '4.4')
+
+return _addpredecessors(*args, **kwargs)
+
 @util.nogc
-def _addprecursors(precursors, markers):
+def _addpredecessors(predecessors, markers):
 for mark in markers:
 for suc in mark[1]:
-precursors.setdefault(suc, set()).add(mark)
+predecessors.setdefault(suc, set()).add(mark)
 
 @util.nogc
 def _addchildren(children, markers):
@@ -660,9 +667,9 @@
 
 @propertycache
 def precursors(self):
-precursors = {}
-_addprecursors(precursors, self._all)
-return precursors
+predecessors = {}
+_addpredecessors(predecessors, self._all)
+return predecessors
 
 @propertycache
 def children(self):
@@ -680,7 +687,7 @@
 if self._cached('successors'):
 _addsuccessors(self.successors, markers)
 if self._cached('precursors'):
-_addprecursors(self.precursors, markers)
+_addpredecessors(self.precursors, markers)
 if self._cached('children'):
 _addchildren(self.children, markers)
 _checkinvalidmarkers(markers)



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


D238: context: rename troubles into instabilities

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rename troubles context method into instabilities.
  
  Copy the old troubles method and add a deprecation warning. This way
  extensions calling troubles will see the deprecation warning but will not
  break due to new return values.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py
  mercurial/templatekw.py

CHANGE DETAILS

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -783,7 +783,7 @@
 (EXPERIMENTAL)
 """
 args = pycompat.byteskwargs(args)
-return showlist('trouble', args['ctx'].troubles(), args)
+return showlist('trouble', args['ctx'].instabilities(), args)
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = keywords.values()
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -691,7 +691,7 @@
 if ctx.obsolete():
 raise error.Abort(mso % ctx)
 elif ctx.troubled():
-raise error.Abort(mst[ctx.troubles()[0]] % ctx)
+raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
 
 discovery.checkheads(pushop)
 return True
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -226,21 +226,38 @@
 return self.unstable() or self.bumped() or self.divergent()
 
 def troubles(self):
-"""return the list of troubles affecting this changesets.
+"""Keep the old version around in order to avoid breaking extensions
+about different return values.
+"""
+msg = ("'context.troubles' is deprecated, "
+   "use 'context.instabilities'")
+self._repo.ui.deprecwarn(msg, '4.4')
 
-Troubles are returned as strings. possible values are:
+troubles = []
+if self.unstable():
+troubles.append('orphan')
+if self.bumped():
+troubles.append('bumped')
+if self.divergent():
+troubles.append('divergent')
+return troubles
+
+def instabilities(self):
+"""return the list of instabilities affecting this changeset.
+
+Instabilities are returned as strings. possible values are:
 - orphan,
 - phase-divergent,
 - content-divergent.
 """
-troubles = []
+instabilities = []
 if self.unstable():
-troubles.append('orphan')
+instabilities.append('orphan')
 if self.bumped():
-troubles.append('phase-divergent')
+instabilities.append('phase-divergent')
 if self.divergent():
-troubles.append('content-divergent')
-return troubles
+instabilities.append('content-divergent')
+return instabilities
 
 def parents(self):
 """return contexts for each parent changeset"""
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4850,9 +4850,10 @@
 if p.obsolete():
 ui.write(_(' (obsolete)'))
 if p.troubled():
+instabilities = (ui.label(instability, 'trouble.%s' % instability)
+ for instability in p.instabilities())
 ui.write(' ('
- + ', '.join(ui.label(trouble, 'trouble.%s' % trouble)
- for trouble in p.troubles())
+ + ', '.join(instabilities)
  + ')')
 ui.write('\n')
 if p.description():
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1466,8 +1466,8 @@
 labels.append('changeset.obsolete')
 if ctx.troubled():
 labels.append('changeset.troubled')
-for trouble in ctx.troubles():
-labels.append('trouble.%s' % trouble)
+for instability in ctx.instabilities():
+labels.append('trouble.%s' % instability)
 return ' '.join(labels)
 
 class changeset_printer(object):
@@ -1579,7 +1579,8 @@
 
 if ctx.troubled():
 # i18n: column positioning for "hg log"
-self.ui.write(_("instability: %s\n") % ', '.join(ctx.troubles()),
+instabilities = ctx.instabilities()
+self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
   label='log.trouble')
 
 self._exthook(ctx)



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
___

D242: context: rename troubled into isunstable

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As we changed the meaning of unstable between the old vocabulary and the new
  one, we can't reuse the unstable method name at the risk of breaking
  extensions calling unstable and getting a wrong result.
  
  Instead rename troubled into isunstable so extensions will continue to work.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -690,7 +690,7 @@
 ctx = unfi[node]
 if ctx.obsolete():
 raise error.Abort(mso % ctx)
-elif ctx.troubled():
+elif ctx.isunstable():
 raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
 
 discovery.checkheads(pushop)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -240,6 +240,12 @@
 return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
 def troubled(self):
+msg = ("'context.troubled' is deprecated, "
+   "use 'context.unstable'")
+self._repo.ui.deprecwarn(msg, '4.4')
+return self.unstable()
+
+def isunstable(self):
 """True if the changeset is either unstable, bumped or divergent"""
 return self.orphan() or self.phasedivergent() or 
self.contentdivergent()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4849,7 +4849,7 @@
 ui.write(_(' (no revision checked out)'))
 if p.obsolete():
 ui.write(_(' (obsolete)'))
-if p.troubled():
+if p.isunstable():
 instabilities = (ui.label(instability, 'trouble.%s' % instability)
  for instability in p.instabilities())
 ui.write(' ('
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1464,7 +1464,7 @@
 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
 if ctx.obsolete():
 labels.append('changeset.obsolete')
-if ctx.troubled():
+if ctx.isunstable():
 labels.append('changeset.troubled')
 for instability in ctx.instabilities():
 labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
 self.ui.write(_("date:%s\n") % date,
   label='log.date')
 
-if ctx.troubled():
+if ctx.isunstable():
 # i18n: column positioning for "hg log"
 instabilities = ctx.instabilities()
 self.ui.write(_("instability: %s\n") % ', '.join(instabilities),



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


D246: obsolete: rename precursor into predecessor in obsolete docstrings

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/obsolete.py

CHANGE DETAILS

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -20,12 +20,12 @@
 besides old and news changeset identifiers, such as creation date or
 author name.
 
-The old obsoleted changeset is called a "precursor" and possible
+The old obsoleted changeset is called a "predecessor" and possible
 replacements are called "successors". Markers that used changeset X as
-a precursor are called "successor markers of X" because they hold
+a predecessor are called "successor markers of X" because they hold
 information about the successors of X. Markers that use changeset Y as
-a successors are call "precursor markers of Y" because they hold
-information about the precursors of Y.
+a successors are call "predecessor markers of Y" because they hold
+information about the predecessors of Y.
 
 Examples:
 
@@ -294,11 +294,11 @@
 #
 # - uint8: number of metadata entries M
 #
-# - 20 or 32 bytes: precursor changeset identifier.
+# - 20 or 32 bytes: predecessor changeset identifier.
 #
 # - N*(20 or 32) bytes: successors changesets identifiers.
 #
-# - P*(20 or 32) bytes: parents of the precursors changesets.
+# - P*(20 or 32) bytes: parents of the predecessors changesets.
 #
 # - M*(uint8, uint8): size of all metadata entries (key and value)
 #
@@ -506,18 +506,18 @@
 """Store obsolete markers
 
 Markers can be accessed with two mappings:
-- precursors[x] -> set(markers on precursors edges of x)
+- predecessors[x] -> set(markers on predecessors edges of x)
 - successors[x] -> set(markers on successors edges of x)
-- children[x]   -> set(markers on precursors edges of children(x)
+- children[x]   -> set(markers on predecessors edges of children(x)
 """
 
 fields = ('prec', 'succs', 'flag', 'meta', 'date', 'parents')
-# prec:nodeid, precursor changesets
+# prec:nodeid, predecessors changesets
 # succs:   tuple of nodeid, successor changesets (0-N length)
 # flag:integer, flag field carrying modifier for the markers (see doc)
 # meta:binary blob, encoded metadata dictionary
 # date:(float, int) tuple, date of marker creation
-# parents: (tuple of nodeid) or None, parents of precursors
+# parents: (tuple of nodeid) or None, parents of predecessors
 #  None is used when no data has been recorded
 
 def __init__(self, svfs, defaultformat=_fm1version, readonly=False):
@@ -707,7 +707,8 @@
 
 - marker that use this changeset as successor
 - prune marker of direct children on this changeset
-- recursive application of the two rules on precursors of these markers
+- recursive application of the two rules on predecessors of these
+  markers
 
 It is a set so you cannot rely on order."""
 
@@ -947,12 +948,12 @@
 rev = ctx.rev()
 # We only evaluate mutable, non-obsolete revision
 node = ctx.node()
-# (future) A cache of precursors may worth if split is very common
+# (future) A cache of predecessors may worth if split is very common
 for pnode in obsutil.allprecursors(repo.obsstore, [node],
ignoreflags=bumpedfix):
 prev = torev(pnode) # unfiltered! but so is phasecache
 if (prev is not None) and (phase(repo, prev) <= public):
-# we have a public precursor
+# we have a public predecessor
 bumped.add(rev)
 break # Next draft!
 return bumped



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


D245: obsstore: rename precursors into predecessors

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Use util.nouideprecwarn because obsstore doesn't have easy access to an ui
  object.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/obsolete.py
  mercurial/obsutil.py

CHANGE DETAILS

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -81,7 +81,7 @@
 considered missing.
 """
 
-precursors = repo.obsstore.precursors
+precursors = repo.obsstore.predecessors
 stack = [nodeid]
 seen = set(stack)
 
@@ -115,7 +115,7 @@
 while remaining:
 current = remaining.pop()
 yield current
-for mark in obsstore.precursors.get(current, ()):
+for mark in obsstore.predecessors.get(current, ()):
 # ignore marker flagged with specified flag
 if mark[2] & ignoreflags:
 continue
@@ -207,7 +207,7 @@
 
 # shortcut to various useful item
 nm = unfi.changelog.nodemap
-precursorsmarkers = unfi.obsstore.precursors
+precursorsmarkers = unfi.obsstore.predecessors
 successormarkers = unfi.obsstore.successors
 childrenmarkers = unfi.obsstore.children
 
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -665,8 +665,16 @@
 _addsuccessors(successors, self._all)
 return successors
 
+@property
+def precursors(self):
+msg = ("'obsstore.precursors' is deprecated, "
+   "use 'obsstore.predecessors'")
+util.nouideprecwarn(msg, '4.4')
+
+return self.predecessors
+
 @propertycache
-def precursors(self):
+def predecessors(self):
 predecessors = {}
 _addpredecessors(predecessors, self._all)
 return predecessors
@@ -686,8 +694,8 @@
 self._all.extend(markers)
 if self._cached('successors'):
 _addsuccessors(self.successors, markers)
-if self._cached('precursors'):
-_addpredecessors(self.precursors, markers)
+if self._cached('predecessors'):
+_addpredecessors(self.predecessors, markers)
 if self._cached('children'):
 _addchildren(self.children, markers)
 _checkinvalidmarkers(markers)
@@ -706,7 +714,7 @@
 pendingnodes = set(nodes)
 seenmarkers = set()
 seennodes = set(pendingnodes)
-precursorsmarkers = self.precursors
+precursorsmarkers = self.predecessors
 succsmarkers = self.successors
 children = self.children
 while pendingnodes:
@@ -957,7 +965,7 @@
 obsstore = repo.obsstore
 newermap = {}
 for ctx in repo.set('(not public()) - obsolete()'):
-mark = obsstore.precursors.get(ctx.node(), ())
+mark = obsstore.predecessors.get(ctx.node(), ())
 toprocess = set(mark)
 seen = set()
 while toprocess:
@@ -971,7 +979,7 @@
 if len(newer) > 1:
 divergent.add(ctx.rev())
 break
-toprocess.update(obsstore.precursors.get(prec, ()))
+toprocess.update(obsstore.predecessors.get(prec, ()))
 return divergent
 
 



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


D243: obsmarker: rename precnode into prednode

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rename prednode (predecessors node) into precnode (precursors node) in markers
  class. Use util.nouideprecwarn because markers doesn't have easy access to an
  ui object.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/obsutil.py

CHANGE DETAILS

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -9,6 +9,7 @@
 
 from . import (
 phases,
+util
 )
 
 class marker(object):
@@ -29,15 +30,21 @@
 return self._data == other._data
 
 def precnode(self):
-"""Precursor changeset node identifier"""
+msg = ("'marker.precnode' is deprecated, "
+   "use 'marker.precnode'")
+util.nouideprecwarn(msg, '4.4')
+return self.prednode()
+
+def prednode(self):
+"""Predecessor changeset node identifier"""
 return self._data[0]
 
 def succnodes(self):
 """List of successor changesets node identifiers"""
 return self._data[1]
 
 def parentnodes(self):
-"""Parents of the precursors (None if not recorded)"""
+"""Parents of the predecessors (None if not recorded)"""
 return self._data[5]
 
 def metadata(self):
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1913,7 +1913,7 @@
 To be used by debug function."""
 if index is not None:
 fm.write('index', '%i ', index)
-fm.write('precnode', '%s ', hex(marker.precnode()))
+fm.write('precnode', '%s ', hex(marker.prednode()))
 succs = marker.succnodes()
 fm.condwrite(succs, 'succnodes', '%s ',
  fm.formatlist(map(hex, succs), name='node'))



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


D259: label: rename log.trouble into log.instability

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan added a reviewer: quark.
lothiraldan added a subscriber: quark.
lothiraldan added a comment.


  Here are hopefully the last patches of this series.
  
  @quark I tried running the hg-experimental 
(https://bitbucket.org/facebook/hg-experimental) tests against this series.
  
  I think I don't have the right environment setup, I have bunch of errors that 
seems related to my shell, not having a memcache available and not having the 
remotenames extension. Apart from these errors I didn't saw test output changes 
that seems related to this series.
  
  test-lfs.t output changed with this series but also on mercurial stable but 
it could be my test environment again.

REPOSITORY
  rHG Mercurial

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

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


[PATCH 4 of 8] template: add minimal obsfate template function

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1501850856 -7200
#  Fri Aug 04 14:47:36 2017 +0200
# Node ID a96edc5bcdc8790719e003eefff91a4f656cc559
# Parent  e3f0339b83553039dcd87b62dc1dfbdf98548792
# EXP-Topic obsfatetemplate
template: add minimal obsfate template function

The goal of this series is to have templates capable of displaying the
evolution of each changeset in a clean and human-readable way.

Add the succsandmarkers template return successors and markers so it can be
used isolated like:

> {succsandmarkers % "{get(succsandmarkers, "markers")|json};"}

Also add a template function obsfate that takes succsandmarkers as input and
compute various fields from the list of markers and successors. Additional
fields will be added in following patches.

diff -r e3f0339b8355 -r a96edc5bcdc8 mercurial/obsutil.py
--- a/mercurial/obsutil.py  Mon Jul 03 03:27:58 2017 +0200
+++ b/mercurial/obsutil.py  Fri Aug 04 14:47:36 2017 +0200
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 
 from . import (
+node as nodemod,
 phases,
 )
 
@@ -551,3 +552,45 @@
 final.reverse() # put small successors set first
 cache[current] = final
 return cache[initialnode]
+
+def computeobsfate(successorset, rawmarkers):
+""" For a successor set, get all related markers and convert every nodeid
+into its hexadecimal form.
+"""
+hex = nodemod.hex
+
+successorset = [hex(n) for n in successorset]
+
+# hex the binary nodes in the markers
+markers = []
+for m in rawmarkers:
+hexprec = hex(m[0])
+hexsucs = tuple(hex(n) for n in m[1])
+hexparents = None
+if m[5] is not None:
+hexparents = tuple(hex(n) for n in m[5])
+newmarker = (hexprec, hexsucs) + m[2:5] + (hexparents,) + m[6:]
+markers.append(newmarker)
+
+# Format basic data
+data = {
+"successors": sorted(successorset),
+"markers": sorted(markers)
+}
+
+return data
+
+def successorsandmarkers(repo, ctx):
+"""compute the raw data needed for computing obsfate
+Returns a list of dict, one dict per successors set
+"""
+if not ctx.obsolete():
+return None
+
+ssets = successorssets(repo, ctx.node(), closest=True)
+
+values = []
+for sset in ssets:
+values.append({'successors': sset, 'markers': sset.markers})
+
+return values
diff -r e3f0339b8355 -r a96edc5bcdc8 mercurial/templatekw.py
--- a/mercurial/templatekw.py   Mon Jul 03 03:27:58 2017 +0200
+++ b/mercurial/templatekw.py   Fri Aug 04 14:47:36 2017 +0200
@@ -655,6 +655,21 @@
 return _hybrid(gen(data), data, lambda x: {'successorset': x},
lambda d: d["successorset"])
 
+@templatekeyword("succsandmarkers")
+def showsuccsandmarkers(repo, ctx, **args):
+"""Returns a list of dict for each final successor of ctx.
+
+The dict contains successors node id in "successors" keys and the list of
+obs-markers from ctx to the set of successors in "markers"
+"""
+
+values = obsutil.successorsandmarkers(repo, ctx)
+
+if values is None:
+values = []
+
+return showlist('succsandmarkers', values, args)
+
 @templatekeyword('p1rev')
 def showp1rev(repo, ctx, templ, **args):
 """Integer. The repository-local revision number of the changeset's
diff -r e3f0339b8355 -r a96edc5bcdc8 mercurial/templater.py
--- a/mercurial/templater.pyMon Jul 03 03:27:58 2017 +0200
+++ b/mercurial/templater.pyFri Aug 04 14:47:36 2017 +0200
@@ -18,6 +18,7 @@
 encoding,
 error,
 minirst,
+obsutil,
 parser,
 pycompat,
 registrar,
@@ -849,6 +850,23 @@
 func = lambda a, b: a % b
 return runarithmetic(context, mapping, (func, args[0], args[1]))
 
+@templatefunc('obsfate(succsandmarkers)')
+def obsfate(context, mapping, args):
+""" Compute obsfate related information based on successors and markers
+"""
+data = args[0][0](context, mapping, args[0][1])
+data = obsutil.computeobsfate(data['successors'], data['markers'])
+
+_hybrid = templatekw._hybrid
+
+# Format the successors for displaying
+succs = _hybrid(None, data['successors'],
+lambda x: {'ctx': mapping['repo'][x], 'revcache': {}},
+lambda d: templatekw._formatrevnode(d['ctx']))
+data['successors'] = succs
+
+return _hybrid(None, [data], lambda x: x, ', ')
+
 @templatefunc('relpath(path)')
 def relpath(context, mapping, args):
 """Convert a repository-absolute path into a filesystem path relative to
diff -r e3f0339b8355 -r a96edc5bcdc8 tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t   Mon Jul 03 03:27:58 2017 +0200
+++ b/tests/test-obsmarker-template.t   Fri Aug 04 14:47:36 2017 +0200
@@ -20,6 +20,8 @@
   > {if(successorssets, "\n  Successors: {successorssets}")}\
   > {if(successorssets, "\n  multi-line: {join(successorssets, "\n  
multi-line: ")}")}\
   > 

[PATCH 1 of 8] obsolete: introduce a _succs class

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499036035 -7200
#  Mon Jul 03 00:53:55 2017 +0200
# Node ID a3797b722e73a1390d0dc8cb4c4630e4fe177919
# Parent  50c44dee741ab99401bf0b3446fe4ae88ccd0bb2
# EXP-Topic obsfatetemplate
obsolete: introduce a _succs class

It will be useful later when we will be adding markers to _succs in order to
represent a successorset with the list of markers from the root to each
successors sets. This information will be needed for the obsfate template I will
introduce.

Makes it a subclass of list so all callers will continue to work.

diff -r 50c44dee741a -r a3797b722e73 mercurial/obsutil.py
--- a/mercurial/obsutil.py  Sun Aug 06 01:13:57 2017 +0900
+++ b/mercurial/obsutil.py  Mon Jul 03 00:53:55 2017 +0200
@@ -311,6 +311,9 @@
 obsoleted.add(rev)
 return obsoleted
 
+class _succs(list):
+"""small class to represent a successors with some metadata about it"""
+
 def successorssets(repo, initialnode, closest=False, cache=None):
 """Return set of all latest successors of initial nodes
 
@@ -429,11 +432,11 @@
 # case (2): end of walk.
 if current in repo:
 # We have a valid successors.
-cache[current] = [(current,)]
+cache[current] = [_succs((current,))]
 else:
 # Final obsolete version is unknown locally.
 # Do not count that as a valid successors
-cache[current] = []
+cache[current] = _succs()
 else:
 # cases (3) and (4)
 #
@@ -471,7 +474,7 @@
 if suc not in cache:
 if suc in stackedset:
 # cycle breaking
-cache[suc] = []
+cache[suc] = _succs()
 else:
 # case (3) If we have not computed successors sets
 # of one of those successors we add it to the
@@ -505,13 +508,13 @@
 succssets = []
 for mark in sorted(succmarkers[current]):
 # successors sets contributed by this marker
-markss = [[]]
+markss = [_succs()]
 for suc in mark[1]:
 # cardinal product with previous successors
 productresult = []
 for prefix in markss:
 for suffix in cache[suc]:
-newss = list(prefix)
+newss = _succs(prefix)
 for part in suffix:
 # do not duplicated entry in successors set
 # first entry wins.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 7 of 8] template: compute dates in obsfate

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499088850 -7200
#  Mon Jul 03 15:34:10 2017 +0200
# Node ID 274933e813ada051cba2e0d193ad098d0d0b28b6
# Parent  d20670d9a7ed76321fbeed7605ceaea1200f9625
# EXP-Topic obsfatetemplate
template: compute dates in obsfate

Extract the dates from obsmarkers. Compute the min and max date from the
obsmarker range list.

diff -r d20670d9a7ed -r 274933e813ad mercurial/obsutil.py
--- a/mercurial/obsutil.py  Mon Jul 03 15:34:00 2017 +0200
+++ b/mercurial/obsutil.py  Mon Jul 03 15:34:10 2017 +0200
@@ -576,9 +576,24 @@
 
 return {'users': sorted(users)}
 
+def _successorsetdates(successorset, markers):
+"""returns the max date and the min date of the markers list
+"""
+
+if not markers:
+return {}
+
+dates = [m[4] for m in markers]
+
+return {
+'min_date': min(dates),
+'max_date': max(dates)
+}
+
 FORMATSSETSFUNCTIONS = [
 _successorsetverb,
 _successorsetusers,
+_successorsetdates,
 ]
 
 def computeobsfate(successorset, rawmarkers):
diff -r d20670d9a7ed -r 274933e813ad tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t   Mon Jul 03 15:34:00 2017 +0200
+++ b/tests/test-obsmarker-template.t   Mon Jul 03 15:34:10 2017 +0200
@@ -20,7 +20,7 @@
   > {if(successorssets, "\n  Successors: {successorssets}")}\
   > {if(successorssets, "\n  multi-line: {join(successorssets, "\n  
multi-line: ")}")}\
   > {if(successorssets, "\n  json: {successorssets|json}")}\n'
-  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb} as {join(successors, ", 
")}{if(users, " by {join(users, ", ")}")}; "}"} \n" )}'
+  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb} as {join(successors, ", 
")}{if(users, " by {join(users, ", ")}")}{if(max_date, "{ifeq(min_date, 
max_date, " (at {min_date|isodate})", " (between {min_date|isodate} and 
{max_date|isodate})")}")}; "}"} \n" )}'
   > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers|json}\n")}'
   > EOF
 
@@ -89,21 +89,21 @@
   o  d004c8f274b9
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 
2001-04-19 04:25 + and 2009-02-13 23:31 +);
   o  ea207398892e
   
   $ hg fatelog
   o  d004c8f274b9
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 
2001-04-19 04:25 + and 2009-02-13 23:31 +);
   o  ea207398892e
   
   $ hg fatelog -v
   o  d004c8f274b9
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2 (between 
2001-04-19 04:25 + and 2009-02-13 23:31 +);
   o  ea207398892e
   
   $ hg up 'desc(A1)' --hidden
@@ -126,7 +126,7 @@
   o  d004c8f274b9
   |
   | @  a468dc9b3633
-  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 
+);
   o  ea207398892e
   
 Predecessors template should show all the predecessors as we force their 
display
@@ -157,11 +157,11 @@
   o  d004c8f274b9
   |
   | @  a468dc9b3633
-  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 
+);
   | x  f137d23bb3e1
   | |
   | x  471f378eab4c
-  |/ Obsfate: rewritten as 3:a468dc9b3633 by test1;
+  |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 
+);
   o  ea207398892e
   
 
@@ -206,11 +206,11 @@
   @  d004c8f274b9
   |
   | x  a468dc9b3633
-  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 
+);
   | x  f137d23bb3e1
   | |
   | x  471f378eab4c
-  |/ Obsfate: rewritten as 3:a468dc9b3633 by test1;
+  |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 
+);
   o  ea207398892e
   
   $ hg fatelogjson --hidden
@@ -314,7 +314,7 @@
   o  337fec4d2edc
   |
   | @  471597cad322
-  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test;
+  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 
1970-01-01 00:00 +);
   o  ea207398892e
   
   $ hg up f257fde29c7a
@@ -355,7 +355,7 @@
   o  337fec4d2edc
   |
   | x  471597cad322
-  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test;
+  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test (at 
1970-01-01 00:00 +);
   o  ea207398892e
   
   $ hg fatelogjson --hidden
@@ -456,7 +456,7 @@
   o  eb5a0daa2192
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 3:eb5a0daa2192 by test;
+  |/ Obsfate: rewritten as 3:eb5a0daa2192 by test (at 

[PATCH 2 of 8] obsolete: add an explicit '_succs.copy()' method

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499044397 -7200
#  Mon Jul 03 03:13:17 2017 +0200
# Node ID be13b5fb2782b04b03d60a988ba306ba4a8d80bd
# Parent  a3797b722e73a1390d0dc8cb4c4630e4fe177919
# EXP-Topic obsfatetemplate
obsolete: add an explicit '_succs.copy()' method

Mimic the standard API for copying in the _succs class, it makes the code
slightly cleaner and will be needed later for copying markers at the same time
than copying the list content.

diff -r a3797b722e73 -r be13b5fb2782 mercurial/obsutil.py
--- a/mercurial/obsutil.py  Mon Jul 03 00:53:55 2017 +0200
+++ b/mercurial/obsutil.py  Mon Jul 03 03:13:17 2017 +0200
@@ -314,6 +314,9 @@
 class _succs(list):
 """small class to represent a successors with some metadata about it"""
 
+def copy(self):
+return _succs(self)
+
 def successorssets(repo, initialnode, closest=False, cache=None):
 """Return set of all latest successors of initial nodes
 
@@ -514,7 +517,7 @@
 productresult = []
 for prefix in markss:
 for suffix in cache[suc]:
-newss = _succs(prefix)
+newss = prefix.copy()
 for part in suffix:
 # do not duplicated entry in successors set
 # first entry wins.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 8] template: compute verb in obsfate

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499088807 -7200
#  Mon Jul 03 15:33:27 2017 +0200
# Node ID 5b38b7216fe07a3a2ff5f1f6b3dfbe4dc986fac9
# Parent  a96edc5bcdc8790719e003eefff91a4f656cc559
# EXP-Topic obsfatetemplate
template: compute verb in obsfate

Use the markers information to compute a better obsfate verb.

The current logic behind the obsfate verb is simple for the moment:

- If the successorsets is empty, the changeset has been pruned, for example:

Obsfate: pruned

- If the successorsets length is 1, the changeset has been rewritten without
  divergence, for example:

Obsfate: rewritten as 2:337fec4d2edc, 3:f257fde29c7a

- If the successorsets length is more than 1, the changeset has diverged, for
  example:

Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a

As the divergence might occurs on a subset of successors, we might see some
successors twice:

Obsfate: split as 9:0b997eb7ceee, 5:dd800401bd8c, 10:eceed8f98ffc; split
as 8:b18bc8331526, 5:dd800401bd8c, 10:eceed8f98ffc

Add the logic behind computing the right verb in a separate function and
register it into FORMATSSETSFUNCTIONS list.

FORMATSSETSFUNCTIONS will contains a list of functions that can compute some
information based on obsmarkers and send back a dict that will be merged into
the obsfate data. Using a list and separate functions would help extensions to
replace some logic or add new data quite easily.

diff -r a96edc5bcdc8 -r 5b38b7216fe0 mercurial/obsutil.py
--- a/mercurial/obsutil.py  Fri Aug 04 14:47:36 2017 +0200
+++ b/mercurial/obsutil.py  Mon Jul 03 15:33:27 2017 +0200
@@ -553,6 +553,21 @@
 cache[current] = final
 return cache[initialnode]
 
+def _successorsetverb(successorset, markers):
+""" Return the verb summarizing the successorset
+"""
+if not successorset:
+verb = 'pruned'
+elif len(successorset) == 1:
+verb = 'rewritten'
+else:
+verb = 'split'
+return {'verb': verb}
+
+FORMATSSETSFUNCTIONS = [
+_successorsetverb,
+]
+
 def computeobsfate(successorset, rawmarkers):
 """ For a successor set, get all related markers and convert every nodeid
 into its hexadecimal form.
@@ -578,6 +593,10 @@
 "markers": sorted(markers)
 }
 
+# Call an extensible list of functions to override or add new data
+for function in FORMATSSETSFUNCTIONS:
+data.update(function(successorset, markers))
+
 return data
 
 def successorsandmarkers(repo, ctx):
diff -r a96edc5bcdc8 -r 5b38b7216fe0 tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t   Fri Aug 04 14:47:36 2017 +0200
+++ b/tests/test-obsmarker-template.t   Mon Jul 03 15:33:27 2017 +0200
@@ -20,7 +20,7 @@
   > {if(successorssets, "\n  Successors: {successorssets}")}\
   > {if(successorssets, "\n  multi-line: {join(successorssets, "\n  
multi-line: ")}")}\
   > {if(successorssets, "\n  json: {successorssets|json}")}\n'
-  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "rewritten as {join(successors, 
", ")}; "}"} \n" )}'
+  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb} as {join(successors, ", 
")}; "}"} \n" )}'
   > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers|json}\n")}'
   > EOF
 
@@ -315,7 +315,7 @@
   o  337fec4d2edc
   |
   | @  471597cad322
-  |/ Obsfate: rewritten as 2:337fec4d2edc, 3:f257fde29c7a;
+  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a;
   o  ea207398892e
   
   $ hg up f257fde29c7a
@@ -356,7 +356,7 @@
   o  337fec4d2edc
   |
   | x  471597cad322
-  |/ Obsfate: rewritten as 2:337fec4d2edc, 3:f257fde29c7a;
+  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a;
   o  ea207398892e
   
   $ hg fatelogjson --hidden
@@ -1525,7 +1525,7 @@
   o  dd800401bd8c
   |
   | x  9bd10a0775e4
-  |/ Obsfate: rewritten as 6:4a004186e638, 7:ba2ed02b0c9a, 5:dd800401bd8c;
+  |/ Obsfate: split as 6:4a004186e638, 7:ba2ed02b0c9a, 5:dd800401bd8c;
   o  f897c6137566
   |
   | x  0dec01379d3b
@@ -1600,7 +1600,7 @@
   o  dd800401bd8c
   |
   | @  9bd10a0775e4
-  |/ Obsfate: rewritten as 9:0b997eb7ceee, 5:dd800401bd8c, 
10:eceed8f98ffc; rewritten as 8:b18bc8331526, 5:dd800401bd8c, 10:eceed8f98ffc;
+  |/ Obsfate: split as 9:0b997eb7ceee, 5:dd800401bd8c, 10:eceed8f98ffc; 
split as 8:b18bc8331526, 5:dd800401bd8c, 10:eceed8f98ffc;
   o  f897c6137566
   |
   o  ea207398892e
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 8] obsolete: track markers in _succs

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499045278 -7200
#  Mon Jul 03 03:27:58 2017 +0200
# Node ID e3f0339b83553039dcd87b62dc1dfbdf98548792
# Parent  be13b5fb2782b04b03d60a988ba306ba4a8d80bd
# EXP-Topic obsfatetemplate
obsolete: track markers in _succs

We now also store markers in _succs. It will be useful for the obsfate template 
that
will use them to display more meaningful information like the list of users
that have evolved a changeset into its successors.

diff -r be13b5fb2782 -r e3f0339b8355 mercurial/obsutil.py
--- a/mercurial/obsutil.py  Mon Jul 03 03:13:17 2017 +0200
+++ b/mercurial/obsutil.py  Mon Jul 03 03:27:58 2017 +0200
@@ -314,8 +314,14 @@
 class _succs(list):
 """small class to represent a successors with some metadata about it"""
 
+def __init__(self, *args, **kwargs):
+super(_succs, self).__init__(*args, **kwargs)
+self.markers = set()
+
 def copy(self):
-return _succs(self)
+new = _succs(self)
+new.markers = self.markers.copy()
+return new
 
 def successorssets(repo, initialnode, closest=False, cache=None):
 """Return set of all latest successors of initial nodes
@@ -511,13 +517,16 @@
 succssets = []
 for mark in sorted(succmarkers[current]):
 # successors sets contributed by this marker
-markss = [_succs()]
+base = _succs()
+base.markers.add(mark)
+markss = [base]
 for suc in mark[1]:
 # cardinal product with previous successors
 productresult = []
 for prefix in markss:
 for suffix in cache[suc]:
 newss = prefix.copy()
+newss.markers.update(suffix.markers)
 for part in suffix:
 # do not duplicated entry in successors set
 # first entry wins.
@@ -532,12 +541,13 @@
 candidate = sorted(((set(s), s) for s in succssets if s),
key=lambda x: len(x[1]), reverse=True)
 for setversion, listversion in candidate:
-for seenset in seen:
+for seenset, seensuccs in seen:
 if setversion.issubset(seenset):
+seensuccs.markers.update(listversion.markers)
 break
 else:
 final.append(listversion)
-seen.append(setversion)
+seen.append((setversion, listversion))
 final.reverse() # put small successors set first
 cache[current] = final
 return cache[initialnode]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 8] template: compute user in obsfate

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499088840 -7200
#  Mon Jul 03 15:34:00 2017 +0200
# Node ID d20670d9a7ed76321fbeed7605ceaea1200f9625
# Parent  5b38b7216fe07a3a2ff5f1f6b3dfbe4dc986fac9
# EXP-Topic obsfatetemplate
template: compute user in obsfate

Extract, deduplicate users informations from obs markers in order to display
them.

Print all users for the moment, we might want to only display users in verbose
mode.

diff -r 5b38b7216fe0 -r d20670d9a7ed mercurial/obsutil.py
--- a/mercurial/obsutil.py  Mon Jul 03 15:33:27 2017 +0200
+++ b/mercurial/obsutil.py  Mon Jul 03 15:34:00 2017 +0200
@@ -564,8 +564,21 @@
 verb = 'split'
 return {'verb': verb}
 
+def _successorsetusers(successorset, markers):
+""" Returns a sorted list of markers users without duplicates
+"""
+if not markers:
+return {}
+
+# Check that user is present in meta
+markersmeta = [dict(m[3]) for m in markers]
+users = set(meta.get('user') for meta in markersmeta if meta.get('user'))
+
+return {'users': sorted(users)}
+
 FORMATSSETSFUNCTIONS = [
 _successorsetverb,
+_successorsetusers,
 ]
 
 def computeobsfate(successorset, rawmarkers):
diff -r 5b38b7216fe0 -r d20670d9a7ed tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t   Mon Jul 03 15:33:27 2017 +0200
+++ b/tests/test-obsmarker-template.t   Mon Jul 03 15:34:00 2017 +0200
@@ -20,7 +20,7 @@
   > {if(successorssets, "\n  Successors: {successorssets}")}\
   > {if(successorssets, "\n  multi-line: {join(successorssets, "\n  
multi-line: ")}")}\
   > {if(successorssets, "\n  json: {successorssets|json}")}\n'
-  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb} as {join(successors, ", 
")}; "}"} \n" )}'
+  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb} as {join(successors, ", 
")}{if(users, " by {join(users, ", ")}")}; "}"} \n" )}'
   > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers|json}\n")}'
   > EOF
 
@@ -89,21 +89,21 @@
   o  d004c8f274b9
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 4:d004c8f274b9;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
   o  ea207398892e
   
   $ hg fatelog
   o  d004c8f274b9
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 4:d004c8f274b9;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
   o  ea207398892e
   
   $ hg fatelog -v
   o  d004c8f274b9
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 4:d004c8f274b9;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test1, test2;
   o  ea207398892e
   
   $ hg up 'desc(A1)' --hidden
@@ -126,7 +126,7 @@
   o  d004c8f274b9
   |
   | @  a468dc9b3633
-  |/ Obsfate: rewritten as 4:d004c8f274b9;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
   o  ea207398892e
   
 Predecessors template should show all the predecessors as we force their 
display
@@ -157,11 +157,11 @@
   o  d004c8f274b9
   |
   | @  a468dc9b3633
-  |/ Obsfate: rewritten as 4:d004c8f274b9;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
   | x  f137d23bb3e1
   | |
   | x  471f378eab4c
-  |/ Obsfate: rewritten as 3:a468dc9b3633;
+  |/ Obsfate: rewritten as 3:a468dc9b3633 by test1;
   o  ea207398892e
   
 
@@ -206,14 +206,13 @@
   @  d004c8f274b9
   |
   | x  a468dc9b3633
-  |/ Obsfate: rewritten as 4:d004c8f274b9;
+  |/ Obsfate: rewritten as 4:d004c8f274b9 by test2;
   | x  f137d23bb3e1
   | |
   | x  471f378eab4c
-  |/ Obsfate: rewritten as 3:a468dc9b3633;
+  |/ Obsfate: rewritten as 3:a468dc9b3633 by test1;
   o  ea207398892e
   
-
   $ hg fatelogjson --hidden
   @  d004c8f274b9
   |
@@ -315,7 +314,7 @@
   o  337fec4d2edc
   |
   | @  471597cad322
-  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a;
+  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test;
   o  ea207398892e
   
   $ hg up f257fde29c7a
@@ -356,7 +355,7 @@
   o  337fec4d2edc
   |
   | x  471597cad322
-  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a;
+  |/ Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a by test;
   o  ea207398892e
   
   $ hg fatelogjson --hidden
@@ -457,7 +456,7 @@
   o  eb5a0daa2192
   |
   | @  471f378eab4c
-  |/ Obsfate: rewritten as 3:eb5a0daa2192;
+  |/ Obsfate: rewritten as 3:eb5a0daa2192 by test;
   o  ea207398892e
   
   $ hg up 'desc(B0)' --hidden
@@ -486,9 +485,9 @@
   o  eb5a0daa2192
   |
   | @  0dec01379d3b
-  | |Obsfate: rewritten as 3:eb5a0daa2192;
+  | |Obsfate: rewritten as 3:eb5a0daa2192 by test;
   | x  471f378eab4c
-  |/ Obsfate: rewritten as 3:eb5a0daa2192;
+  |/ Obsfate: rewritten as 3:eb5a0daa2192 by test;
   o  ea207398892e
   
   $ hg up 'desc(C0)'
@@ -524,9 +523,9 @@
   @  eb5a0daa2192
   |
   | x  0dec01379d3b
-  | |Obsfate: rewritten as 

[PATCH 8 of 8] template: better prune support in obsfate

2017-08-07 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1499096336 -7200
#  Mon Jul 03 17:38:56 2017 +0200
# Node ID 1d6509b36d5e03608e160c0c0453c129a373dacd
# Parent  274933e813ada051cba2e0d193ad098d0d0b28b6
# EXP-Topic obsfatetemplate
template: better prune support in obsfate

successorssets don't returns good results for pruned commit, add a workaround
for simple cases.

A proper fix would require a large rework of successorssets algorithm, I will
send a separate series for this refactoring.

diff -r 274933e813ad -r 1d6509b36d5e mercurial/obsutil.py
--- a/mercurial/obsutil.py  Mon Jul 03 15:34:10 2017 +0200
+++ b/mercurial/obsutil.py  Mon Jul 03 17:38:56 2017 +0200
@@ -636,8 +636,32 @@
 
 ssets = successorssets(repo, ctx.node(), closest=True)
 
+# closestsuccessors returns an empty list for pruned revisions, remap it
+# into a list containing en empty list for future processing
+if ssets == []:
+ssets = [[]]
+
+# Try to recover pruned markers
+succsmap = repo.obsstore.successors
+fullsuccessorsets = [] # successor set + markers
+for sset in ssets:
+if sset:
+fullsuccessorsets.append(sset)
+else:
+# XXX we do not catch all prune markers (eg rewritten then pruned)
+# (fix me later)
+foundany = False
+for mark in succsmap.get(ctx.node(), ()):
+if not mark[1]:
+foundany = True
+sset = _succs()
+sset.markers.add(mark)
+fullsuccessorsets.append(sset)
+if not foundany:
+fullsuccessorsets.append(_succs())
+
 values = []
-for sset in ssets:
+for sset in fullsuccessorsets:
 values.append({'successors': sset, 'markers': sset.markers})
 
 return values
diff -r 274933e813ad -r 1d6509b36d5e tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t   Mon Jul 03 15:34:10 2017 +0200
+++ b/tests/test-obsmarker-template.t   Mon Jul 03 17:38:56 2017 +0200
@@ -20,7 +20,7 @@
   > {if(successorssets, "\n  Successors: {successorssets}")}\
   > {if(successorssets, "\n  multi-line: {join(successorssets, "\n  
multi-line: ")}")}\
   > {if(successorssets, "\n  json: {successorssets|json}")}\n'
-  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb} as {join(successors, ", 
")}{if(users, " by {join(users, ", ")}")}{if(max_date, "{ifeq(min_date, 
max_date, " (at {min_date|isodate})", " (between {min_date|isodate} and 
{max_date|isodate})")}")}; "}"} \n" )}'
+  > fatelog = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers % "{obsfate(succsandmarkers) % "{verb}{if(successors, " as 
")}{join(successors, ", ")}{if(users, " by {join(users, ", ")}")}{if(max_date, 
"{ifeq(min_date, max_date, " (at {min_date|isodate})", " (between 
{min_date|isodate} and {max_date|isodate})")}")}; "}"} \n" )}'
   > fatelogjson = log -G -T '{node|short}\n{if(succsandmarkers, "  Obsfate: 
{succsandmarkers|json}\n")}'
   > EOF
 
@@ -159,7 +159,7 @@
   | @  a468dc9b3633
   |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 
+);
   | x  f137d23bb3e1
-  | |
+  | |Obsfate: pruned by test1 (at 2009-02-13 23:31 +);
   | x  471f378eab4c
   |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 
+);
   o  ea207398892e
@@ -208,7 +208,7 @@
   | x  a468dc9b3633
   |/ Obsfate: rewritten as 4:d004c8f274b9 by test2 (at 2001-04-19 04:25 
+);
   | x  f137d23bb3e1
-  | |
+  | |Obsfate: pruned by test1 (at 2009-02-13 23:31 +);
   | x  471f378eab4c
   |/ Obsfate: rewritten as 3:a468dc9b3633 by test1 (at 2009-02-13 23:31 
+);
   o  ea207398892e
@@ -219,7 +219,7 @@
   | x  a468dc9b3633
   |/ Obsfate: [{"markers": 
[["\udca4h\u071b63\udc8b\u0014\udcfd\udcb7\udc82_U\udcce=\udcf4\udce7\u0015\u0017\udcad",
 
["\udcd0\u0004\udcc8\udcf2t\udcb9\udcecH\nG\udca9\u003c\u0010\udcda\udcc5\udcee\udce6:\udcdbx"],
 0, [["user", "test2"]], [987654321.0, 0], null]], "successors": 
["\udcd0\u0004\udcc8\udcf2t\udcb9\udcecH\nG\udca9\u003c\u0010\udcda\udcc5\udcee\udce6:\udcdbx"]}]
   | x  f137d23bb3e1
-  | |
+  | |Obsfate: [{"markers": 
[["\udcf17\udcd2;\udcb3\udce1\u001d\udcc1\udcda\udcebbd\udcfa\udcc9\udccb$3x.\u0015",
 [], 0, [["user", "test1"]], [1234567890.0, 0], 
["G\u001f7\udc8e\udcabL^%\udcf6\udcc7\u007fx['\udcc96\udcef\udcb2(t"]]], 
"successors": []}]
   | x  471f378eab4c
   |/ Obsfate: [{"markers": 
[["G\u001f7\udc8e\udcabL^%\udcf6\udcc7\u007fx['\udcc96\udcef\udcb2(t", 
["\udca4h\u071b63\udc8b\u0014\udcfd\udcb7\udc82_U\udcce=\udcf4\udce7\u0015\u0017\udcad"],
 0, [["user", "test1"]], [1234567890.0, 0], null]], "successors": 
["\udca4h\u071b63\udc8b\u0014\udcfd\udcb7\udc82_U\udcce=\udcf4\udce7\u0015\u0017\udcad"]}]
   o  ea207398892e
@@ -1212,7 +1212,7 @@
   o  f897c6137566
   |
   | @  

Re: [PATCH] filemerge: move decorator definition for internal merge tools to registrar

2017-08-07 Thread Yuya Nishihara
On Mon, 07 Aug 2017 00:20:36 +0900, FUJIWARA Katsunori wrote:
> At Sun, 6 Aug 2017 22:16:04 +0900,
> Yuya Nishihara wrote:
> > On Sun, 06 Aug 2017 03:51:49 +0900, FUJIWARA Katsunori wrote:
> > > # HG changeset patch
> > > # User FUJIWARA Katsunori 
> > > # Date 1501949637 -32400
> > > #  Sun Aug 06 01:13:57 2017 +0900
> > > # Node ID 2430ac5b30e11c6cdc7309b3c2741cd3878b4b36
> > > # Parent  93422d0068f8979b33a02e5003fd4b6c23413361
> > > # Available At https://bitbucket.org/foozy/mercurial-wip
> > > #  hg pull https://bitbucket.org/foozy/mercurial-wip -r 
> > > 2430ac5b30e1
> > > # EXP-Topic filemerge-refactor
> > > filemerge: move decorator definition for internal merge tools to registrar
> > 
> > Queued, thanks. Do you have any example extension that will register an
> > inprocess merge tool?
> 
> Once I wrote an inprocess merge tool "mergebypatch". This already uses
> filemerge.internaltool decorator directly, but can become an example
> client of new registrar decorator, too.
> 
> https://bitbucket.org/foozy/hgext-mergebypatch

Thanks for the info. It'll be nice if we have at least one example in core
hgext or tests.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D254: obsolete: rename divergent volatile set into contentdivergent volatile set

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  mercurial/obsolete.py
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -732,8 +732,8 @@
 """
 # i18n: "contentdivergent" is a keyword
 getargs(x, 0, 0, _("contentdivergent takes no arguments"))
-divergent = obsmod.getrevs(repo, 'divergent')
-return subset & divergent
+contentdivergent = obsmod.getrevs(repo, 'contentdivergent')
+return subset & contentdivergent
 
 @predicate('extinct()', safe=True)
 def extinct(repo, subset, x):
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -968,6 +968,14 @@
 
 @cachefor('divergent')
 def _computedivergentset(repo):
+msg = ("'divergent' volatile set is deprecated, "
+   "use 'contentdivergent'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return _computecontentdivergentset(repo)
+
+@cachefor('contentdivergent')
+def _computecontentdivergentset(repo):
 """the set of rev that compete to be the final successors of some revision.
 """
 divergent = set()
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -237,7 +237,7 @@
 
 Only non-public and non-obsolete changesets may be divergent.
 """
-return self.rev() in obsmod.getrevs(self._repo, 'divergent')
+return self.rev() in obsmod.getrevs(self._repo, 'contentdivergent')
 
 def troubled(self):
 msg = ("'context.troubled' is deprecated, "



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


D252: revset: rename bumped into phasedivergent

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Don't touch bumped volatile set name, only the revset name. The volatile set
  name will be updated in a later patch.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/revset.py
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -223,7 +223,7 @@
 note that the bumped changeset (5:5601fb93a350) is not a direct successor of
 the public changeset
 
-  $ hg log --hidden -r 'bumped()'
+  $ hg log --hidden -r 'phasedivergent()'
   5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
 
 And that we can't push bumped changeset
@@ -261,7 +261,7 @@
   created new head
   $ hg debugobsolete -d '1338 0' --flags 1 `getid new_3_c` `getid n3w_3_c`
   obsoleted 1 changesets
-  $ hg log -r 'bumped()'
+  $ hg log -r 'phasedivergent()'
   $ hg log -G
   @  6:6f9641995072 (draft) [tip ] add n3w_3_c
   |
@@ -910,7 +910,7 @@
   $ hg debugobsolete `getid obsolete_e`
   obsoleted 1 changesets
   $ hg debugobsolete `getid original_c` `getid babar`
-  $ hg log --config ui.logtemplate= -r 'bumped() and orphan()'
+  $ hg log --config ui.logtemplate= -r 'phasedivergent() and orphan()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
@@ -925,12 +925,12 @@
 
 test the "troubles" templatekw
 
-  $ hg log -r 'bumped() and orphan()'
+  $ hg log -r 'phasedivergent() and orphan()'
   7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
 
 test the default cmdline template
 
-  $ hg log -T default -r 'bumped()'
+  $ hg log -T default -r 'phasedivergent()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
@@ -947,7 +947,7 @@
 
 test summary output
 
-  $ hg up -r 'bumped() and orphan()'
+  $ hg up -r 'phasedivergent() and orphan()'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg summary
   parent: 7:50c51b361e60  (orphan, phase-divergent)
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -459,12 +459,20 @@
 
 @predicate('bumped()', safe=True)
 def bumped(repo, subset, x):
+msg = ("'bumped()' is deprecated, "
+   "use 'phasedivergent()'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return phasedivergent(repo, subset, x)
+
+@predicate('phasedivergent()', safe=True)
+def phasedivergent(repo, subset, x):
 """Mutable changesets marked as successors of public changesets.
 
-Only non-public and non-obsolete changesets can be `bumped`.
+Only non-public and non-obsolete changesets can be `phasedivergent`.
 """
-# i18n: "bumped" is a keyword
-getargs(x, 0, 0, _("bumped takes no arguments"))
+# i18n: "phasedivergent" is a keyword
+getargs(x, 0, 0, _("phasedivergent takes no arguments"))
 bumped = obsmod.getrevs(repo, 'bumped')
 return subset & bumped
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4975,13 +4975,13 @@
 ui.status(_('phases: %s\n') % ', '.join(t))
 
 if obsolete.isenabled(repo, obsolete.createmarkersopt):
-for trouble in ("orphan", "contentdivergent", "bumped"):
+for trouble in ("orphan", "contentdivergent", "phasedivergent"):
 numtrouble = len(repo.revs(trouble + "()"))
 # We write all the possibilities to ease translation
 troublemsg = {
"orphan": _("orphan: %d changesets"),
"contentdivergent": _("content-divergent: %d changesets"),
-   "bumped": _("phase-divergent: %d changesets"),
+   "phasedivergent": _("phase-divergent: %d changesets"),
 }
 if numtrouble > 0:
 ui.status(troublemsg[trouble] % numtrouble + "\n")



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


D253: obsolete: rename unstable volatile set into orphan volatile set

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  mercurial/obsolete.py
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1947,8 +1947,8 @@
 """
 # i18n: "orphan" is a keyword
 getargs(x, 0, 0, _("orphan takes no arguments"))
-unstables = obsmod.getrevs(repo, 'unstable')
-return subset & unstables
+orphan = obsmod.getrevs(repo, 'orphan')
+return subset & orphan
 
 
 @predicate('user(string)', safe=True)
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -908,6 +908,14 @@
 
 @cachefor('unstable')
 def _computeunstableset(repo):
+msg = ("'unstable' volatile set is deprecated, "
+   "use 'orphan'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return _computeorphanset(repo)
+
+@cachefor('orphan')
+def _computeorphanset(repo):
 """the set of non obsolete revisions with obsolete parents"""
 pfunc = repo.changelog.parentrevs
 mutable = _mutablerevs(repo)
@@ -926,7 +934,7 @@
 @cachefor('suspended')
 def _computesuspendedset(repo):
 """the set of obsolete parents with non obsolete descendants"""
-suspended = repo.changelog.ancestors(getrevs(repo, 'unstable'))
+suspended = repo.changelog.ancestors(getrevs(repo, 'orphan'))
 return set(r for r in getrevs(repo, 'obsolete') if r in suspended)
 
 @cachefor('extinct')
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -211,7 +211,7 @@
 
 def orphan(self):
 """True if the changeset is not obsolete but it's ancestor are"""
-return self.rev() in obsmod.getrevs(self._repo, 'unstable')
+return self.rev() in obsmod.getrevs(self._repo, 'orphan')
 
 def bumped(self):
 msg = ("'context.bumped' is deprecated, "



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


D251: revset: remane divergent into contentdivergent

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Don't touch divergent volatile set name, only the revset name. The volatile
  set name will be updated in a later patch.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/revset.py
  tests/test-obsolete-divergent.t
  tests/test-rebase-obsolete.t
  tests/test-revset.t

CHANGE DETAILS

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -4504,10 +4504,10 @@
   E
   G
 
-  $ hg log -r 'successors(B+A)-divergent()' -T '{desc}\n'
+  $ hg log -r 'successors(B+A)-contentdivergent()' -T '{desc}\n'
   A
   Z
   B
 
-  $ hg log -r 'successors(B+A)-divergent()-obsolete()' -T '{desc}\n'
+  $ hg log -r 'successors(B+A)-contentdivergent()-obsolete()' -T '{desc}\n'
   Z
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -215,7 +215,7 @@
   08483444fef91d6224f6655ee586a65d263ad34c 
4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
   8877864f1edb05d0e07dc4ba77b67a80a7b86672 
462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
   5ae4c968c6aca831df823664e706c9d4aa34473d 
98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
-  $ hg log --rev 'divergent()'
+  $ hg log --rev 'contentdivergent()'
   $ hg log -G
   o  13:98f6af4ee953 C
   |
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -80,7 +80,7 @@
   82623d38b9ba
   392fd25390da
   392fd25390da
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
   2:82623d38b9ba A_1
   3:392fd25390da A_2
   $ hg debugsuccessorssets 'all()' --closest
@@ -147,7 +147,7 @@
   01f36c5a8fda
   01f36c5a8fda
   01f36c5a8fda
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
   2:82623d38b9ba A_1
   4:01f36c5a8fda A_3
   $ hg debugsuccessorssets 'all()' --closest
@@ -199,7 +199,7 @@
   82623d38b9ba
   392fd25390da
   392fd25390da
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
   2:82623d38b9ba A_1
   3:392fd25390da A_2
   $ hg debugsuccessorssets 'all()' --closest
@@ -278,7 +278,7 @@
   01f36c5a8fda
   01f36c5a8fda
   01f36c5a8fda
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
   $ hg debugsuccessorssets 'all()' --closest
   d20a80d4def3
   d20a80d4def3
@@ -322,7 +322,7 @@
   82623d38b9ba
   392fd25390da
   392fd25390da
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
   $ hg debugsuccessorssets 'all()' --closest
   d20a80d4def3
   d20a80d4def3
@@ -410,7 +410,7 @@
   e442cfc57690
   e442cfc57690
   e442cfc57690
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
 
 Check more complex obsolescence graft (with divergence)
 
@@ -515,7 +515,7 @@
   14608b260df8
   bed64f5d2f5a
   bed64f5d2f5a
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
   4:01f36c5a8fda A_3
   8:7ae126973a96 A_7
   9:14608b260df8 A_8
@@ -614,7 +614,7 @@
   a139f71be9da
   a139f71be9da
   a139f71be9da
-  $ hg log -r 'divergent()'
+  $ hg log -r 'contentdivergent()'
 
   $ cd ..
 
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -711,11 +711,19 @@
 
 @predicate('divergent()', safe=True)
 def divergent(repo, subset, x):
+msg = ("'divergent()' is deprecated, "
+   "use 'contentdivergent()'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return contentdivergent(repo, subset, x)
+
+@predicate('contentdivergent()', safe=True)
+def contentdivergent(repo, subset, x):
 """
 Final successors of changesets with an alternative set of final successors.
 """
-# i18n: "divergent" is a keyword
-getargs(x, 0, 0, _("divergent takes no arguments"))
+# i18n: "contentdivergent" is a keyword
+getargs(x, 0, 0, _("contentdivergent takes no arguments"))
 divergent = obsmod.getrevs(repo, 'divergent')
 return subset & divergent
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4975,12 +4975,12 @@
 ui.status(_('phases: %s\n') % ', '.join(t))
 
 if obsolete.isenabled(repo, obsolete.createmarkersopt):
-for trouble in ("orphan", "divergent", "bumped"):
+for trouble in ("orphan", "contentdivergent", "bumped"):
 numtrouble = len(repo.revs(trouble + "()"))
 # We write all the possibilities to ease translation
 troublemsg = {
"orphan": _("orphan: %d changesets"),
-   "divergent": _("content-divergent: 

D258: label: rename trouble.X into instability.X

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/templatekw.py
  mercurial/templates/map-cmdline.default
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -948,15 +948,15 @@
 test the obsolete labels
 
   $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
-  [log.changeset changeset.draft changeset.unstable trouble.orphan 
trouble.phase-divergent|changeset:   7:50c51b361e60]
+  [log.changeset changeset.draft changeset.unstable instability.orphan 
instability.phase-divergent|changeset:   7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
   [log.trouble|instability: orphan, phase-divergent]
   [log.summary|summary: add babar]
   
 
   $ hg log -T default -r 'phasedivergent()' --color=debug
-  [log.changeset changeset.draft changeset.unstable 
trouble.orphantrouble.phase-divergent|changeset:   7:50c51b361e60]
+  [log.changeset changeset.draft changeset.unstable 
instability.orphaninstability.phase-divergent|changeset:   7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
   [log.trouble|instability: orphan, phase-divergent]
diff --git a/mercurial/templates/map-cmdline.default 
b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -28,8 +28,8 @@
% ' {name} ({source})'}\n"))}'
 
 # General templates
-_trouble_label = 'trouble.{trouble}'
-_troubles_labels = '{if(instabilities, "changeset.unstable 
{instabilities%_trouble_label}")}'
+_instability_label = 'instability.{instability}'
+_troubles_labels = '{if(instabilities, "changeset.unstable 
{instabilities%_instability_label}")}'
 _obsolete_label = '{if(obsolete, "changeset.obsolete")}'
 _cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", 
"{_obsolete_label}", "{_troubles_labels}")}'
 cset = '{label("{_cset_labels}",
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -783,7 +783,7 @@
 (EXPERIMENTAL)
 """
 args = pycompat.byteskwargs(args)
-return showlist('trouble', args['ctx'].instabilities(), args)
+return showlist('instability', args['ctx'].instabilities(), args)
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = keywords.values()
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1467,7 +1467,7 @@
 if ctx.isunstable():
 labels.append('changeset.unstable')
 for instability in ctx.instabilities():
-labels.append('trouble.%s' % instability)
+labels.append('instability.%s' % instability)
 return ' '.join(labels)
 
 class changeset_printer(object):



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


D255: obsolete: rename bumped volatile set into phasedivergent volatile set

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  mercurial/obsolete.py
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -473,8 +473,8 @@
 """
 # i18n: "phasedivergent" is a keyword
 getargs(x, 0, 0, _("phasedivergent takes no arguments"))
-bumped = obsmod.getrevs(repo, 'bumped')
-return subset & bumped
+phasedivergent = obsmod.getrevs(repo, 'phasedivergent')
+return subset & phasedivergent
 
 @predicate('bundle()', safe=True)
 def bundle(repo, subset, x):
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -942,9 +942,16 @@
 """the set of obsolete parents without non obsolete descendants"""
 return getrevs(repo, 'obsolete') - getrevs(repo, 'suspended')
 
-
 @cachefor('bumped')
 def _computebumpedset(repo):
+msg = ("'bumped' volatile set is deprecated, "
+   "use 'phasedivergent'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return _computephasedivergentset(repo)
+
+@cachefor('phasedivergent')
+def _computephasedivergentset(repo):
 """the set of revs trying to obsolete public revisions"""
 bumped = set()
 # util function (avoid attribute lookup in the loop)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -224,7 +224,7 @@
 
 Only non-public and non-obsolete changesets may be bumped.
 """
-return self.rev() in obsmod.getrevs(self._repo, 'bumped')
+return self.rev() in obsmod.getrevs(self._repo, 'phasedivergent')
 
 def divergent(self):
 msg = ("'context.divergent' is deprecated, "



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


D256: test: add a test for stabilization related labels

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan 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/D256

AFFECTED FILES
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -945,6 +945,40 @@
   summary: add obsolete_e
   
 
+test the obsolete labels
+
+  $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
+  [log.changeset changeset.draft changeset.troubled trouble.orphan 
trouble.phase-divergent|changeset:   7:50c51b361e60]
+  [log.user|user:test]
+  [log.date|date:Thu Jan 01 00:00:00 1970 +]
+  [log.trouble|instability: orphan, phase-divergent]
+  [log.summary|summary: add babar]
+  
+
+  $ hg log -T default -r 'phasedivergent()' --color=debug
+  [log.changeset changeset.draft changeset.troubled 
trouble.orphantrouble.phase-divergent|changeset:   7:50c51b361e60]
+  [log.user|user:test]
+  [log.date|date:Thu Jan 01 00:00:00 1970 +]
+  [log.trouble|instability: orphan, phase-divergent]
+  [log.summary|summary: add babar]
+  
+
+  $ hg log --config ui.logtemplate= --color=debug -r "obsolete()"
+  [log.changeset changeset.draft changeset.obsolete|changeset:   
6:3de5eca88c00]
+  [log.parent changeset.draft|parent:  3:6f9641995072]
+  [log.user|user:test]
+  [log.date|date:Thu Jan 01 00:00:00 1970 +]
+  [log.summary|summary: add obsolete_e]
+  
+
+  $ hg log -T default -r 'obsolete()' --color=debug
+  [log.changeset changeset.draft changeset.obsolete|changeset:   
6:3de5eca88c00]
+  [log.parent changeset.draft|parent:  3:6f9641995072]
+  [log.user|user:test]
+  [log.date|date:Thu Jan 01 00:00:00 1970 +]
+  [log.summary|summary: add obsolete_e]
+  
+
 test summary output
 
   $ hg up -r 'phasedivergent() and orphan()'



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


D257: label: rename changeset.troubled into changeset.unstable

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/templates/map-cmdline.default
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -948,15 +948,15 @@
 test the obsolete labels
 
   $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
-  [log.changeset changeset.draft changeset.troubled trouble.orphan 
trouble.phase-divergent|changeset:   7:50c51b361e60]
+  [log.changeset changeset.draft changeset.unstable trouble.orphan 
trouble.phase-divergent|changeset:   7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
   [log.trouble|instability: orphan, phase-divergent]
   [log.summary|summary: add babar]
   
 
   $ hg log -T default -r 'phasedivergent()' --color=debug
-  [log.changeset changeset.draft changeset.troubled 
trouble.orphantrouble.phase-divergent|changeset:   7:50c51b361e60]
+  [log.changeset changeset.draft changeset.unstable 
trouble.orphantrouble.phase-divergent|changeset:   7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
   [log.trouble|instability: orphan, phase-divergent]
diff --git a/mercurial/templates/map-cmdline.default 
b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -29,7 +29,7 @@
 
 # General templates
 _trouble_label = 'trouble.{trouble}'
-_troubles_labels = '{if(instabilities, "changeset.troubled 
{instabilities%_trouble_label}")}'
+_troubles_labels = '{if(instabilities, "changeset.unstable 
{instabilities%_trouble_label}")}'
 _obsolete_label = '{if(obsolete, "changeset.obsolete")}'
 _cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", 
"{_obsolete_label}", "{_troubles_labels}")}'
 cset = '{label("{_cset_labels}",
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1465,7 +1465,7 @@
 if ctx.obsolete():
 labels.append('changeset.obsolete')
 if ctx.isunstable():
-labels.append('changeset.troubled')
+labels.append('changeset.unstable')
 for instability in ctx.instabilities():
 labels.append('trouble.%s' % instability)
 return ' '.join(labels)



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


D259: label: rename log.trouble into log.instability

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/templates/map-cmdline.default
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -951,15 +951,15 @@
   [log.changeset changeset.draft changeset.unstable instability.orphan 
instability.phase-divergent|changeset:   7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
-  [log.trouble|instability: orphan, phase-divergent]
+  [log.instability|instability: orphan, phase-divergent]
   [log.summary|summary: add babar]
   
 
   $ hg log -T default -r 'phasedivergent()' --color=debug
   [log.changeset changeset.draft changeset.unstable 
instability.orphaninstability.phase-divergent|changeset:   7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
-  [log.trouble|instability: orphan, phase-divergent]
+  [log.instability|instability: orphan, phase-divergent]
   [log.summary|summary: add babar]
   
 
diff --git a/mercurial/templates/map-cmdline.default 
b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -68,7 +68,7 @@
 ldate = '{label("log.date",
 "date:{date|date}")}\n'
 
-ltroubles = '{if(instabilities, "{label('log.trouble',
+ltroubles = '{if(instabilities, "{label('log.instability',
'instability: {join(instabilities, ", 
")}')}\n")}'
 
 extra = '{label("ui.debug log.extra",
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1581,7 +1581,7 @@
 # i18n: column positioning for "hg log"
 instabilities = ctx.instabilities()
 self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
-  label='log.trouble')
+  label='log.instability')
 
 self._exthook(ctx)
 



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


D237: template: rename troubles templatekw into instabilities

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rename troubles template keyword into instabilities and add a deprecation
  warning on templatekw.
  
  Update default mapfile and test files to use the new template keyword.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/templatekw.py
  mercurial/templates/map-cmdline.default
  tests/test-obsolete-divergent.t
  tests/test-obsolete.t
  tests/test-template-engine.t

CHANGE DETAILS

diff --git a/tests/test-template-engine.t b/tests/test-template-engine.t
--- a/tests/test-template-engine.t
+++ b/tests/test-template-engine.t
@@ -10,7 +10,7 @@
   > def process(self, t, map):
   > tmpl = self.loader(t)
   > for k, v in map.iteritems():
-  > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache'):
+  > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 
'troubles'):
   > continue
   > if hasattr(v, '__call__'):
   > v = v(**map)
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -3,7 +3,7 @@
   > # public changeset are not obsolete
   > publish=false
   > [ui]
-  > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' 
*{obsolete}*')}{if(troubles, ' {troubles}')}) [{tags} {bookmarks}] 
{desc|firstline}\n"
+  > logtemplate="{rev}:{node|short} ({phase}{if(obsolete, ' 
*{obsolete}*')}{if(instabilities, ' {instabilities}')}) [{tags} {bookmarks}] 
{desc|firstline}\n"
   > EOF
   $ mkcommit() {
   >echo "$1" > "$1"
@@ -934,7 +934,7 @@
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  trouble: orphan, phase-divergent
+  instability: orphan, phase-divergent
   summary: add babar
   
   $ hg log -T default -r 'obsolete()'
diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
--- a/tests/test-obsolete-divergent.t
+++ b/tests/test-obsolete-divergent.t
@@ -670,7 +670,7 @@
 
   $ rm .hg/localtags
   $ hg cleanup --config extensions.t=$TESTTMP/scmutilcleanup.py
-  $ hg log -G -T '{rev}:{node|short} {desc} {troubles}' -r 'sort(all(), topo)'
+  $ hg log -G -T '{rev}:{node|short} {desc} {instabilities}' -r 'sort(all(), 
topo)'
   @  5:1a2a9b5b0030 B2 content-divergent
   |
   | o  4:70d5a63ca112 B4 content-divergent
diff --git a/mercurial/templates/map-cmdline.default 
b/mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default
+++ b/mercurial/templates/map-cmdline.default
@@ -29,7 +29,7 @@
 
 # General templates
 _trouble_label = 'trouble.{trouble}'
-_troubles_labels = '{if(troubles, "changeset.troubled 
{troubles%_trouble_label}")}'
+_troubles_labels = '{if(instabilities, "changeset.troubled 
{instabilities%_trouble_label}")}'
 _obsolete_label = '{if(obsolete, "changeset.obsolete")}'
 _cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", 
"{_obsolete_label}", "{_troubles_labels}")}'
 cset = '{label("{_cset_labels}",
@@ -68,8 +68,8 @@
 ldate = '{label("log.date",
 "date:{date|date}")}\n'
 
-ltroubles = '{if(troubles, "{label('log.trouble',
-   'trouble: {join(troubles, ", 
")}')}\n")}'
+ltroubles = '{if(instabilities, "{label('log.trouble',
+   'instability: {join(instabilities, ", 
")}')}\n")}'
 
 extra = '{label("ui.debug log.extra",
 "extra:   {key}={value|stringescape}")}\n'
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -765,9 +765,21 @@
 return repo.ui.termwidth()
 
 @templatekeyword('troubles')
-def showtroubles(**args):
+def showtroubles(repo, **args):
 """List of strings. Evolution troubles affecting the changeset.
 
+(DEPRECATED)
+"""
+msg = ("'troubles' is deprecated, "
+   "use 'instabilities'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return showinstabilities(repo=repo, **args)
+
+@templatekeyword('instabilities')
+def showinstabilities(**args):
+"""List of strings. Evolution instabilities affecting the changeset.
+
 (EXPERIMENTAL)
 """
 args = pycompat.byteskwargs(args)



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


D213: evolution: rename trouble(s) to instability

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 578.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D213?vs=504=578

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-commit-amend.t
  tests/test-obsmarker-template.t

CHANGE DETAILS

diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -442,14 +442,14 @@
   |  parent:  0:ea207398892e
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  trouble: divergent
+  |  instability: divergent
   |  summary: A2
   |
   | o  changeset:   2:fdf9bde5129a
   |/   parent:  0:ea207398892e
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |trouble: divergent
+  |instability: divergent
   |summary: A1
   |
   | x  changeset:   1:471f378eab4c
@@ -469,7 +469,7 @@
   |  parent:  0:ea207398892e
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  trouble: divergent
+  |  instability: divergent
   |  summary: A3
   |
   | x  changeset:   3:65b757b745b9
@@ -482,7 +482,7 @@
   |/   parent:  0:ea207398892e
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |trouble: divergent
+  |instability: divergent
   |summary: A1
   |
   | x  changeset:   1:471f378eab4c
@@ -1086,20 +1086,20 @@
   |  parent:  5:dd800401bd8c
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  trouble: divergent
+  |  instability: divergent
   |  summary: Add B only
   |
   | o  changeset:   8:b18bc8331526
   |/   parent:  5:dd800401bd8c
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |trouble: divergent
+  |instability: divergent
   |summary: Add only B
   |
   | o  changeset:   7:ba2ed02b0c9a
   | |  user:test
   | |  date:Thu Jan 01 00:00:00 1970 +
-  | |  trouble: unstable, divergent
+  | |  instability: unstable, divergent
   | |  summary: Add A,B,C
   | |
   | x  changeset:   6:4a004186e638
@@ -,7 +,7 @@
   |  parent:  3:f897c6137566
   |  user:test
   |  date:Thu Jan 01 00:00:00 1970 +
-  |  trouble: divergent
+  |  instability: divergent
   |  summary: Add A,B,C
   |
   o  changeset:   3:f897c6137566
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -610,7 +610,7 @@
   parent:  11:3334b7925910
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  trouble: unstable
+  instability: unstable
   summary: babar
   
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1579,7 +1579,7 @@
 
 if ctx.troubled():
 # i18n: column positioning for "hg log"
-self.ui.write(_("trouble: %s\n") % ', '.join(ctx.troubles()),
+self.ui.write(_("instability: %s\n") % ', '.join(ctx.troubles()),
   label='log.trouble')
 
 self._exthook(ctx)



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


D250: revset: rename unstable into orphan

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Don't touch unstable volatile set name, only the revset name. The volatile set
  name will be updated in a later patch.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/revset.py
  tests/test-commit-amend.t
  tests/test-histedit-obsolete.t
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -527,7 +527,7 @@
   update: 1 new changesets, 2 branch heads (merge)
   phases: 3 draft
   orphan: 1 changesets
-  $ hg log -G -r '::unstable()'
+  $ hg log -G -r '::orphan()'
   @  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   |
   x  4:94b33453f93b (draft *obsolete*) [ ] add original_d
@@ -910,7 +910,7 @@
   $ hg debugobsolete `getid obsolete_e`
   obsoleted 1 changesets
   $ hg debugobsolete `getid original_c` `getid babar`
-  $ hg log --config ui.logtemplate= -r 'bumped() and unstable()'
+  $ hg log --config ui.logtemplate= -r 'bumped() and orphan()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
@@ -925,7 +925,7 @@
 
 test the "troubles" templatekw
 
-  $ hg log -r 'bumped() and unstable()'
+  $ hg log -r 'bumped() and orphan()'
   7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
 
 test the default cmdline template
@@ -947,7 +947,7 @@
 
 test summary output
 
-  $ hg up -r 'bumped() and unstable()'
+  $ hg up -r 'bumped() and orphan()'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg summary
   parent: 7:50c51b361e60  (orphan, phase-divergent)
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -223,12 +223,12 @@
   $ echo c >> c
   $ hg histedit --continue
 
-  $ hg log -r 'unstable()'
+  $ hg log -r 'orphan()'
   11:c13eb81022ca f (no-eol)
 
 stabilise
 
-  $ hg rebase  -r 'unstable()' -d .
+  $ hg rebase  -r 'orphan()' -d .
   rebasing 11:c13eb81022ca "f"
   $ hg up tip -q
 
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -604,7 +604,7 @@
 babar
   
   $ hg commit --amend
-  $ hg log -r 'unstable()'
+  $ hg log -r 'orphan()'
   changeset:   18:b99e5df575f7
   branch:  a
   parent:  11:3334b7925910
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1919,10 +1919,18 @@
 
 @predicate('unstable()', safe=True)
 def unstable(repo, subset, x):
+msg = ("'unstable()' is deprecated, "
+   "use 'orphan()'")
+repo.ui.deprecwarn(msg, '4.4')
+
+return orphan(repo, subset, x)
+
+@predicate('orphan()', safe=True)
+def orphan(repo, subset, x):
 """Non-obsolete changesets with obsolete ancestors.
 """
-# i18n: "unstable" is a keyword
-getargs(x, 0, 0, _("unstable takes no arguments"))
+# i18n: "orphan" is a keyword
+getargs(x, 0, 0, _("orphan takes no arguments"))
 unstables = obsmod.getrevs(repo, 'unstable')
 return subset & unstables
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4975,11 +4975,11 @@
 ui.status(_('phases: %s\n') % ', '.join(t))
 
 if obsolete.isenabled(repo, obsolete.createmarkersopt):
-for trouble in ("unstable", "divergent", "bumped"):
+for trouble in ("orphan", "divergent", "bumped"):
 numtrouble = len(repo.revs(trouble + "()"))
 # We write all the possibilities to ease translation
 troublemsg = {
-   "unstable": _("orphan: %d changesets"),
+   "orphan": _("orphan: %d changesets"),
"divergent": _("content-divergent: %d changesets"),
"bumped": _("phase-divergent: %d changesets"),
 }



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


D249: test: update evolution config

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  evolution* config has been rewritten in stabilization* in the previous patch,
  update tests file to use the new names.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-amend.t
  tests/test-bisect.t
  tests/test-bookmarks-pushpull.t
  tests/test-bundle2-exchange.t
  tests/test-bundle2-format.t
  tests/test-cache-abuse.t
  tests/test-clone.t
  tests/test-command-template.t
  tests/test-commandserver.t
  tests/test-commit-amend.t
  tests/test-drawdag.t
  tests/test-glog.t
  tests/test-histedit-arguments.t
  tests/test-histedit-obsolete.t
  tests/test-lfconvert.t
  tests/test-log.t
  tests/test-obsmarker-template.t
  tests/test-obsolete-bundle-strip.t
  tests/test-obsolete-changeset-exchange.t
  tests/test-obsolete-checkheads.t
  tests/test-obsolete-divergent.t
  tests/test-obsolete-tag-cache.t
  tests/test-obsolete.t
  tests/test-phases.t
  tests/test-push-race.t
  tests/test-rebase-conflicts.t
  tests/test-rebase-obsolete.t
  tests/test-rebase-partial.t
  tests/test-rebase-scenario-global.t
  tests/test-revset.t
  tests/test-shelve.t
  tests/test-strip.t
  tests/test-subrepo-missing.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -473,7 +473,7 @@
   > [ui]
   > logtemplate={rev}:{node|short} {desc|firstline}
   > [experimental]
-  > evolution=createmarkers
+  > stabilization=createmarkers
   > EOF
 
 Test no-argument update to a successor of an obsoleted changeset
diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -76,7 +76,7 @@
   > [phases]
   > publish=False
   > [experimental]
-  > evolution=createmarkers
+  > stabilization=createmarkers
   > EOF
 
 check that we can update parent repo with missing (amended) subrepo revision
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -1063,8 +1063,8 @@
   $ cd $TESTTMP/scmutilcleanup.obsstore
   $ cat >> .hg/hgrc < [experimental]
-  > evolution=all
-  > evolution.track-operation=1
+  > stabilization=all
+  > stabilization.track-operation=1
   > EOF
 
   $ hg log -r . -T '\n' --config extensions.t=$TESTTMP/scmutilcleanup.py
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -679,7 +679,7 @@
 
   $ cat >> $HGRCPATH << EOF
   > [experimental]
-  > evolution=createmarkers
+  > stabilization=createmarkers
   > EOF
   $ hg shelve
   shelved as default
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -1830,7 +1830,7 @@
   $ cd wdir-hashcollision
   $ cat <> .hg/hgrc
   > [experimental]
-  > evolution = createmarkers
+  > stabilization = createmarkers
   > EOF
   $ echo 0 > a
   $ hg ci -qAm 0
@@ -4465,7 +4465,7 @@
   $ cd repo1
   $ cat <> .hg/hgrc
   > [experimental]
-  > evolution = createmarkers
+  > stabilization = createmarkers
   > EOF
 
   $ hg debugdrawdag <<'EOS'
diff --git a/tests/test-rebase-scenario-global.t 
b/tests/test-rebase-scenario-global.t
--- a/tests/test-rebase-scenario-global.t
+++ b/tests/test-rebase-scenario-global.t
@@ -933,7 +933,7 @@
   > [extensions]
   > wraprebase=$TESTTMP/wraprebase.py
   > [experimental]
-  > evolution=all
+  > stabilization=all
   > EOF
 
   $ hg debugdrawdag <<'EOS'
diff --git a/tests/test-rebase-partial.t b/tests/test-rebase-partial.t
--- a/tests/test-rebase-partial.t
+++ b/tests/test-rebase-partial.t
@@ -7,7 +7,7 @@
   > drawdag=$TESTDIR/drawdag.py
   > 
   > [experimental]
-  > evolution=createmarkers,allowunstable
+  > stabilization=createmarkers,allowunstable
   > 
   > [alias]
   > tglog = log -G --template "{rev}: {desc}"
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -8,7 +8,7 @@
   > [ui]
   > logtemplate= {rev}:{node|short} {desc|firstline}
   > [experimental]
-  > evolution=createmarkers,allowunstable
+  > stabilization=createmarkers,allowunstable
   > [phases]
   > publish=False
   > [extensions]
@@ -732,7 +732,7 @@
   |
   o  0:4a2df7238c3b A
   
-  $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config 
experimental.evolution=all
+  $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config 
experimental.stabilization=all
   obsoleted 1 changesets
   $ hg rebase -d 6 -r "4::"
   rebasing 4:ff2c4d47b71d "C"
@@ -760,7 +760,7 @@
   $ hg add nonrelevant
   $ hg commit -m nonrelevant
   created new head
-  $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config 
experimental.evolution=all
+  $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config 
experimental.stabilization=all
   obsoleted 1 changesets
  

D248: config: rename evolution config into stabilization

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Use aliases for backward-compatibility. Though I'm not sure how to emit
  compatibility warnings with aliases.
  
  Test configuration are updated in the next patch.
  
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/configitems.py
  mercurial/obsolete.py

CHANGE DETAILS

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -102,7 +102,7 @@
 """Returns True if the given repository has the given obsolete option
 enabled.
 """
-result = set(repo.ui.configlist('experimental', 'evolution'))
+result = set(repo.ui.configlist('experimental', 'stabilization'))
 if 'all' in result:
 return True
 
@@ -1007,7 +1007,7 @@
 if 'user' not in metadata:
 metadata['user'] = repo.ui.username()
 useoperation = repo.ui.configbool('experimental',
-'evolution.track-operation')
+'stabilization.track-operation')
 if useoperation and operation:
 metadata['operation'] = operation
 tr = repo.transaction('add-obsolescence-marker')
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -175,14 +175,17 @@
 coreconfigitem('experimental', 'editortmpinhg',
 default=False,
 )
-coreconfigitem('experimental', 'evolution',
+coreconfigitem('experimental', 'stabilization',
 default=list,
+alias=[('experimental', 'evolution')],
 )
-coreconfigitem('experimental', 'evolution.bundle-obsmarker',
+coreconfigitem('experimental', 'stabilization.bundle-obsmarker',
 default=False,
+alias=[('experimental', 'evolution.bundle-obsmarker')],
 )
-coreconfigitem('experimental', 'evolution.track-operation',
+coreconfigitem('experimental', 'stabilization.track-operation',
 default=False,
+alias=[('experimental', 'evolution.track-operation')]
 )
 coreconfigitem('experimental', 'exportableenviron',
 default=list,
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1227,7 +1227,7 @@
 
 
 contentopts = {'cg.version': cgversion}
-if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'):
+if repo.ui.configbool('experimental', 'stabilization.bundle-obsmarker'):
 contentopts['obsolescence'] = True
 if repo.ui.configbool('experimental', 'bundle-phases'):
 contentopts['phases'] = True



To: lothiraldan, #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] filemerge: move decorator definition for internal merge tools to registrar

2017-08-07 Thread FUJIWARA Katsunori

At Tue, 8 Aug 2017 00:12:51 +0900,
Yuya Nishihara wrote:
> 
> On Mon, 07 Aug 2017 00:20:36 +0900, FUJIWARA Katsunori wrote:
> > At Sun, 6 Aug 2017 22:16:04 +0900,
> > Yuya Nishihara wrote:
> > > On Sun, 06 Aug 2017 03:51:49 +0900, FUJIWARA Katsunori wrote:
> > > > # HG changeset patch
> > > > # User FUJIWARA Katsunori 
> > > > # Date 1501949637 -32400
> > > > #  Sun Aug 06 01:13:57 2017 +0900
> > > > # Node ID 2430ac5b30e11c6cdc7309b3c2741cd3878b4b36
> > > > # Parent  93422d0068f8979b33a02e5003fd4b6c23413361
> > > > # Available At https://bitbucket.org/foozy/mercurial-wip
> > > > #  hg pull https://bitbucket.org/foozy/mercurial-wip -r 
> > > > 2430ac5b30e1
> > > > # EXP-Topic filemerge-refactor
> > > > filemerge: move decorator definition for internal merge tools to 
> > > > registrar
> > > 
> > > Queued, thanks. Do you have any example extension that will register an
> > > inprocess merge tool?
> > 
> > Once I wrote an inprocess merge tool "mergebypatch". This already uses
> > filemerge.internaltool decorator directly, but can become an example
> > client of new registrar decorator, too.
> > 
> > https://bitbucket.org/foozy/hgext-mergebypatch
> 
> Thanks for the info. It'll be nice if we have at least one example in core
> hgext or tests.

I'll post follow up for that.

-- 
--
[FUJIWARA Katsunori] fo...@lares.dti.ne.jp
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D260: chg: define _GNU_SOURCE to allow CentOS 5 compilation

2017-08-07 Thread quark (Jun Wu)
quark added a comment.


  Could you include the compiler error if `_GNU_SOURCE` is not set in commit 
message?

REPOSITORY
  rHG Mercurial

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

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


D259: label: rename log.trouble into log.instability

2017-08-07 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D259#4135, @lothiraldan wrote:
  
  > Here are hopefully the last patches of this series.
  >
  > @quark I tried running the hg-experimental 
(https://bitbucket.org/facebook/hg-experimental) tests against this series.
  >
  > I think I don't have the right environment setup, I have bunch of errors 
that seems related to my shell, not having a memcache available and not having 
the remotenames extension. Apart from these errors I didn't saw test output 
changes that seems related to this series.
  
  
  Cool. Thanks!
  
  Ideally those tests should be skipped automatically. I think there is some 
code detecting remotenames and skip accordingly.
  
  > test-lfs.t output changed with this series but also on mercurial stable but 
it could be my test environment again.
  
  lfs is probably unrelated here.

REPOSITORY
  rHG Mercurial

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

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


D262: test-rebase: add a brute force test

2017-08-07 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Rebase is becoming more complex and it looks like a good idea to try some
  brute force enumeration to cover cases that are hard to find manually.
  
  Using brute force to generate repos in different shapes and enumerating the
  rebase source and destination would generate too many cases that takes too
  long to compute. This patch limits the "brute force" to only the "rebase
  source" part. Repo and destination are still manual.
  
  The added test cases are crafted manually to reveal some behaviors that are
  not covered by other tests:
  
  - "revlog index out of range" crash
  - after rebase, p1 == p2, p2 != null
  - "nothing to merge" abort
  
  In the future we might want to add more tests here. For now I'm more
  interested in revealing interesting behaviors in a minified way. I tried
  some more complex cases but didn't find other interesting behaviors.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/bruterebase.py
  tests/test-rebase-brute-force.t

CHANGE DETAILS

diff --git a/tests/test-rebase-brute-force.t b/tests/test-rebase-brute-force.t
new file mode 100644
--- /dev/null
+++ b/tests/test-rebase-brute-force.t
@@ -0,0 +1,55 @@
+  $ cat >> $HGRCPATH < [extensions]
+  > drawdag=$TESTDIR/drawdag.py
+  > bruterebase=$TESTDIR/bruterebase.py
+  > [experimental]
+  > evolution=createmarkers,allowunstable
+  > EOF
+  $ init() {
+  >   N=`expr ${N:-0} + 1`
+  >   cd $TESTTMP && hg init repo$N && cd repo$N
+  >   hg debugdrawdag
+  > }
+
+Source looks like "N"
+
+  $ init <<'EOS'
+  > C D
+  > |\|
+  > A B Z
+  > EOS
+
+  $ hg debugbruterebase 'all()-Z' Z
+ A: A':Z
+ B: B':Z
+AB: A':Z B':Z
+ C: ABORT: cannot use revision 3 as base, result would have 3 parents
+AC: A':Z C':A'B
+BC: B':Z C':B'A
+   ABC: A':Z B':Z C':A'B'
+ D: D':Z
+AD: A':Z D':Z
+BD: B':Z D':B'
+   ABD: A':Z B':Z D':B'
+CD: CRASH: revlog index out of range
+   ACD: A':Z C':A'A' D':Z
+   BCD: B':Z C':B'A D':B'
+  ABCD: A':Z B':Z C':A'B' D':B'
+
+Moving backwards
+
+  $ init <<'EOS'
+  > C
+  > |\
+  > A B
+  > |
+  > Z
+  > EOS
+  $ hg debugbruterebase 'all()-Z' Z
+B: B':Z
+A: 
+   BA: B':Z
+C: ABORT: cannot use revision 3 as base, result would have 3 parents
+   BC: B':Z C':B'A
+   AC: 
+  BAC: ABORT: nothing to merge
diff --git a/tests/bruterebase.py b/tests/bruterebase.py
new file mode 100644
--- /dev/null
+++ b/tests/bruterebase.py
@@ -0,0 +1,69 @@
+# bruterebase.py - brute force rebase testing
+#
+# Copyright 2017 Facebook, Inc.
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from __future__ import absolute_import
+
+from mercurial import (
+error,
+registrar,
+revsetlang,
+)
+
+from hgext import rebase
+
+cmdtable = {}
+command = registrar.command(cmdtable)
+
+@command('debugbruterebase')
+def debugbruterebase(ui, repo, source, dest):
+"""for every non-empty subset of source, run rebase -r subset -d dest
+
+Print one line summary for each subset. Assume obsstore is enabled.
+"""
+srevs = list(repo.revs(source))
+
+with repo.wlock(), repo.lock():
+repolen = len(repo)
+cl = repo.changelog
+
+def getdesc(rev):
+result = cl.changelogrevision(rev).description
+if rev >= repolen:
+result += "'"
+return result
+
+for i in xrange(1, 2 ** len(srevs)):
+subset = [rev for j, rev in enumerate(srevs) if i & (1 << j) != 0]
+spec = revsetlang.formatspec('%ld', subset)
+tr = repo.transaction('rebase')
+tr.report = lambda x: 0 # hide "transaction abort"
+
+ui.pushbuffer()
+try:
+rebase.rebase(ui, repo, dest=dest, rev=[spec])
+except error.Abort as ex:
+summary = 'ABORT: %s' % ex
+except Exception as ex:
+summary = 'CRASH: %s' % ex
+else:
+# short summary about new nodes
+cl = repo.changelog
+descs = []
+for rev in xrange(repolen, len(repo)):
+desc = '%s:' % getdesc(rev)
+for prev in cl.parentrevs(rev):
+if prev > -1:
+desc += getdesc(prev)
+descs.append(desc)
+descs.sort()
+summary = ' '.join(descs)
+ui.popbuffer()
+repo.vfs.tryunlink('rebasestate')
+
+subsetdesc = ''.join(getdesc(rev) for rev in subset)
+ui.write(('%s: %s\n') % (subsetdesc.rjust(len(srevs)), summary))
+tr.abort()



To: quark, #hg-reviewers
Cc: mercurial-devel
___

D261: centos5: use vault urls

2017-08-07 Thread quark (Jun Wu)
quark accepted this revision.
quark added a comment.


  Looks good to me.

REPOSITORY
  rHG Mercurial

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

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


D262: test-rebase: add a brute force test

2017-08-07 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  Thanks for the patch, more testing is always good.
  
  I'm wondering if we could use hypothesis 
(https://github.com/HypothesisWorks/hypothesis-python) for more tests like 
that. One article I found interesting was: 
http://hypothesis.works/articles/rule-based-stateful-testing/

REPOSITORY
  rHG Mercurial

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

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


D262: test-rebase: add a brute force test

2017-08-07 Thread quark (Jun Wu)
quark added a comment.


  While I think hypothesis might be somehow useful. It is to generate random 
test cases, which is different from the efficient brute force here.

REPOSITORY
  rHG Mercurial

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

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