[PATCH V7] revset: support ranges in #generations relation

2019-01-23 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1547564229 -28800
#  Tue Jan 15 22:57:09 2019 +0800
# Node ID 91c4c66050f0b6acba6fe90e1d759165ddffd0d0
# Parent  8aca89a694d4bd7d25877b3652fb83e187ea1802
revset: support ranges in #generations relation

diff --git a/mercurial/dagop.py b/mercurial/dagop.py
--- a/mercurial/dagop.py
+++ b/mercurial/dagop.py
@@ -28,7 +28,7 @@ baseset = smartset.baseset
 generatorset = smartset.generatorset
 
 # possible maximum depth between null and wdir()
-_maxlogdepth = 0x8000
+maxlogdepth = 0x8000
 
 def _walkrevtree(pfunc, revs, startdepth, stopdepth, reverse):
 """Walk DAG using 'pfunc' from the given 'revs' nodes
@@ -42,7 +42,7 @@ def _walkrevtree(pfunc, revs, startdepth
 if startdepth is None:
 startdepth = 0
 if stopdepth is None:
-stopdepth = _maxlogdepth
+stopdepth = maxlogdepth
 if stopdepth == 0:
 return
 if stopdepth < 0:
@@ -221,7 +221,7 @@ def revdescendants(repo, revs, followfir
 Scan ends at the stopdepth (exlusive) if specified. Revisions found
 earlier than the startdepth are omitted.
 """
-if startdepth is None and stopdepth is None:
+if startdepth is None and (stopdepth is None or stopdepth == maxlogdepth):
 gen = _genrevdescendants(repo, revs, followfirst)
 else:
 gen = _genrevdescendantsofdepth(repo, revs, followfirst,
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -225,24 +225,82 @@ def notset(repo, subset, x, order):
 def relationset(repo, subset, x, y, order):
 raise error.ParseError(_("can't use a relation in this context"))
 
-def generationsrel(repo, subset, x, rel, n, order):
-# TODO: support range, rewrite tests, and drop startdepth argument
-# from ancestors() and descendants() predicates
-if n <= 0:
-n = -n
-return _ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1)
-else:
-return _descendants(repo, subset, x, startdepth=n, stopdepth=n + 1)
+def _splitrange(a, b):
+""" Split range with bounds a and b into two ranges at 0 and return two
+lists of numbers for use as startdepth and stopdepth arguments of
+_ancestors and _descendants.
+
+>>> _splitrange(-10, -5) # [-10:-5]
+((5, 11), (None, None))
+>>> _splitrange(5, 10)   # [5:10]
+((None, None), (5, 11))
+>>> _splitrange(-10, 10) # [-10:10]
+((0, 11), (0, 11))
+>>> _splitrange(-10, 0)  # [-10:0]
+((0, 11), (None, None))
+>>> _splitrange(0, 10)   # [0:10]
+((None, None), (0, 11))
+>>> _splitrange(0, 0)# [0:0]
+((0, 1), (None, None))
+>>> _splitrange(1, -1)   # [1:-1]
+((None, None), (None, None))
+"""
+ancdepths = (None, None)
+descdepths = (None, None)
+if a == b == 0:
+ancdepths = (0, 1)
+if a < 0:
+ancdepths = (-min(b, 0), -a + 1)
+if b > 0:
+descdepths = (max(a, 0), b + 1)
+return ancdepths, descdepths
+
+def generationsrel(repo, subset, x, rel, a, b, order):
+# TODO: rewrite tests, and drop startdepth argument from ancestors() and
+# descendants() predicates
+(ancstart, ancstop), (descstart, descstop) = _splitrange(a, b)
+
+if ancstart is None and descstart is None:
+return baseset()
+
+revs = getset(repo, fullreposet(repo), x)
+if not revs:
+return baseset()
+
+if ancstart is not None and descstart is not None:
+s = dagop.revancestors(repo, revs, False, ancstart, ancstop)
+s += dagop.revdescendants(repo, revs, False, descstart, descstop)
+elif ancstart is not None:
+s = dagop.revancestors(repo, revs, False, ancstart, ancstop)
+elif descstart is not None:
+s = dagop.revdescendants(repo, revs, False, descstart, descstop)
+
+return subset & s
 
 def relsubscriptset(repo, subset, x, y, z, order):
 # this is pretty basic implementation of 'x#y[z]' operator, still
 # experimental so undocumented. see the wiki for further ideas.
 # https://www.mercurial-scm.org/wiki/RevsetOperatorPlan
 rel = getsymbol(y)
-n = getinteger(z, _("relation subscript must be an integer"))
+try:
+a, b = getrange(z, '')
+except error.ParseError:
+a = getinteger(z, _("relation subscript must be an integer"))
+b = a
+else:
+def getbound(i):
+if i is None:
+return None
+msg = _("relation subscript bounds must be integers")
+return getinteger(i, msg)
+a, b = [getbound(i) for i in (a, b)]
+if a is None:
+a = -(dagop.maxlogdepth - 1)
+if b is None:
+b = +(dagop.maxlogdepth - 1)
 
 if rel in subscriptrelations:
-return subscriptrelations[rel](repo, subset, x, rel, n, order)
+return subscriptrelations[rel](repo, subset, x, rel, a, b, order)
 
 relnames = [r for r in subscriptrelations.keys() if 

[PATCH 3 of 3 STABLE] rust-cpython: raising error.WdirUnsupported

2019-01-23 Thread Georges Racinet
# HG changeset patch
# User Georges Racinet 
# Date 1548247776 18000
#  Wed Jan 23 07:49:36 2019 -0500
# Branch stable
# Node ID 47d5458a4c32e20de4af1237cfeb157153586cbc
# Parent  a35cfd592a90ae325b452c56fe8bff86cac097dd
# EXP-Topic rust-wdirunsupported
rust-cpython: raising error.WdirUnsupported

The Graph implementation of hg-cpython returns the appropriate error
upon encounter with the working directory special revision number, and
this gives us in particular a code path to test from test-rust-ancestors.py

In the current implementation, the exception is actually raised from
the iterator instantiation; we are nonetheless consuming the iterator
in the test with `list()` in order not to depend on implementation details.

diff -r a35cfd592a90 -r 47d5458a4c32 mercurial/revlog.py
--- a/mercurial/revlog.py   Wed Jan 23 07:47:04 2019 -0500
+++ b/mercurial/revlog.py   Wed Jan 23 07:49:36 2019 -0500
@@ -896,8 +896,6 @@
 common = [nullrev]
 
 if rustext is not None:
-# TODO: WdirUnsupported should be raised instead of GraphError
-# if common includes wdirrev
 return rustext.ancestor.MissingAncestors(self.index, common)
 return ancestor.incrementalmissingancestors(self.parentrevs, common)
 
diff -r a35cfd592a90 -r 47d5458a4c32 rust/hg-cpython/src/cindex.rs
--- a/rust/hg-cpython/src/cindex.rs Wed Jan 23 07:47:04 2019 -0500
+++ b/rust/hg-cpython/src/cindex.rs Wed Jan 23 07:49:36 2019 -0500
@@ -16,7 +16,7 @@
 
 use self::python_sys::PyCapsule_Import;
 use cpython::{PyClone, PyErr, PyObject, PyResult, Python};
-use hg::{Graph, GraphError, Revision};
+use hg::{Graph, GraphError, Revision, WORKING_DIRECTORY_REVISION};
 use libc::c_int;
 use std::ffi::CStr;
 use std::mem::transmute;
@@ -86,6 +86,9 @@
 impl Graph for Index {
 /// wrap a call to the C extern parents function
 fn parents(, rev: Revision) -> Result<[Revision; 2], GraphError> {
+if rev == WORKING_DIRECTORY_REVISION {
+return Err(GraphError::WorkingDirectoryUnsupported);
+}
 let mut res: [c_int; 2] = [0; 2];
 let code = unsafe {
 (self.parents)(
diff -r a35cfd592a90 -r 47d5458a4c32 tests/test-rust-ancestor.py
--- a/tests/test-rust-ancestor.py   Wed Jan 23 07:47:04 2019 -0500
+++ b/tests/test-rust-ancestor.py   Wed Jan 23 07:49:36 2019 -0500
@@ -1,6 +1,10 @@
 from __future__ import absolute_import
 import sys
 import unittest
+from mercurial import (
+error,
+node,
+)
 
 try:
 from mercurial import rustext
@@ -153,6 +157,12 @@
 # rust-cpython issues appropriate str instances for Python 2 and 3
 self.assertEqual(exc.args, ('ParentOutOfRange', 1))
 
+def testwdirunsupported(self):
+# trying to access ancestors of the working directory raises
+# WdirUnsupported directly
+idx = self.parseindex()
+with self.assertRaises(error.WdirUnsupported):
+list(AncestorsIterator(idx, [node.wdirrev], -1, False))
 
 if __name__ == '__main__':
 import silenttestrunner
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3 STABLE] rust: error for WdirUnsupported with cpython conversion as exception

2019-01-23 Thread Georges Racinet
# HG changeset patch
# User Georges Racinet 
# Date 1548247624 18000
#  Wed Jan 23 07:47:04 2019 -0500
# Branch stable
# Node ID a35cfd592a90ae325b452c56fe8bff86cac097dd
# Parent  56b74abf5ee6df48ec2debf1f004725cfcc93854
# EXP-Topic rust-wdirunsupported
rust: error for WdirUnsupported with cpython conversion as exception

This introduces WorkingDirectoryUnsupported as an enum variant
of GraphError in the core and converts it to the expected
`mercurial.error.WdirUnsupported`.

diff -r 56b74abf5ee6 -r a35cfd592a90 rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs   Wed Jan 23 07:39:27 2019 -0500
+++ b/rust/hg-core/src/lib.rs   Wed Jan 23 07:47:04 2019 -0500
@@ -33,4 +33,5 @@
 #[derive(Clone, Debug, PartialEq)]
 pub enum GraphError {
 ParentOutOfRange(Revision),
+WorkingDirectoryUnsupported,
 }
diff -r 56b74abf5ee6 -r a35cfd592a90 rust/hg-cpython/src/exceptions.rs
--- a/rust/hg-cpython/src/exceptions.rs Wed Jan 23 07:39:27 2019 -0500
+++ b/rust/hg-cpython/src/exceptions.rs Wed Jan 23 07:47:04 2019 -0500
@@ -8,6 +8,8 @@
 //! Bindings for Rust errors
 //!
 //! [`GraphError`] exposes `hg::GraphError` as a subclass of `ValueError`
+//! but some variants of `hg::GraphError` can be converted directly to other
+//! existing Python exceptions if appropriate.
 //!
 //! [`GraphError`]: struct.GraphError.html
 use cpython::exc::ValueError;
@@ -22,6 +24,15 @@
 hg::GraphError::ParentOutOfRange(r) => {
 GraphError::new(py, ("ParentOutOfRange", r))
 }
+hg::GraphError::WorkingDirectoryUnsupported => {
+match py
+.import("mercurial.error")
+.and_then(|m| m.get(py, "WdirUnsupported"))
+{
+Err(e) => e,
+Ok(cls) => PyErr::from_instance(py, cls),
+}
+}
 }
 }
 }
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3 STABLE] rust: working directory revision number constant

2019-01-23 Thread Georges Racinet
# HG changeset patch
# User Georges Racinet 
# Date 1548247167 18000
#  Wed Jan 23 07:39:27 2019 -0500
# Branch stable
# Node ID 56b74abf5ee6df48ec2debf1f004725cfcc93854
# Parent  13c23396c7fe1633a2336b29e3a32b9b76274f28
# EXP-Topic rust-wdirunsupported
rust: working directory revision number constant

This introduces the constant, but does not use it anywhere yet.

diff -r 13c23396c7fe -r 56b74abf5ee6 rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs   Sun Jan 20 11:57:36 2019 +0900
+++ b/rust/hg-core/src/lib.rs   Wed Jan 23 07:39:27 2019 -0500
@@ -16,6 +16,12 @@
 
 pub const NULL_REVISION: Revision = -1;
 
+/// Same as `mercurial.node.wdirrev`
+///
+/// This is also equal to `i32::max_value()`, but it's better to spell
+/// it out explicitely, same as in `mercurial.node`
+pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fff;
+
 /// The simplest expression of what we need of Mercurial DAGs.
 pub trait Graph {
 /// Return the two parents of the given `Revision`.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@41303: new changeset (1 on stable)

2019-01-23 Thread Mercurial Commits
New changeset (1 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/c953c2a94d68
changeset:   41303:c953c2a94d68
branch:  stable
tag: tip
parent:  41301:13c23396c7fe
user:Yuya Nishihara 
date:Mon Jan 21 22:14:29 2019 +0900
summary: revlog: fix resolution of revlog version 0

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


mercurial@41302: new changeset

2019-01-23 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/a322dbee4eda
changeset:   41302:a322dbee4eda
bookmark:@
tag: tip
parent:  41289:593f6359681d
parent:  41301:13c23396c7fe
user:Martin von Zweigbergk 
date:Tue Jan 22 10:55:45 2019 -0800
summary: merge with stable

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


D5669: tests: support URL quoting on Python 3

2019-01-23 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd5c58d679ed9: tests: support URL quoting on Python 3 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5669?vs=13381=13387

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

AFFECTED FILES
  tests/test-mq-subrepo-svn.t

CHANGE DETAILS

diff --git a/tests/test-mq-subrepo-svn.t b/tests/test-mq-subrepo-svn.t
--- a/tests/test-mq-subrepo-svn.t
+++ b/tests/test-mq-subrepo-svn.t
@@ -23,10 +23,17 @@
   $ svnadmin create svn-repo-2499
 
   $ SVNREPOPATH=`pwd`/svn-repo-2499/project
+
+#if py3
+  $ pathquoted=`"$PYTHON" -c "import sys, urllib.parse; 
sys.stdout.write(urllib.parse.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#else
+  $ pathquoted=`"$PYTHON" -c "import sys, urllib; 
sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#endif
+
 #if windows
-  $ SVNREPOURL=file:///`"$PYTHON" -c "import urllib, sys; 
sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+  $ SVNREPOURL=file:///$pathquoted
 #else
-  $ SVNREPOURL=file://`"$PYTHON" -c "import urllib, sys; 
sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+  $ SVNREPOURL=file://$pathquoted
 #endif
 
   $ mkdir -p svn-project-2499/trunk



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


D5667: tests: handle string escaping/encoding on Python 3

2019-01-23 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG13ccb03f2145: tests: handle string escaping/encoding on 
Python 3 (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5667?vs=13379=13385

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

AFFECTED FILES
  tests/test-mq-missingfiles.t
  tests/test-mq-qimport.t

CHANGE DETAILS

diff --git a/tests/test-mq-qimport.t b/tests/test-mq-qimport.t
--- a/tests/test-mq-qimport.t
+++ b/tests/test-mq-qimport.t
@@ -1,14 +1,18 @@
   $ cat > writelines.py < import sys
+  > if sys.version_info[0] >= 3:
+  > encode = lambda x: 
x.encode('utf-8').decode('unicode_escape').encode('utf-8')
+  > else:
+  > encode = lambda x: x.decode('string_escape')
   > path = sys.argv[1]
   > args = sys.argv[2:]
   > assert (len(args) % 2) == 0
   > 
   > f = open(path, 'wb')
   > for i in range(len(args)//2):
   >count, s = args[2*i:2*i+2]
   >count = int(count)
-  >s = s.decode('string_escape')
+  >s = encode(s)
   >f.write(s*count)
   > f.close()
   > 
diff --git a/tests/test-mq-missingfiles.t b/tests/test-mq-missingfiles.t
--- a/tests/test-mq-missingfiles.t
+++ b/tests/test-mq-missingfiles.t
@@ -5,15 +5,19 @@
 
   $ cat > writelines.py < import sys
+  > if sys.version_info[0] >= 3:
+  > encode = lambda x: 
x.encode('utf-8').decode('unicode_escape').encode('utf-8')
+  > else:
+  > encode = lambda x: x.decode('string_escape')
   > path = sys.argv[1]
   > args = sys.argv[2:]
   > assert (len(args) % 2) == 0
   > 
   > f = open(path, 'wb')
   > for i in range(len(args) // 2):
   >count, s = args[2*i:2*i+2]
   >count = int(count)
-  >s = s.decode('string_escape')
+  >s = encode(s)
   >f.write(s*count)
   > f.close()
   > EOF



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


D5668: tests: write directly to stdout to avoid b'' prefixes

2019-01-23 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG84707d9e77a0: tests: write directly to stdout to avoid 
b prefixes (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5668?vs=13380=13386

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

AFFECTED FILES
  tests/test-mq-eol.t

CHANGE DETAILS

diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -30,10 +30,14 @@
 
   $ cat > cateol.py < import sys
+  > try:
+  > stdout = sys.stdout.buffer
+  > except AttributeError:
+  > stdout = sys.stdout
   > for line in open(sys.argv[1], 'rb'):
   > line = line.replace(b'\r', b'')
   > line = line.replace(b'\n', b'')
-  > print(line)
+  > stdout.write(line + b'\n')
   > EOF
 
   $ hg init repo



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


D5664: convert: use raw strings for XML strings

2019-01-23 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1281b2265ff5: convert: use raw strings for XML strings 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5664?vs=13376=13384

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

AFFECTED FILES
  hgext/convert/subversion.py

CHANGE DETAILS

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1183,12 +1183,12 @@
 m = set()
 output = self.run0('ls', recursive=True, xml=True)
 doc = xml.dom.minidom.parseString(output)
-for e in doc.getElementsByTagName('entry'):
+for e in doc.getElementsByTagName(r'entry'):
 for n in e.childNodes:
-if n.nodeType != n.ELEMENT_NODE or n.tagName != 'name':
+if n.nodeType != n.ELEMENT_NODE or n.tagName != r'name':
 continue
-name = ''.join(c.data for c in n.childNodes
-   if c.nodeType == c.TEXT_NODE)
+name = r''.join(c.data for c in n.childNodes
+if c.nodeType == c.TEXT_NODE)
 # Entries are compared with names coming from
 # mercurial, so bytes with undefined encoding. Our
 # best bet is to assume they are in local



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


D5665: tests: normalize XML values to bytes

2019-01-23 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7c54357be2ae: tests: normalize XML values to bytes 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5665?vs=13377=13383

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

AFFECTED FILES
  tests/svnxml.py

CHANGE DETAILS

diff --git a/tests/svnxml.py b/tests/svnxml.py
--- a/tests/svnxml.py
+++ b/tests/svnxml.py
@@ -20,10 +20,10 @@
 if paths:
 paths = paths[0]
 for p in paths.getElementsByTagName('path'):
-action = p.getAttribute('action')
-path = xmltext(p)
-frompath = p.getAttribute('copyfrom-path')
-fromrev = p.getAttribute('copyfrom-rev')
+action = p.getAttribute('action').encode('utf-8')
+path = xmltext(p).encode('utf-8')
+frompath = p.getAttribute('copyfrom-path').encode('utf-8')
+fromrev = p.getAttribute('copyfrom-rev').encode('utf-8')
 e['paths'].append((path, action, frompath, fromrev))
 return e
 
@@ -43,11 +43,11 @@
 for k in ('revision', 'author', 'msg'):
 fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8'))
 for path, action, fpath, frev in sorted(e['paths']):
-frominfo = ''
+frominfo = b''
 if frev:
-frominfo = ' (from %s@%s)' % (fpath, frev)
-p = ' %s %s%s\n' % (action, path, frominfo)
-fp.write(p.encode('utf-8'))
+frominfo = b' (from %s@%s)' % (fpath, frev)
+p = b' %s %s%s\n' % (action, path, frominfo)
+fp.write(p)
 
 if __name__ == '__main__':
 data = sys.stdin.read()



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


D5666: hgweb: ensure template mapping keys are bytes

2019-01-23 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGeff0a7d3229c: hgweb: ensure template mapping keys are bytes 
(authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5666?vs=13378=13382

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

AFFECTED FILES
  mercurial/hgweb/webutil.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -456,13 +456,13 @@
 files = listfilediffs(ctx.files(), n, web.maxfiles)
 
 entry = commonentry(repo, ctx)
-entry.update(
-allparents=_kwfunc(lambda context, mapping: parents(ctx)),
-parent=_kwfunc(lambda context, mapping: parents(ctx, rev - 1)),
-child=_kwfunc(lambda context, mapping: children(ctx, rev + 1)),
-changelogtag=showtags,
-files=files,
-)
+entry.update({
+'allparents': _kwfunc(lambda context, mapping: parents(ctx)),
+'parent': _kwfunc(lambda context, mapping: parents(ctx, rev - 1)),
+'child': _kwfunc(lambda context, mapping: children(ctx, rev + 1)),
+'changelogtag': showtags,
+'files': files,
+})
 return entry
 
 def changelistentries(web, revs, maxcount, parityfn):



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


D5665: tests: normalize XML values to bytes

2019-01-23 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Yes, svn is strongly UTF8.

REPOSITORY
  rHG Mercurial

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

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


Re: Using mercurial on windows.

2019-01-23 Thread Matt Harbison

On Wed, 23 Jan 2019 13:23:44 -0500, Augie Fackler  wrote:





On Jan 9, 2019, at 21:22, Matt Harbison  wrote:

I meant to find a page to describe how to setup MSYS for running tests,  
but everything looked pretty out of date, and I pretty much did the  
setup through the mingw-get GUI.  I've got a fresh Windows install in a  
VM, so maybe I'll get to figuring out what the exact packages are. In  
the meantime, see this:


   https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-June/099953.html  



I've at least linked that thread from the wiki page, and hope to spend  
some time figuring out how to run tests on Windows. Is the buildbot  
using msys or mingw?


I guess mingw?  I've used those interchangeably because the installed  
stuff references both.  The download page for it is on the thread you  
linked.


I did go through and figured out the command line to install the needed  
packages (and they're mostly in the msys section).  It's running the tests  
now, and I'll update that page tomorrow if no problems appear.

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


D5669: tests: support URL quoting on Python 3

2019-01-23 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We could use mercurial.urllibcompat, but meh. This makes things
  easier to read.
  
  The test still fails on Python 3 for some reason. But at least
  we no longer have an exception.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-mq-subrepo-svn.t

CHANGE DETAILS

diff --git a/tests/test-mq-subrepo-svn.t b/tests/test-mq-subrepo-svn.t
--- a/tests/test-mq-subrepo-svn.t
+++ b/tests/test-mq-subrepo-svn.t
@@ -23,10 +23,17 @@
   $ svnadmin create svn-repo-2499
 
   $ SVNREPOPATH=`pwd`/svn-repo-2499/project
+
+#if py3
+  $ pathquoted=`"$PYTHON" -c "import sys, urllib.parse; 
sys.stdout.write(urllib.parse.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#else
+  $ pathquoted=`"$PYTHON" -c "import sys, urllib; 
sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+#endif
+
 #if windows
-  $ SVNREPOURL=file:///`"$PYTHON" -c "import urllib, sys; 
sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+  $ SVNREPOURL=file:///$pathquoted
 #else
-  $ SVNREPOURL=file://`"$PYTHON" -c "import urllib, sys; 
sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"`
+  $ SVNREPOURL=file://$pathquoted
 #endif
 
   $ mkdir -p svn-project-2499/trunk



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


D5668: tests: write directly to stdout to avoid b'' prefixes

2019-01-23 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This enables the test to pass on Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-mq-eol.t

CHANGE DETAILS

diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t
--- a/tests/test-mq-eol.t
+++ b/tests/test-mq-eol.t
@@ -30,10 +30,14 @@
 
   $ cat > cateol.py < import sys
+  > try:
+  > stdout = sys.stdout.buffer
+  > except AttributeError:
+  > stdout = sys.stdout
   > for line in open(sys.argv[1], 'rb'):
   > line = line.replace(b'\r', b'')
   > line = line.replace(b'\n', b'')
-  > print(line)
+  > stdout.write(line + b'\n')
   > EOF
 
   $ hg init repo



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


D5667: tests: handle string escaping/encoding on Python 3

2019-01-23 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This code was failing on Python 3 for a few reasons:
  
  1. sys.argv is str and str doesn't have a .decode()
  2. the "string_escape" encoding was renamed to "unicode_escape"
  
  It is wonky casting to bytes to str to bytes. But this is test
  code, so meh. I don't believe we exercise any code paths in these
  tests where the arguments aren't ascii.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-mq-missingfiles.t
  tests/test-mq-qimport.t

CHANGE DETAILS

diff --git a/tests/test-mq-qimport.t b/tests/test-mq-qimport.t
--- a/tests/test-mq-qimport.t
+++ b/tests/test-mq-qimport.t
@@ -1,14 +1,18 @@
   $ cat > writelines.py < import sys
+  > if sys.version_info[0] >= 3:
+  > encode = lambda x: 
x.encode('utf-8').decode('unicode_escape').encode('utf-8')
+  > else:
+  > encode = lambda x: x.decode('string_escape')
   > path = sys.argv[1]
   > args = sys.argv[2:]
   > assert (len(args) % 2) == 0
   > 
   > f = open(path, 'wb')
   > for i in range(len(args)//2):
   >count, s = args[2*i:2*i+2]
   >count = int(count)
-  >s = s.decode('string_escape')
+  >s = encode(s)
   >f.write(s*count)
   > f.close()
   > 
diff --git a/tests/test-mq-missingfiles.t b/tests/test-mq-missingfiles.t
--- a/tests/test-mq-missingfiles.t
+++ b/tests/test-mq-missingfiles.t
@@ -5,15 +5,19 @@
 
   $ cat > writelines.py < import sys
+  > if sys.version_info[0] >= 3:
+  > encode = lambda x: 
x.encode('utf-8').decode('unicode_escape').encode('utf-8')
+  > else:
+  > encode = lambda x: x.decode('string_escape')
   > path = sys.argv[1]
   > args = sys.argv[2:]
   > assert (len(args) % 2) == 0
   > 
   > f = open(path, 'wb')
   > for i in range(len(args) // 2):
   >count, s = args[2*i:2*i+2]
   >count = int(count)
-  >s = s.decode('string_escape')
+  >s = encode(s)
   >f.write(s*count)
   > f.close()
   > EOF



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


D5666: hgweb: ensure template mapping keys are bytes

2019-01-23 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before, str keys were being added in Python 3 because named
  arguments to dict() use native str for keys. This caused the
  templater to fail to find the keys since it was looking for
  bytes versions.
  
  This makes a handful of tests pass on Python 3.
  
  We may want to consider having the templater validate that keys
  in mapping dicts are bytes. But I'm unsure whether this is
  appropriate and won't be doing this.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/webutil.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -456,13 +456,13 @@
 files = listfilediffs(ctx.files(), n, web.maxfiles)
 
 entry = commonentry(repo, ctx)
-entry.update(
-allparents=_kwfunc(lambda context, mapping: parents(ctx)),
-parent=_kwfunc(lambda context, mapping: parents(ctx, rev - 1)),
-child=_kwfunc(lambda context, mapping: children(ctx, rev + 1)),
-changelogtag=showtags,
-files=files,
-)
+entry.update({
+'allparents': _kwfunc(lambda context, mapping: parents(ctx)),
+'parent': _kwfunc(lambda context, mapping: parents(ctx, rev - 1)),
+'child': _kwfunc(lambda context, mapping: children(ctx, rev + 1)),
+'changelogtag': showtags,
+'files': files,
+})
 return entry
 
 def changelistentries(web, revs, maxcount, parityfn):



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


D5664: convert: use raw strings for XML strings

2019-01-23 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Due to the source transformer, we were passing bytes into the
  XML APIs. This results in not finding elements and doing compares
  against mismatched types.
  
  Use raw string literals so we use str everywhere.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/convert/subversion.py

CHANGE DETAILS

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1183,12 +1183,12 @@
 m = set()
 output = self.run0('ls', recursive=True, xml=True)
 doc = xml.dom.minidom.parseString(output)
-for e in doc.getElementsByTagName('entry'):
+for e in doc.getElementsByTagName(r'entry'):
 for n in e.childNodes:
-if n.nodeType != n.ELEMENT_NODE or n.tagName != 'name':
+if n.nodeType != n.ELEMENT_NODE or n.tagName != r'name':
 continue
-name = ''.join(c.data for c in n.childNodes
-   if c.nodeType == c.TEXT_NODE)
+name = r''.join(c.data for c in n.childNodes
+if c.nodeType == c.TEXT_NODE)
 # Entries are compared with names coming from
 # mercurial, so bytes with undefined encoding. Our
 # best bet is to assume they are in local



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


D5665: tests: normalize XML values to bytes

2019-01-23 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This fixes some type mismatches. The encoding shouldn't matter
  for what this script is used for. UTF-8 seems reasonable, especially
  since I'm pretty sure SVN will emit UTF-8 encoded XML.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/svnxml.py

CHANGE DETAILS

diff --git a/tests/svnxml.py b/tests/svnxml.py
--- a/tests/svnxml.py
+++ b/tests/svnxml.py
@@ -20,10 +20,10 @@
 if paths:
 paths = paths[0]
 for p in paths.getElementsByTagName('path'):
-action = p.getAttribute('action')
-path = xmltext(p)
-frompath = p.getAttribute('copyfrom-path')
-fromrev = p.getAttribute('copyfrom-rev')
+action = p.getAttribute('action').encode('utf-8')
+path = xmltext(p).encode('utf-8')
+frompath = p.getAttribute('copyfrom-path').encode('utf-8')
+fromrev = p.getAttribute('copyfrom-rev').encode('utf-8')
 e['paths'].append((path, action, frompath, fromrev))
 return e
 
@@ -43,11 +43,11 @@
 for k in ('revision', 'author', 'msg'):
 fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8'))
 for path, action, fpath, frev in sorted(e['paths']):
-frominfo = ''
+frominfo = b''
 if frev:
-frominfo = ' (from %s@%s)' % (fpath, frev)
-p = ' %s %s%s\n' % (action, path, frominfo)
-fp.write(p.encode('utf-8'))
+frominfo = b' (from %s@%s)' % (fpath, frev)
+p = b' %s %s%s\n' % (action, path, frominfo)
+fp.write(p)
 
 if __name__ == '__main__':
 data = sys.stdin.read()



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


[Bug 6059] New: `hg files` regression on c2aea007

2019-01-23 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6059

Bug ID: 6059
   Summary: `hg files` regression on c2aea007
   Product: Mercurial
   Version: 4.9rc0
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: lothiral...@gmail.com
CC: mercurial-devel@mercurial-scm.org

Our performance test suite identified an `hg files`  regression on c2aea007

Here are the numbers:

Benchmarks that have got worse:

   before   after ratio
 [197f092b]   [593718ff]
+ 739±4ms  871±5ms 1.18 
time_files('mozilla-central-2018-08-01')
+ 748±7ms  872±5ms 1.17 
time_files('mozilla-central-2018-08-01-sparse-revlog')
+ 353±2ms  399±2ms 1.13  time_files('netbeans-2018-08-01')
+ 352±2ms  397±2ms 1.13 
time_files('netbeans-2018-08-01-sparse-revlog')

I took a quick look at the commit but I don't know if that's an overhead from
the `_isbuffered` call, the additional `ifs` or another part of the change.

This regression is likely to impact others commands but with much less impact
than `hg files`.

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


Re: Using mercurial on windows.

2019-01-23 Thread Augie Fackler


> On Jan 9, 2019, at 21:22, Matt Harbison  wrote:
> 
> I meant to find a page to describe how to setup MSYS for running tests, but 
> everything looked pretty out of date, and I pretty much did the setup through 
> the mingw-get GUI.  I've got a fresh Windows install in a VM, so maybe I'll 
> get to figuring out what the exact packages are. In the meantime, see this:
> 
>
> https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-June/099953.html 
> 

I've at least linked that thread from the wiki page, and hope to spend some 
time figuring out how to run tests on Windows. Is the buildbot using msys or 
mingw?___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5633: grep: use set instead of dict with dummy value

2019-01-23 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D5633#83417, @lothiraldan wrote:
  
  > I get a message stating that one of the hunk of patch failed to apply and 
couldn't understand what is going on, could you try rebase it to see if you 
have the issue locally?
  
  
  Ah, I had forgotten to update the parent revision (this commit depends on 
https://phab.mercurial-scm.org/D5620). I've done that now (and also rebased it).

REPOSITORY
  rHG Mercurial

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

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


D5633: grep: use set instead of dict with dummy value

2019-01-23 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  I get a message stating that one of the hunk of patch failed to apply and 
couldn't understand what is going on, could you try rebase it to see if you 
have the issue locally?

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH STABLE] revlog: fix resolution of revlog version 0

2019-01-23 Thread Augie Fackler
queued, thanks

> On Jan 21, 2019, at 08:48, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1548076469 -32400
> #  Mon Jan 21 22:14:29 2019 +0900
> # Branch stable
> # Node ID 498a5d7f8e19d6b430f300ff6687a92270022f81
> # Parent  13c23396c7fe1633a2336b29e3a32b9b76274f28
> revlog: fix resolution of revlog version 0
> 
> This partially backs out cecf3f8bccd3, "revlog: always process opener 
> options."
> 
> My understanding is that if there's no "revlog1" nor "revlog2" in 
> .hg/requires,
> the repository should stick to the v0 format. The reasoning is briefly
> described in 31a5973fcf96, "revlog: get rid of defversion."
> 
> Maybe we can drop support for missing opener options, but I didn't do that
> in this patch.
> 
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -396,6 +396,11 @@ class revlog(object):
> newversionflags = REVLOGV1 | FLAG_INLINE_DATA
> if 'generaldelta' in opts:
> newversionflags |= FLAG_GENERALDELTA
> +elif getattr(self.opener, 'options', None) is not None:
> +# If options provided but no 'revlog*' found, the repository
> +# would have no 'requires' file in it, which means we have to
> +# stick to the old format.
> +newversionflags = REVLOGV0
> else:
> newversionflags = REVLOG_DEFAULT_VERSION
> 
> diff --git a/tests/test-clone.t b/tests/test-clone.t
> --- a/tests/test-clone.t
> +++ b/tests/test-clone.t
> @@ -717,6 +717,9 @@ Test clone from the repository in (emula
>   $ hg -R src commit -m '#0'
>   $ hg -R src log -q
>   0:e1bab28bca43
> +  $ hg -R src debugrevlog -c | egrep 'format|flags'
> +  format : 0
> +  flags  : (none)
>   $ hg clone -U -q src dst
>   $ hg -R dst log -q
>   0:e1bab28bca43
> ___
> 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 6058] New: clone repo failed

2019-01-23 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6058

Bug ID: 6058
   Summary: clone repo failed
   Product: Mercurial
   Version: 4.8.1
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: michae...@arctrade.com
CC: mercurial-devel@mercurial-scm.org

Starting yesterday we start to have problem clone repo either from bitbucket or
from local. 
we are uinsg 
TortoiseHg
version 4.8.2
with Mercurial-4.8.2, Python-2.7.13, PyQt-5.9.1, Qt-5.9.2

the repo we are having difficulties to clone has around 6600 changeset, not
sure if that is a factor or not. 

the trace log as:

cloning subrepo ArcTrade.Common from
https://bitbucket.org/ArcTrade/hgarctrade.common
applying clone bundle from
https://api.media.atlassian.com/file/a27bbfc8-25f0-4d89-9e08-64deac708bfe/binary?client=8ba980a1-24a3-4554-a806-39d3890d6222=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3MiOnsidXJuOmZpbGVzdG9yZTpmaWxlOmEyN2JiZmM4LTI1ZjAtNGQ4OS05ZTA4LTY0ZGVhYzcwOGJmZSI6WyJyZWFkIl19LCJleHAiOjE1NDgyNjU4NjgsImlzcyI6IjhiYTk4MGExLTI0YTMtNDU1NC1hODA2LTM5ZDM4OTBkNjIyMiIsIm5iZiI6MTU0ODI2NTQ0OH0.2S0Xq0_zglchixhfsq8NwCd5nM0ydM_OlwW2S-z4QVw
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
(sent 3 HTTP requests and 767 bytes; received 928 bytes in responses)
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64
bit (AMD64)]
** Mercurial Distributed SCM (version 4.8.2)
** Extensions loaded: tortoisehg.util.hgcommands,
tortoisehg.util.partialcommit, tortoisehg.util.pipeui,
tortoisehg.util.win32ill, tortoisehg.util.hgdispatch
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64
bit (AMD64)]
** Mercurial Distributed SCM (version 4.8.2)
** Extensions loaded: tortoisehg.util.hgcommands,
tortoisehg.util.partialcommit, tortoisehg.util.pipeui,
tortoisehg.util.win32ill, tortoisehg.util.hgdispatch
Traceback (most recent call last):
  File "hg", line 50, in 
  File "mercurial\dispatch.pyo", line 96, in run
  File "mercurial\dispatch.pyo", line 220, in dispatch
  File "mercurial\dispatch.pyo", line 363, in _runcatch
  File "mercurial\dispatch.pyo", line 371, in _callcatch
  File "mercurial\scmutil.pyo", line 166, in callcatch
  File "mercurial\dispatch.pyo", line 354, in _runcatchfunc
  File "mercurial\dispatch.pyo", line 994, in _dispatch
  File "mercurial\dispatch.pyo", line 737, in runcommand
  File "mercurial\dispatch.pyo", line 1003, in _runcommand
  File "mercurial\dispatch.pyo", line 991, in 
  File "mercurial\util.pyo", line 1644, in check
  File "mercurial\commands.pyo", line 5210, in serve
  File "mercurial\server.pyo", line 147, in runservice
  File "mercurial\commandserver.pyo", line 325, in run
  File "mercurial\commandserver.pyo", line 301, in serve
  File "mercurial\commandserver.pyo", line 276, in serveone
  File "mercurial\commandserver.pyo", line 260, in runcommand
  File "mercurial\dispatch.pyo", line 220, in dispatch
  File "mercurial\dispatch.pyo", line 363, in _runcatch
  File "mercurial\dispatch.pyo", line 371, in _callcatch
  File "mercurial\scmutil.pyo", line 166, in callcatch
  File "mercurial\dispatch.pyo", line 354, in _runcatchfunc
  File "tortoisehg\util\hgdispatch.pyo", line 23, in _dispatch
  File "mercurial\dispatch.pyo", line 994, in _dispatch
  File "mercurial\dispatch.pyo", line 737, in runcommand
  File "mercurial\dispatch.pyo", line 1003, in _runcommand
  File "mercurial\dispatch.pyo", line 991, in 
  File "mercurial\util.pyo", line 1644, in check
  File "mercurial\commands.pyo", line 1557, in clone
  File "mercurial\hg.pyo", line 827, in clone
  File "mercurial\hg.pyo", line 858, in update
  File "mercurial\hg.pyo", line 854, in updaterepo
  File "mercurial\merge.pyo", line 2178, in update
  File "mercurial\merge.pyo", line 1651, in applyupdates
  File "mercurial\subrepoutil.pyo", line 226, in submerge
  File "mercurial\subrepo.pyo", line 75, in decoratedmethod
  File "mercurial\subrepo.pyo", line 681, in get
  File "mercurial\subrepo.pyo", line 665, in _get
  File "mercurial\hg.pyo", line 756, in clone
  File "mercurial\exchange.pyo", line 1524, in pull
  File "mercurial\exchange.pyo", line 2452, in _maybeapplyclonebundle
  File "mercurial\exchange.pyo", line 2648, in trypullbundlefromurl
  File "mercurial\bundle2.pyo", line 353, in applybundle
  File "mercurial\bundle2.pyo", line 460, in processbundle
  File "mercurial\bundle2.pyo", line 467, in processparts
  File "mercurial\bundle2.pyo", line 423, in __exit__
zlib.error: Error -3 while decompressing: invalid literal/length code
cmdserver: process exited 

[PATCH 1 of 2 STABLE V2 STABLE] strip: introduce a soft strip option

2019-01-23 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1539697680 -7200
#  Tue Oct 16 15:48:00 2018 +0200
# Branch stable
# Node ID 4285aa379de0ffdfb68c6a2920a0d09f037dfa2e
# Parent  13c23396c7fe1633a2336b29e3a32b9b76274f28
# EXP-Topic archived-phase-UX
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
4285aa379de0
strip: introduce a soft strip option

This is the first user-accessible way to use the archived phase introduced in
4.8. This implements a feature implemented during the Stockholm sprint. The
archived phase behave as stripping, changesets are no longer accessible, but
pulling/unbundling them will make then reappear. The only notable difference
is that unlike hard stripping, soft stripping does not affect obsmarkers.

Adding flag to strip is a good way to provide access to the feature without
taking a too big risk on the final UI we want.

The next changeset will make use of the archived phase for history rewriting
command. However, having a way to manually trigger the feature first seemed
better.

Using the archived phase is faster and less traumatic for the repository.

diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -76,7 +76,8 @@ def _findupdatetarget(repo, nodes):
 
 return unode
 
-def strip(ui, repo, revs, update=True, backup=True, force=None, 
bookmarks=None):
+def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None,
+  soft=False):
 with repo.wlock(), repo.lock():
 
 if update:
@@ -85,7 +86,10 @@ def strip(ui, repo, revs, update=True, b
 hg.clean(repo, urev)
 repo.dirstate.write(repo.currenttransaction())
 
-repair.strip(ui, repo, revs, backup)
+if soft:
+repair.softstrip(ui, repo, revs, backup)
+else:
+repair.strip(ui, repo, revs, backup)
 
 repomarks = repo._bookmarks
 if bookmarks:
@@ -110,7 +114,10 @@ def strip(ui, repo, revs, update=True, b
   ('k', 'keep', None, _("do not modify working directory during "
 "strip")),
   ('B', 'bookmark', [], _("remove revs only reachable from given"
-  " bookmark"), _('BOOKMARK'))],
+  " bookmark"), _('BOOKMARK')),
+  ('', 'soft', [],
+  _("simply drop changesets from visible history (EXPERIMENTAL)")),
+ ],
   _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
   helpcategory=command.CATEGORY_MAINTENANCE)
 def stripcmd(ui, repo, *revs, **opts):
@@ -235,6 +242,7 @@ def stripcmd(ui, repo, *revs, **opts):
 
 
 strip(ui, repo, revs, backup=backup, update=update,
-  force=opts.get('force'), bookmarks=bookmarks)
+  force=opts.get('force'), bookmarks=bookmarks,
+  soft=opts['soft'])
 
 return 0
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -252,6 +252,24 @@ def strip(ui, repo, nodelist, backup=Tru
 # extensions can use it
 return backupfile
 
+def softstrip(ui, repo, nodelist, backup=True, topic='backup'):
+"""perform a "soft" strip using the archived phase"""
+tostrip = [c.node() for c in repo.set('sort(%ln::)', nodelist)]
+if not tostrip:
+return None
+
+newbmtarget, updatebm = _bookmarkmovements(repo, tostrip)
+if backup:
+node = tostrip[0]
+backupfile = _createstripbackup(repo, tostrip, node, topic)
+
+with repo.transaction('strip') as tr:
+phases.retractboundary(repo, tr, phases.archived, tostrip)
+bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm]
+repo._bookmarks.applychanges(repo, tr, bmchanges)
+return backupfile
+
+
 def _bookmarkmovements(repo, tostrip):
 # compute necessary bookmark movement
 bm = repo._bookmarks
diff --git a/tests/test-phase-archived.t b/tests/test-phase-archived.t
new file mode 100644
--- /dev/null
+++ b/tests/test-phase-archived.t
@@ -0,0 +1,77 @@
+=
+Test features and behaviors related to the archived phase
+=
+
+  $ cat << EOF >> $HGRCPATH
+  > [format]
+  > internal-phase=yes
+  > [extensions]
+  > strip=
+  > [experimental]
+  > EOF
+
+  $ hg init repo
+  $ cd repo
+  $ echo  root > a
+  $ hg add a
+  $ hg ci -m 'root'
+
+Test that bundle can unarchive a changeset
+--
+
+  $ echo foo >> a
+  $ hg st
+  M a
+  $ hg ci -m 'unbundletesting'
+  $ hg log -G
+  @  changeset:   1:883aadbbf309
+  |  tag: tip
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: unbundletesting
+  |
+  o  changeset:   0:c1863a3840c6
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: root
+  
+  

Re: D5496: revset: add "samebranch" keyword argument to the merge revset

2019-01-23 Thread Yuya Nishihara
>   Maybe `anonymous`, defaulting to True?

To all: the default can't be True. It would break the current `merge()`
revset behavior. Only viable choice is to set the default to "don't care".

And I think tri-state bool is confusing in this context. So, IMHO, it's
better to add an argument taking a keyword string specifying constraint
such as `merge(between="a-keyword-to-select-merges-of-named-branches")`.

> That's in the glossary under `Branch, anonymous`, so not technically
> a merge, but I think it still conveys the point.

I disagree. Merges of the same branch are pretty common if your team preferred
merge-based strategy. I wouldn't explicitly call new head pulled from public
repo as an anonymous head.

It can also be wrong if you're using bookmarks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5663: tests: drop a duplicate definition of a constant

2019-01-23 Thread martinvonz (Martin von Zweigbergk)
martinvonz 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/D5663

AFFECTED FILES
  tests/artifacts/scripts/generate-churning-bundle.py

CHANGE DETAILS

diff --git a/tests/artifacts/scripts/generate-churning-bundle.py 
b/tests/artifacts/scripts/generate-churning-bundle.py
--- a/tests/artifacts/scripts/generate-churning-bundle.py
+++ b/tests/artifacts/scripts/generate-churning-bundle.py
@@ -42,7 +42,6 @@
 FILENAME='SPARSE-REVLOG-TEST-FILE'
 NB_LINES = 10500
 ALWAYS_CHANGE_LINES = 500
-FILENAME = 'SPARSE-REVLOG-TEST-FILE'
 OTHER_CHANGES = 300
 
 def nextcontent(previous_content):



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