D278: tests: make test-highlight code portable to python3

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


  LGTM.

REPOSITORY
  rHG Mercurial

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

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


D290: bundlerepo: move bundle2 part handling out to a function

2017-08-08 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This moves the bundle2 part handling for bundlerepo out to a separate function
  so extensions can participate in bundlerepo setup when using bundle2 bundles.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -283,26 +283,18 @@
 self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlename)
 
 if isinstance(self.bundle, bundle2.unbundle20):
-cgstream = None
+hadchangegroup = False
 for part in self.bundle.iterparts():
 if part.type == 'changegroup':
-if cgstream is not None:
+if hadchangegroup:
 raise NotImplementedError("can't process "
   "multiple changegroups")
-cgstream = part
-version = part.params.get('version', '01')
-legalcgvers = changegroup.supportedincomingversions(self)
-if version not in legalcgvers:
-msg = _('Unsupported changegroup version: %s')
-raise error.Abort(msg % version)
-if self.bundle.compressed():
-cgstream = self._writetempbundle(part.read,
- ".cg%sun" % version)
+hadchangegroup = True
 
-if cgstream is None:
-raise error.Abort(_('No changegroups found'))
+self._handlebundle2part(part)
 
-self.bundle = changegroup.getunbundler(version, cgstream, 'UN')
+if not hadchangegroup:
+raise error.Abort(_("No changegroups found"))
 
 elif self.bundle.compressed():
 f = self._writetempbundle(self.bundle.read, '.hg10un',
@@ -318,6 +310,20 @@
 phases.retractboundary(self, None, phases.draft,
[ctx.node() for ctx in self[self.firstnewrev:]])
 
+def _handlebundle2part(self, part):
+if part.type == 'changegroup':
+cgstream = part
+version = part.params.get('version', '01')
+legalcgvers = changegroup.supportedincomingversions(self)
+if version not in legalcgvers:
+msg = _('Unsupported changegroup version: %s')
+raise error.Abort(msg % version)
+if self.bundle.compressed():
+cgstream = self._writetempbundle(part.read,
+ ".cg%sun" % version)
+
+self.bundle = changegroup.getunbundler(version, cgstream, 'UN')
+
 def _writetempbundle(self, read, suffix, header=''):
 """Write a temporary file to disk
 



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


D289: bundle2: seek part back during iteration

2017-08-08 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously, iterparts would yield the part to users, then consume the part. 
This
  changed the part after the user was given it and left it at the end, both of
  which seem unexpected.  Let's seek back to the beginning after we've consumed
  it. I tried not seeking to the end at all, but that seems important for the
  overall bundle2 consumption.
  
  This is used in a future patch to let us move the bundlerepo
  bundle2-changegroup-part to be handled entirely within the for loop, instead 
of
  having to do a seek back to 0 after the entire loop finishes.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -301,7 +301,6 @@
 
 if cgstream is None:
 raise error.Abort(_('No changegroups found'))
-cgstream.seek(0)
 
 self.bundle = changegroup.getunbundler(version, cgstream, 'UN')
 
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -805,7 +805,11 @@
 while headerblock is not None:
 part = unbundlepart(self.ui, headerblock, self._fp)
 yield part
+# Seek to the end of the part to force it's consumption so the next
+# part can be read. But then seek back to the beginning so the
+# code consuming this generator has a part that starts at 0.
 part.seek(0, 2)
+part.seek(0)
 headerblock = self._readpartheader()
 indebug(self.ui, 'end of bundle2 stream')
 



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


D288: bundlerepo: move temp bundle creation to a separate function

2017-08-08 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  A future patch will refactor certain parts of bundlerepo initiatlization such
  that we need to create temp bundles from another function. Let's move this to
  another function to support that.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -264,24 +264,6 @@
 
 class bundlerepository(localrepo.localrepository):
 def __init__(self, ui, path, bundlename):
-def _writetempbundle(read, suffix, header=''):
-"""Write a temporary file to disk
-
-This is closure because we need to make sure this tracked by
-self.tempfile for cleanup purposes."""
-fdtemp, temp = self.vfs.mkstemp(prefix="hg-bundle-",
-suffix=".hg10un")
-self.tempfile = temp
-
-with os.fdopen(fdtemp, pycompat.sysstr('wb')) as fptemp:
-fptemp.write(header)
-while True:
-chunk = read(2**18)
-if not chunk:
-break
-fptemp.write(chunk)
-
-return self.vfs.open(self.tempfile, mode="rb")
 self._tempparent = None
 try:
 localrepo.localrepository.__init__(self, ui, path)
@@ -314,17 +296,18 @@
 msg = _('Unsupported changegroup version: %s')
 raise error.Abort(msg % version)
 if self.bundle.compressed():
-cgstream = _writetempbundle(part.read,
-".cg%sun" % version)
+cgstream = self._writetempbundle(part.read,
+ ".cg%sun" % version)
 
 if cgstream is None:
 raise error.Abort(_('No changegroups found'))
 cgstream.seek(0)
 
 self.bundle = changegroup.getunbundler(version, cgstream, 'UN')
 
 elif self.bundle.compressed():
-f = _writetempbundle(self.bundle.read, '.hg10un', header='HG10UN')
+f = self._writetempbundle(self.bundle.read, '.hg10un',
+  header='HG10UN')
 self.bundlefile = self.bundle = exchange.readbundle(ui, f,
 bundlename,
 self.vfs)
@@ -336,6 +319,25 @@
 phases.retractboundary(self, None, phases.draft,
[ctx.node() for ctx in self[self.firstnewrev:]])
 
+def _writetempbundle(self, read, suffix, header=''):
+"""Write a temporary file to disk
+
+This is closure because we need to make sure this tracked by
+self.tempfile for cleanup purposes."""
+fdtemp, temp = self.vfs.mkstemp(prefix="hg-bundle-",
+suffix=".hg10un")
+self.tempfile = temp
+
+with os.fdopen(fdtemp, pycompat.sysstr('wb')) as fptemp:
+fptemp.write(header)
+while True:
+chunk = read(2**18)
+if not chunk:
+break
+fptemp.write(chunk)
+
+return self.vfs.open(self.tempfile, mode="rb")
+
 @localrepo.unfilteredpropertycache
 def _phasecache(self):
 return bundlephasecache(self, self._phasedefaults)



To: durham, #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-08 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG511d6ae462f3: template: rename troubles templatekw into 
instabilities (authored by lothiraldan).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D237?vs=582=653

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, indygreg
Cc: 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-08 Thread quark (Jun Wu)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG71b77b61ed60: test-rebase: add a brute force test (authored 
by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D262?vs=607=652

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: lothiraldan, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D269: dirstate: simplify and speed up dirstate's __iter__

2017-08-08 Thread alex_gaynor (Alex Gaynor)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG36d216dcae6a: dirstate: simplify dirstate's __iter__ 
(authored by alex_gaynor).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D269?vs=634=651

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -359,8 +359,7 @@
 return key in self._map
 
 def __iter__(self):
-for x in sorted(self._map):
-yield x
+return iter(sorted(self._map))
 
 def items(self):
 return self._map.iteritems()



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


D278: tests: make test-highlight code portable to python3

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

REVISION SUMMARY
  This is easier than trying to do some sort of check-code shenanigans.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-highlight.t

CHANGE DETAILS

diff --git a/tests/test-highlight.t b/tests/test-highlight.t
--- a/tests/test-highlight.t
+++ b/tests/test-highlight.t
@@ -49,7 +49,7 @@
   > except (ValueError, IndexError):
   > n = 10
   > p = primes()
-  > print "The first %d primes: %s" % (n, list(islice(p, n)))
+  > print("The first %d primes: %s" % (n, list(islice(p, n
   > EOF
   $ echo >> primes.py  # to test html markup with an empty line just before EOF
   $ hg ci -Ama
@@ -74,7 +74,7 @@
   
   
   
-  test: 1af356141006 primes.py
+  test: f4fca47b67e6 primes.py
   
   
   
@@ -112,7 +112,7 @@
   
   Mercurial 
   
-   view primes.py @ 0:1af356141006
+   view primes.py @ 0:f4fca47b67e6
tip 
   
   
@@ -182,7 +182,7 @@
   except (ValueError, 
IndexError):
   n = 
10
   p = primes()
-  print The 
first %d primes: %s % 
(n, list(islice(p, n)))
+  print(The first %d primes: %s % 
(n, list(islice(p, n
   
   
   
@@ -251,7 +251,7 @@
   
   Mercurial 
   
-   annotate primes.py @ 0:1af356141006
+   annotate primes.py @ 0:f4fca47b67e6
tip 
   
   
@@ -299,19 +299,19 @@
 
   
   
-  
+  
   0
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
1 Fun with generators. Corresponding Haskell 
implementation:
@@ -321,14 +321,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
2 
@@ -338,14 +338,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
3 primes = 2 : sieve [3, 5..]
@@ -355,14 +355,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
4 where sieve (p:ns) = p : sieve [n | n - ns, mod n p /= 
0]
@@ -372,14 +372,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
5 
@@ -389,14 +389,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
6 
@@ -406,14 +406,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
7 from itertools import dropwhile, ifilter, islice, count, chain
@@ -423,14 +423,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
8 
@@ -440,14 +440,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
9 def primes():
@@ -457,14 +457,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   10 
Generate all 
primes.
@@ -474,14 +474,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   11 
def sieve(ns):
@@ -491,14 +491,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   12 
p = ns.next()
@@ -508,14 +508,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   13 
# It is important to yield *here* in order to stop 
the
@@ -525,14 +525,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   14 
# infinite recursion.
@@ -542,14 +542,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   15 
yield p
@@ -559,14 +559,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   16 
ns = ifilter(lambda 
n: n % p != 0, ns)
@@ -576,14 +576,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   17 
for n in 
sieve(ns):
@@ -593,14 +593,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
   18  
   yield n
@@ -610,14 +610,14 @@
   
   
   
-  
-  1af356141006
+  
+  f4fca47b67e6
   a
   
   
   parents: 
-  diff
-  changeset
+  diff
+  changeset
   
   
  

D279: tests: fix test-notify.t to use $PYTHON

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

REVISION SUMMARY
  In doing so, I consolidated the filtering logic. This resulted in some
  small test output changes, but I think the consistency throughout the
  test is worth it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-notify.t

CHANGE DETAILS

diff --git a/tests/test-notify.t b/tests/test-notify.t
--- a/tests/test-notify.t
+++ b/tests/test-notify.t
@@ -1,3 +1,8 @@
+  $ cat > $TESTTMP/filter.py < from __future__ import print_function
+  > import sys, re
+  > print(re.sub("\n[ \t]", " ", sys.stdin.read()), end="")
+  > EOF
 
   $ cat <> $HGRCPATH
   > [extensions]
@@ -175,8 +180,7 @@
 of the very long subject line
 pull (minimal config)
 
-  $ hg --traceback --cwd b pull ../a | \
-  >   $PYTHON -c 'import sys,re; print re.sub("\n[\t ]", " ", 
sys.stdin.read()),'
+  $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py
   pulling from ../a
   searching for changes
   adding changesets
@@ -205,6 +209,7 @@
   @@ -1,1 +1,2 @@ a
   +a
   (run 'hg update' to get a working copy)
+
   $ cat <> $HGRCPATH
   > [notify]
   > config = `pwd`/.notify.conf
@@ -228,8 +233,7 @@
 
   $ hg --cwd b rollback
   repository tip rolled back to revision 0 (undo pull)
-  $ hg --traceback --cwd b pull ../a  | \
-  >   $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
+  $ hg --traceback --cwd b pull ../a  | $PYTHON $TESTTMP/filter.py
   pulling from ../a
   searching for changes
   adding changesets
@@ -254,8 +258,7 @@
   diff -r cb9a9f314b8b -r 0647d048b600 a
   --- a/a  Thu Jan 01 00:00:00 1970 +
   +++ b/a  Thu Jan 01 00:00:01 1970 +
-  @@ -1,1 +1,2 @@
-   a
+  @@ -1,1 +1,2 @@ a
   +a
   (run 'hg update' to get a working copy)
 
@@ -272,8 +275,7 @@
 
   $ hg --cwd b rollback
   repository tip rolled back to revision 0 (undo pull)
-  $ hg --traceback --cwd b pull ../a | \
-  >   $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
+  $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py
   pulling from ../a
   searching for changes
   adding changesets
@@ -294,17 +296,14 @@
   changeset 0647d048b600 in b
   description: b
   diffstat:
-  
-   a |  1 +
-   1 files changed, 1 insertions(+), 0 deletions(-)
+   a |  1 + 1 files changed, 1 insertions(+), 0 deletions(-)
   
   diffs (6 lines):
   
   diff -r cb9a9f314b8b -r 0647d048b600 a
   --- a/a  Thu Jan 01 00:00:00 1970 +
   +++ b/a  Thu Jan 01 00:00:01 1970 +
-  @@ -1,1 +1,2 @@
-   a
+  @@ -1,1 +1,2 @@ a
   +a
   (run 'hg update' to get a working copy)
 
@@ -321,8 +320,7 @@
   (branch merge, don't forget to commit)
   $ hg ci -m merge -d '3 0'
   $ cd ..
-  $ hg --traceback --cwd b pull ../a | \
-  >   $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
+  $ hg --traceback --cwd b pull ../a | $PYTHON $TESTTMP/filter.py
   pulling from ../a
   searching for changes
   adding changesets
@@ -343,17 +341,14 @@
   changeset 0a184ce6067f in b
   description: adda2
   diffstat:
-  
-   a |  1 +
-   1 files changed, 1 insertions(+), 0 deletions(-)
+   a |  1 + 1 files changed, 1 insertions(+), 0 deletions(-)
   
   diffs (6 lines):
   
   diff -r cb9a9f314b8b -r 0a184ce6067f a
   --- a/a  Thu Jan 01 00:00:00 1970 +
   +++ b/a  Thu Jan 01 00:00:02 1970 +
-  @@ -1,1 +1,2 @@
-   a
+  @@ -1,1 +1,2 @@ a
   +a
   Content-Type: text/plain; charset="us-ascii"
   MIME-Version: 1.0
@@ -380,7 +375,7 @@
   $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
   >   -m `$PYTHON -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'`
   $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
-  >   $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
+  >   $PYTHON $TESTTMP/filter.py
   pulling from ../a
   searching for changes
   adding changesets
@@ -401,18 +396,14 @@
   changeset 7ea05ad269dc in b
   description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc)
   diffstat:
-  
-   a |  1 +
-   1 files changed, 1 insertions(+), 0 deletions(-)
+   a |  1 + 1 files changed, 1 insertions(+), 0 deletions(-)
   
   diffs (7 lines):
   
   diff -r 6a0cf76b2701 -r 7ea05ad269dc a
   --- a/a  Thu Jan 01 00:00:03 1970 +
   +++ b/a  Thu Jan 01 00:00:00 1970 +
-  @@ -1,2 +1,3 @@
-   a
-   a
+  @@ -1,2 +1,3 @@ a a
   +a
   (run 'hg update' to get a working copy)
 
@@ -435,7 +426,7 @@
   added 1 changesets with 1 changes to 1 files
   notify: sending 2 subscribers 1 changes
   (run 'hg update' to get a working copy)
-  $ $PYTHON -c 'import sys,re; print re.sub("\n\t", " ", 
file("b/mbox").read()),'
+  $ $PYTHON $TESTTMP/filter.py < b/mbox
   From t...@test.com ... ... .. ..:..:..  (re)
   Content-Type: text/plain; charset="us-ascii"
   MIME-Version: 1.0
@@ -451,19 +442,14 @@
   changeset e0be44cf638b in b
   description: long line
   diffstat:
-  
-   a |  1 +
- 

D271: obsolete: use bytestr() instead of str() so the node is bytes on py3

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

REVISION SUMMARY
  I'm not sure this is right, since this should either be bytes or str
  to match what's going on in the revlog layer.

REPOSITORY
  rHG Mercurial

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

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
@@ -79,6 +79,7 @@
 obsutil,
 phases,
 policy,
+pycompat,
 util,
 )
 
@@ -583,7 +584,8 @@
 
 metadata = tuple(sorted(metadata.iteritems()))
 
-marker = (str(prec), tuple(succs), int(flag), metadata, date, parents)
+prec = bytes(pycompat.bytestr(prec))
+marker = (prec, tuple(succs), int(flag), metadata, date, parents)
 return bool(self.add(transaction, [marker]))
 
 def add(self, transaction, markers):



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


D277: dagparser: make print statement in doctest Py3 portable

2017-08-08 Thread durin42 (Augie Fackler)
durin42 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/D277

AFFECTED FILES
  mercurial/dagparser.py

CHANGE DETAILS

diff --git a/mercurial/dagparser.py b/mercurial/dagparser.py
--- a/mercurial/dagparser.py
+++ b/mercurial/dagparser.py
@@ -156,7 +156,7 @@
 Error:
 
 >>> try: list(parsedag('+1 bad'))
-... except Exception, e: print e
+... except Exception, e: print(e)
 invalid character in dag description: bad...
 
 '''



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


D276: i18n: fix check-translation.py to be less broken on Python 3

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

REVISION SUMMARY
  These are all simple one-argument print statements, so this syntax
  works the same way in 2 and 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  i18n/check-translation.py

CHANGE DETAILS

diff --git a/i18n/check-translation.py b/i18n/check-translation.py
--- a/i18n/check-translation.py
+++ b/i18n/check-translation.py
@@ -51,7 +51,7 @@
 ... msgstr='prompt  missing $$missing  amp$$followed by none&')
 >>> match(promptchoice, pe)
 True
->>> for e in promptchoice(pe): print e
+>>> for e in promptchoice(pe): print(e)
 number of choices differs between msgid and msgstr
 msgstr has invalid choice missing '&'
 msgstr has invalid '&' followed by none
@@ -88,19 +88,19 @@
 ... msgstr= 'something (DEPRECATED)')
 >>> match(deprecated, pe)
 True
->>> for e in deprecated(pe): print e
+>>> for e in deprecated(pe): print(e)
 >>> pe = polib.POEntry(
 ... msgid = 'Something (DEPRECATED)',
 ... msgstr= 'something (DETACERPED)')
 >>> match(deprecated, pe)
 True
->>> for e in deprecated(pe): print e
+>>> for e in deprecated(pe): print(e)
 >>> pe = polib.POEntry(
 ... msgid = 'Something (DEPRECATED)',
 ... msgstr= 'something')
 >>> match(deprecated, pe)
 True
->>> for e in deprecated(pe): print e
+>>> for e in deprecated(pe): print(e)
 msgstr inconsistently translated (DEPRECATED)
 >>> pe = polib.POEntry(
 ... msgid = 'Something (DEPRECATED, foo bar)',
@@ -124,16 +124,16 @@
 >>> pe = polib.POEntry(
 ... msgid ='ends with ::',
 ... msgstr='ends with ::')
->>> for e in taildoublecolons(pe): print e
+>>> for e in taildoublecolons(pe): print(e)
 >>> pe = polib.POEntry(
 ... msgid ='ends with ::',
 ... msgstr='ends without double-colons')
->>> for e in taildoublecolons(pe): print e
+>>> for e in taildoublecolons(pe): print(e)
 tail '::'-ness differs between msgid and msgstr
 >>> pe = polib.POEntry(
 ... msgid ='ends without double-colons',
 ... msgstr='ends with ::')
->>> for e in taildoublecolons(pe): print e
+>>> for e in taildoublecolons(pe): print(e)
 tail '::'-ness differs between msgid and msgstr
 """
 if pe.msgid.endswith('::') != pe.msgstr.endswith('::'):
@@ -149,7 +149,7 @@
 >>> pe = polib.POEntry(
 ... msgid ='indented text',
 ... msgstr='  narrowed indentation')
->>> for e in indentation(pe): print e
+>>> for e in indentation(pe): print(e)
 initial indentation width differs betweeen msgid and msgstr
 """
 idindent = len(pe.msgid) - len(pe.msgid.lstrip())



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


D274: obsutil: defend against succsmarkers() returning None

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

REVISION SUMMARY
  I'm not sure if this is a realistic problem, but doing this avoids
  some pretty awful test failures on Python 3, and it looks like it
  should be harmless.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/obsutil.py

CHANGE DETAILS

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -307,7 +307,7 @@
 seenrevs.add(rev)
 if phase(repo, rev) == public:
 continue
-if set(succsmarkers(node)).issubset(addedmarkers):
+if set(succsmarkers(node) or []).issubset(addedmarkers):
 obsoleted.add(rev)
 return obsoleted
 



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


D275: ui: refactor extractchoices so it doesn't break on Python 3

2017-08-08 Thread durin42 (Augie Fackler)
durin42 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/D275

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1269,9 +1269,10 @@
 m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt)
 msg = m.group(1)
 choices = [p.strip(' ') for p in m.group(2).split('$$')]
-return (msg,
-[(s[s.index('&') + 1].lower(), s.replace('&', '', 1))
- for s in choices])
+def choicetuple(s):
+ampidx = s.index('&')
+return s[ampidx + 1:ampidx + 2].lower(), s.replace('&', '', 1)
+return (msg, [choicetuple(s) for s in choices])
 
 def promptchoice(self, prompt, default=0):
 """Prompt user with a message, read response, and ensure it matches



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


D272: bundle2: convert ints to strings using pycompat.bytestring()

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

REVISION SUMMARY
  Fixes some Python 3 regressions.
  
  We don't use %d here because the part id is actually an
  Optional[int]. It should always be initialized to a non-None value by
  the time this code executes, but we shouldn't blindly depend on that
  being the case.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1000,7 +1000,7 @@
 parttype = self.type.upper()
 else:
 parttype = self.type.lower()
-outdebug(ui, 'part %s: "%s"' % (self.id, parttype))
+outdebug(ui, 'part %s: "%s"' % (pycompat.bytestr(self.id), parttype))
 ## parttype
 header = [_pack(_fparttypesize, len(parttype)),
   parttype, _pack(_fpartid, self.id),
@@ -1239,7 +1239,7 @@
 self.type = self._fromheader(typesize)
 indebug(self.ui, 'part type: "%s"' % self.type)
 self.id = self._unpackheader(_fpartid)[0]
-indebug(self.ui, 'part id: "%s"' % self.id)
+indebug(self.ui, 'part id: "%s"' % pycompat.bytestr(self.id))
 # extract mandatory bit from type
 self.mandatory = (self.type != self.type.lower())
 self.type = self.type.lower()



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


D270: tests: fix up test-run-tests failures on Python 3.6

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

REVISION SUMMARY
  Some of the recent work on run-tests.py didn't work on Python 3. This
  fixes the regressions.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.py

CHANGE DETAILS

diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py
--- a/tests/test-run-tests.py
+++ b/tests/test-run-tests.py
@@ -39,7 +39,7 @@
 and output.endswith(b'\n')), 'missing newline'
 assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \
b'single backslash or unknown char'
-test = run_tests.TTest('test-run-test.t', '.', '.')
+test = run_tests.TTest(b'test-run-test.t', b'.', b'.')
 match = test.linematch(expected, output)
 if isinstance(match, str):
 return 'special: ' + match
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -105,9 +105,13 @@
 PYTHON3 = True
 xrange = range # we use xrange in one place, and we'd rather not use range
 def _bytespath(p):
+if p is None:
+return p
 return p.encode('utf-8')
 
 def _strpath(p):
+if p is None:
+return p
 return p.decode('utf-8')
 
 elif sys.version_info >= (3, 0, 0):
@@ -1383,7 +1387,8 @@
 else:
 m = optline.match(el)
 if m:
-conditions = [c for c in m.group(2).split(' ')]
+conditions = [
+c for c in m.group(2).split(b' ')]
 
 if not self._hghave(conditions)[0]:
 optional.append(i)
@@ -1497,7 +1502,7 @@
 else:
 m = optline.match(el)
 if m:
-conditions = [c for c in m.group(2).split(' ')]
+conditions = [c for c in m.group(2).split(b' ')]
 
 el = m.group(1) + b"\n"
 if not self._hghave(conditions)[0]:



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


D273: changegroup: more **kwargs

2017-08-08 Thread durin42 (Augie Fackler)
durin42 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/D273

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -390,13 +390,13 @@
 if clstart >= len(repo):
 return
 
-repo.hook("changegroup", **hookargs)
+repo.hook("changegroup", **pycompat.strkwargs(hookargs))
 
 for n in added:
 args = hookargs.copy()
 args['node'] = hex(n)
 del args['node_last']
-repo.hook("incoming", **args)
+repo.hook("incoming", **pycompat.strkwargs(args))
 
 newheads = [h for h in repo.heads()
 if h not in oldheads]



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


D269: dirstate: simplify and speed up dirstate's __iter__

2017-08-08 Thread alex_gaynor (Alex Gaynor)
alex_gaynor created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  simplify-iter (bookmark) on default (branch)

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -359,8 +359,7 @@
 return key in self._map
 
 def __iter__(self):
-for x in sorted(self._map):
-yield x
+return iter(sorted(self._map))
 
 def items(self):
 return self._map.iteritems()



To: alex_gaynor, durin42, #hg-reviewers
Cc: 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-08 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG01a1c4e66816: repo: skip invalidation of changelog if it 
has 'delayed' changes (API) (authored by martinvonz).

REPOSITORY
  rHG Mercurial

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

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
@@ -1461,6 +1461,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


D219: morestatus: move fb extension to core by plugging to `hg status --verbose`

2017-08-08 Thread durin42 (Augie Fackler)
durin42 accepted this revision as: durin42.
durin42 added a comment.


  I'm still a tiny bit worried about potential confusion between --terse and 
--verbose (in that they're not opposites), but I'm also fine with this. I'll 
take it in a couple of days if I don't hear any objections.

REPOSITORY
  rHG Mercurial

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

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


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

2017-08-08 Thread Boris Feld
On Wed, 2017-08-09 at 00:19 +0900, Yuya Nishihara wrote:
> On Mon, 07 Aug 2017 16:56:23 +0200, Boris Feld wrote:
> > # 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
> 
> (Only reviewed the template stuff, since I haven't got so involved in
> obsolete
> naming, the operation metadata, etc.)
> 
> > +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)
> 
> I think returning a list of successor nodes is more natural.
> 
> Can we theoretically gather the relevant markers from successor
> nodes?
> If the "markers" field serves just as a cache, it could be stored in
> revcache[] and passed to obsfate() under the hood.

The current algorithm for computing the successors sets of a changeset
is this one:

Walk the obs-marker graph starting at a given revision. Follow
successors of each revisions walked until revisions has no more
successors, they are stable and they are the tip-most successor of the
initial revision.

Having the sets of successors doesn't helps because a successor could
be successor for more than one obsolete revision (fold for example).

The list of markers between a revisions and its successors could be
cached, I'm not sure how to use revcache for that. Did you meant
returning a hybrid object like this one, with a non-null revcache
parameter: https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/tem
platekw.py#l641?

> 
> > +@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'])
> 
> It has to check the number and types of the arguments. And please use
> evalfuncarg().

Thank you, I was looking for a cleaner way to do it. I will send a V2
after I fixed the return value of showsuccsandmarkers. 

I will send a separate series to clean join, I used it as example.

> 
> > +_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, ', ')
> 
> [...]
> 
> > +  |/ Obsfate: [{"markers":
> > [["\udca4h\u071b63\udc8b\u0014\udcfd\udcb7\udc82_U\udcce=\udcf4\udc
> > e7\u0015\u0017\udcad"
> 
> Ugh, binary in JSON. This is one reason why I think raw "markers"
> shouldn't
> be exposed.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Mercurial 4.4 sprint: September 29-October 1 at Facebook Dublin

2017-08-08 Thread Siddharth Agarwal

Hi everyone,

I'm happy to announce that the Mercurial 4.4 sprint will be held from 
September 29-October 1, 2017, at Facebook Dublin in Ireland.


For more details and to mark your attendance and suggest topics, please 
see https://www.mercurial-scm.org/wiki/4.4sprint.


Thanks,
Siddharth

___
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-08 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> dsp wrote in obsutil.py:210
> should this be called `predecessormarkers`?

Ideally yes.

I wanted to limit this series to external impacting changes only (either output 
or API changes) so extensions and tests could be updated once and for all.

I plan to do variables renaming in a later series as they won't involve test 
changing or extensions breaking.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers
Cc: dsp, 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-08 Thread dsp (David Soria Parra)
dsp added inline comments.

INLINE COMMENTS

> obsutil.py:210
>  nm = unfi.changelog.nodemap
> -precursorsmarkers = unfi.obsstore.precursors
> +precursorsmarkers = unfi.obsstore.predecessors
>  successormarkers = unfi.obsstore.successors

should this be called `predecessormarkers`?

REPOSITORY
  rHG Mercurial

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

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


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

2017-08-08 Thread Yuya Nishihara
On Mon, 07 Aug 2017 16:56:23 +0200, Boris Feld wrote:
> # 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

(Only reviewed the template stuff, since I haven't got so involved in obsolete
naming, the operation metadata, etc.)

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

I think returning a list of successor nodes is more natural.

Can we theoretically gather the relevant markers from successor nodes?
If the "markers" field serves just as a cache, it could be stored in
revcache[] and passed to obsfate() under the hood.

> +@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'])

It has to check the number and types of the arguments. And please use
evalfuncarg().

> +_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, ', ')

[...]

> +  |/ Obsfate: [{"markers": 
> [["\udca4h\u071b63\udc8b\u0014\udcfd\udcb7\udc82_U\udcce=\udcf4\udce7\u0015\u0017\udcad"

Ugh, binary in JSON. This is one reason why I think raw "markers" shouldn't
be exposed.
___
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-08 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGda3087b8f4a2: localrepo: remove unused requirements 
attributes on localpeer (API) (authored by indygreg).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D266?vs=616=630

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


D265: exchange: access requirements on repo instead of peer

2017-08-08 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG033484935391: exchange: access requirements on repo instead 
of peer (authored by indygreg).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D265?vs=615=629

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
@@ -1226,8 +1226,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


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

2017-08-08 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG73fd395ee29e: httppeer: make several instance attributes 
internal (API) (authored by indygreg).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D268?vs=618=632

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


D267: httppeer: remove unused handler attribute

2017-08-08 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc0b317cfecc8: httppeer: remove unused handler attribute 
(authored by indygreg).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D267?vs=617=631

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


D231: httppeer: add support for httppostargs when we're sending a file

2017-08-08 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> martinvonz wrote in httppeer.py:96
> It doesn't matter much since it's just a programming error if it happens, but 
> how will these arguments to ValueError be rendered?

ValueError: ('_multifile only supports file objects that have a length but this 
one does not:', , )

It ain't pretty, but it's got all the information we need.

> martinvonz wrote in httppeer.py:111
> nit: i think this can be "if got <= amt" to avoid an unnecessary 0-length 
> read the next time _multifile.read() (and it does look like that will be the 
> normal case, that the reader will read exactly the size of the first "file" 
> first)

No, because consider these file buffers:

'foo', 'bar'

if we read(2), we'll pull 2 bytes off the first buffer, which is not yet 
exhausted, but got == amt.

REPOSITORY
  rHG Mercurial

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

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


D231: httppeer: add support for httppostargs when we're sending a file

2017-08-08 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 627.
durin42 marked 3 inline comments as done.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D231?vs=559=627

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

AFFECTED FILES
  mercurial/hgweb/protocol.py
  mercurial/httppeer.py

CHANGE DETAILS

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -9,6 +9,7 @@
 from __future__ import absolute_import
 
 import errno
+import io
 import os
 import socket
 import struct
@@ -86,6 +87,45 @@
 
 resp.__class__ = readerproxy
 
+class _multifile(object):
+def __init__(self, *fileobjs):
+for f in fileobjs:
+if not util.safehasattr(f, 'length'):
+raise ValueError(
+'_multifile only supports file objects that '
+'have a length but this one does not:', type(f), f)
+self._fileobjs = fileobjs
+self._index = 0
+
+@property
+def length(self):
+return sum(f.length for f in self._fileobjs)
+
+def read(self, amt=None):
+if amt <= 0:
+return ''.join(f.read() for f in self._fileobjs)
+parts = []
+while amt and self._index < len(self._fileobjs):
+parts.append(self._fileobjs[self._index].read(amt))
+got = len(parts[-1])
+if got < amt:
+self._index += 1
+amt -= got
+return ''.join(parts)
+
+def seek(self, offset, whence=os.SEEK_SET):
+if whence != os.SEEK_SET:
+raise NotImplementedError(
+'_multifile does not support anything other'
+' than os.SEEK_SET for whence on seek()')
+if offset != 0:
+raise NotImplementedError(
+'_multifile only supports seeking to start, but that '
+'could be fixed if you need it')
+for f in self._fileobjs:
+f.seek(0)
+self._index = 0
+
 class httppeer(wireproto.wirepeer):
 def __init__(self, ui, path):
 self.path = path
@@ -149,17 +189,19 @@
 # with infinite recursion when trying to look up capabilities
 # for the first time.
 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)
-if postargsok and canmungedata:
+if postargsok and args:
 strargs = urlreq.urlencode(sorted(args.items()))
-if strargs:
-if not data:
-data = strargs
-elif isinstance(data, basestring):
-data = strargs + data
-headers['X-HgArgs-Post'] = len(strargs)
+if not data:
+data = strargs
+else:
+if isinstance(data, basestring):
+i = io.BytesIO(data)
+i.length = len(data)
+data = i
+argsio = io.BytesIO(strargs)
+argsio.length = len(strargs)
+data = _multifile(argsio, data)
+headers['X-HgArgs-Post'] = len(strargs)
 else:
 if len(args) > 0:
 httpheader = self.capable('httpheader')
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -75,6 +75,9 @@
 return args
 def getfile(self, fp):
 length = int(self.req.env['CONTENT_LENGTH'])
+# If httppostargs is used, we need to read Content-Length
+# minus the amount that was consumed by args.
+length -= int(self.req.env.get('HTTP_X_HGARGS_POST', 0))
 for s in util.filechunkiter(self.req, limit=length):
 fp.write(s)
 def redirect(self):



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


[PATCH 6 of 6] encoding: drop circular import by proxying through '.charencode'

2017-08-08 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1501510427 -32400
#  Mon Jul 31 23:13:47 2017 +0900
# Node ID 0299b63e488b11ff46208b7bb7fd1efe3a797a37
# Parent  6713774405f9b183f5500f65901f1dadbbd4639a
encoding: drop circular import by proxying through '.charencode'

I decided not to split charencode.c to new C extension module because it
would duplicate binary codes unnecessarily.

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -18,6 +18,11 @@ from . import (
 pycompat,
 )
 
+charencode = policy.importmod(r'charencode')
+
+asciilower = charencode.asciilower
+asciiupper = charencode.asciiupper
+
 _sysstr = pycompat.sysstr
 
 if pycompat.ispy3:
@@ -318,38 +323,6 @@ def trim(s, width, ellipsis='', leftside
 return concat(usub.encode(_sysstr(encoding)))
 return ellipsis # no enough room for multi-column characters
 
-def _asciilower(s):
-'''convert a string to lowercase if ASCII
-
-Raises UnicodeDecodeError if non-ASCII characters are found.'''
-s.decode('ascii')
-return s.lower()
-
-def asciilower(s):
-# delay importing avoids cyclic dependency around "parsers" in
-# pure Python build (util => i18n => encoding => parsers => util)
-parsers = policy.importmod(r'parsers')
-impl = getattr(parsers, 'asciilower', _asciilower)
-global asciilower
-asciilower = impl
-return impl(s)
-
-def _asciiupper(s):
-'''convert a string to uppercase if ASCII
-
-Raises UnicodeDecodeError if non-ASCII characters are found.'''
-s.decode('ascii')
-return s.upper()
-
-def asciiupper(s):
-# delay importing avoids cyclic dependency around "parsers" in
-# pure Python build (util => i18n => encoding => parsers => util)
-parsers = policy.importmod(r'parsers')
-impl = getattr(parsers, 'asciiupper', _asciiupper)
-global asciiupper
-asciiupper = impl
-return impl(s)
-
 def lower(s):
 "best-effort encoding-aware case-folding of local string s"
 try:
diff --git a/mercurial/policy.py b/mercurial/policy.py
--- a/mercurial/policy.py
+++ b/mercurial/policy.py
@@ -80,7 +80,9 @@ def _importfrom(pkgname, modname):
 
 # map import request to other package or module
 _modredirects = {
+(r'cext', r'charencode'): (r'cext', r'parsers'),
 (r'cffi', r'base85'): (r'pure', r'base85'),
+(r'cffi', r'charencode'): (r'pure', r'charencode'),
 (r'cffi', r'diffhelpers'): (r'pure', r'diffhelpers'),
 (r'cffi', r'parsers'): (r'pure', r'parsers'),
 }
diff --git a/mercurial/pure/charencode.py b/mercurial/pure/charencode.py
new file mode 100644
--- /dev/null
+++ b/mercurial/pure/charencode.py
@@ -0,0 +1,22 @@
+# charencode.py - miscellaneous character encoding
+#
+#  Copyright 2005-2009 Matt Mackall  and others
+#
+# 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
+
+def asciilower(s):
+'''convert a string to lowercase if ASCII
+
+Raises UnicodeDecodeError if non-ASCII characters are found.'''
+s.decode('ascii')
+return s.lower()
+
+def asciiupper(s):
+'''convert a string to uppercase if ASCII
+
+Raises UnicodeDecodeError if non-ASCII characters are found.'''
+s.decode('ascii')
+return s.upper()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 6] policy: reroute proxy modules internally

2017-08-08 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1501512036 -32400
#  Mon Jul 31 23:40:36 2017 +0900
# Node ID 6713774405f9b183f5500f65901f1dadbbd4639a
# Parent  9a77fc7505ac35764963080f38266b9e5cab0934
policy: reroute proxy modules internally

This allows us to split encoding functions from pure.parsers without doing
that for cext.parsers. See the next patch for why.

diff --git a/mercurial/cffi/base85.py b/mercurial/cffi/base85.py
deleted file mode 100644
--- a/mercurial/cffi/base85.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# base85.py: pure python base85 codec
-#
-# Copyright (C) 2009 Brendan Cully 
-#
-# 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 ..pure.base85 import *
diff --git a/mercurial/cffi/diffhelpers.py b/mercurial/cffi/diffhelpers.py
deleted file mode 100644
--- a/mercurial/cffi/diffhelpers.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# diffhelpers.py - pure Python implementation of diffhelpers.c
-#
-# Copyright 2009 Matt Mackall  and others
-#
-# 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 ..pure.diffhelpers import *
diff --git a/mercurial/cffi/parsers.py b/mercurial/cffi/parsers.py
deleted file mode 100644
--- a/mercurial/cffi/parsers.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# parsers.py - Python implementation of parsers.c
-#
-# Copyright 2009 Matt Mackall  and others
-#
-# 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 ..pure.parsers import *
diff --git a/mercurial/policy.py b/mercurial/policy.py
--- a/mercurial/policy.py
+++ b/mercurial/policy.py
@@ -78,6 +78,13 @@ def _importfrom(pkgname, modname):
 (r'cext', r'parsers'): 1,
 }
 
+# map import request to other package or module
+_modredirects = {
+(r'cffi', r'base85'): (r'pure', r'base85'),
+(r'cffi', r'diffhelpers'): (r'pure', r'diffhelpers'),
+(r'cffi', r'parsers'): (r'pure', r'parsers'),
+}
+
 def _checkmod(pkgname, modname, mod):
 expected = _cextversions.get((pkgname, modname))
 actual = getattr(mod, r'version', None)
@@ -94,11 +101,14 @@ def importmod(modname):
 raise ImportError(r'invalid HGMODULEPOLICY %r' % policy)
 assert verpkg or purepkg
 if verpkg:
+pn, mn = _modredirects.get((verpkg, modname), (verpkg, modname))
 try:
-mod = _importfrom(verpkg, modname)
-_checkmod(verpkg, modname, mod)
+mod = _importfrom(pn, mn)
+if pn == verpkg:
+_checkmod(pn, mn, mod)
 return mod
 except ImportError:
 if not purepkg:
 raise
-return _importfrom(purepkg, modname)
+pn, mn = _modredirects.get((purepkg, modname), (purepkg, modname))
+return _importfrom(pn, mn)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 6] cext: factor out header for charencode.c

2017-08-08 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1495344202 -32400
#  Sun May 21 14:23:22 2017 +0900
# Node ID bc781471fcea7c9f2e5dc9db0b6696ad31c681cc
# Parent  ef7755af442bdbbbe95c0d75e9375ab17cdb970f
cext: factor out header for charencode.c

This merges a part of util.h with the header which should exist for
charencode.c.

diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c
--- a/mercurial/cext/charencode.c
+++ b/mercurial/cext/charencode.c
@@ -9,6 +9,7 @@
 
 #include 
 
+#include "charencode.h"
 #include "util.h"
 
 static const char lowertable[128] = {
diff --git a/mercurial/cext/util.h b/mercurial/cext/charencode.h
copy from mercurial/cext/util.h
copy to mercurial/cext/charencode.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/charencode.h
@@ -1,29 +1,15 @@
 /*
- util.h - utility functions for interfacing with the various python APIs.
+ charencode.h - miscellaneous character encoding
 
  This software may be used and distributed according to the terms of
  the GNU General Public License, incorporated herein by reference.
 */
 
-#ifndef _HG_UTIL_H_
-#define _HG_UTIL_H_
-
-#include "compat.h"
-
-#if PY_MAJOR_VERSION >= 3
-#define IS_PY3K
-#endif
+#ifndef _HG_CHARENCODE_H_
+#define _HG_CHARENCODE_H_
 
-typedef struct {
-   PyObject_HEAD
-   char state;
-   int mode;
-   int size;
-   int mtime;
-} dirstateTupleObject;
-
-extern PyTypeObject dirstateTupleType;
-#define dirstate_tuple_check(op) (Py_TYPE(op) == )
+#include 
+#include "compat.h"
 
 /* This should be kept in sync with normcasespecs in encoding.py. */
 enum normcase_spec {
@@ -32,27 +18,10 @@ enum normcase_spec {
NORMCASE_OTHER = 0
 };
 
-#define MIN(a, b) (((a)<(b))?(a):(b))
-/* VC9 doesn't include bool and lacks stdbool.h based on my searching */
-#if defined(_MSC_VER) || __STDC_VERSION__ < 199901L
-#define true 1
-#define false 0
-typedef unsigned char bool;
-#else
-#include 
-#endif
-
-static inline PyObject *_dict_new_presized(Py_ssize_t expected_size)
-{
-   /* _PyDict_NewPresized expects a minused parameter, but it actually
-  creates a dictionary that's the nearest power of two bigger than the
-  parameter. For example, with the initial minused = 1000, the
-  dictionary created has size 1024. Of course in a lot of cases that
-  can be greater than the maximum load factor Python's dict object
-  expects (= 2/3), so as soon as we cross the threshold we'll resize
-  anyway. So create a dictionary that's at least 3/2 the size. */
-   return _PyDict_NewPresized(((1 + expected_size) / 2) * 3);
-}
+PyObject *unhexlify(const char *str, int len);
+PyObject *asciilower(PyObject *self, PyObject *args);
+PyObject *asciiupper(PyObject *self, PyObject *args);
+PyObject *make_file_foldmap(PyObject *self, PyObject *args);
 
 static const int8_t hextable[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -85,4 +54,4 @@ static inline int hexdigit(const char *p
return 0;
 }
 
-#endif /* _HG_UTIL_H_ */
+#endif /* _HG_CHARENCODE_H_ */
diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c
--- a/mercurial/cext/manifest.c
+++ b/mercurial/cext/manifest.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include "charencode.h"
 #include "util.h"
 
 #define DEFAULT_LINES 10
@@ -38,9 +39,6 @@ typedef struct {
 #define MANIFEST_NOT_SORTED -2
 #define MANIFEST_MALFORMED -3
 
-/* defined in charencode.c */
-PyObject *unhexlify(const char *str, int len);
-
 /* get the length of the path for a line */
 static size_t pathlen(line *l) {
return strlen(l->start);
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include "charencode.h"
 #include "util.h"
 #include "bitmanipulation.h"
 
@@ -29,12 +30,6 @@
 
 static const char *const versionerrortext = "Python minor version mismatch";
 
-/* defined in charencode.c */
-PyObject *unhexlify(const char *str, int len);
-PyObject *asciilower(PyObject *self, PyObject *args);
-PyObject *asciiupper(PyObject *self, PyObject *args);
-PyObject *make_file_foldmap(PyObject *self, PyObject *args);
-
 static PyObject *dict_new_presized(PyObject *self, PyObject *args)
 {
Py_ssize_t expected_size;
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 
+#include "charencode.h"
 #include "util.h"
 #include "bitmanipulation.h"
 
diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -25,13 +25,6 @@ typedef struct {
 extern PyTypeObject dirstateTupleType;
 #define dirstate_tuple_check(op) (Py_TYPE(op) == )
 
-/* This should be kept in sync with normcasespecs in encoding.py. */
-enum normcase_spec {
-   NORMCASE_LOWER = -1,
-   NORMCASE_UPPER = 1,
-   

[PATCH 2 of 6] cext: split character encoding functions to new compilation unit

2017-08-08 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1501507707 -32400
#  Mon Jul 31 22:28:27 2017 +0900
# Node ID ef7755af442bdbbbe95c0d75e9375ab17cdb970f
# Parent  9079b0e5c83687ce5c918fc1364a190033408ea5
cext: split character encoding functions to new compilation unit

This extracts charencode.c from parsers.c, which seems big enough for me
to hesitate to add new JSON functions. Still charencode.o is linked to
parsers.so to avoid duplication of binary codes.

diff --git a/mercurial/cext/parsers.c b/mercurial/cext/charencode.c
copy from mercurial/cext/parsers.c
copy to mercurial/cext/charencode.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/charencode.c
@@ -1,5 +1,5 @@
 /*
- parsers.c - efficient content parsing
+ charencode.c - miscellaneous character encoding
 
  Copyright 2008 Matt Mackall  and others
 
@@ -8,26 +8,8 @@
 */
 
 #include 
-#include 
-#include 
-#include 
 
 #include "util.h"
-#include "bitmanipulation.h"
-
-#ifdef IS_PY3K
-/* The mapping of Python types is meant to be temporary to get Python
- * 3 to compile. We should remove this once Python 3 support is fully
- * supported and proper types are used in the extensions themselves. */
-#define PyInt_Type PyLong_Type
-#define PyInt_Check PyLong_Check
-#define PyInt_FromLong PyLong_FromLong
-#define PyInt_FromSsize_t PyLong_FromSsize_t
-#define PyInt_AS_LONG PyLong_AS_LONG
-#define PyInt_AsLong PyLong_AsLong
-#endif
-
-static const char *const versionerrortext = "Python minor version mismatch";
 
 static const char lowertable[128] = {
'\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
@@ -139,7 +121,7 @@ quit:
return ret;
 }
 
-static PyObject *asciilower(PyObject *self, PyObject *args)
+PyObject *asciilower(PyObject *self, PyObject *args)
 {
PyObject *str_obj;
if (!PyArg_ParseTuple(args, "O!:asciilower", _Type, _obj))
@@ -147,7 +129,7 @@ static PyObject *asciilower(PyObject *se
return _asciitransform(str_obj, lowertable, NULL);
 }
 
-static PyObject *asciiupper(PyObject *self, PyObject *args)
+PyObject *asciiupper(PyObject *self, PyObject *args)
 {
PyObject *str_obj;
if (!PyArg_ParseTuple(args, "O!:asciiupper", _Type, _obj))
@@ -155,17 +137,7 @@ static PyObject *asciiupper(PyObject *se
return _asciitransform(str_obj, uppertable, NULL);
 }
 
-static PyObject *dict_new_presized(PyObject *self, PyObject *args)
-{
-   Py_ssize_t expected_size;
-
-   if (!PyArg_ParseTuple(args, "n:make_presized_dict", _size))
-   return NULL;
-
-   return _dict_new_presized(expected_size);
-}
-
-static PyObject *make_file_foldmap(PyObject *self, PyObject *args)
+PyObject *make_file_foldmap(PyObject *self, PyObject *args)
 {
PyObject *dmap, *spec_obj, *normcase_fallback;
PyObject *file_foldmap = NULL;
@@ -235,763 +207,3 @@ quit:
Py_XDECREF(file_foldmap);
return NULL;
 }
-
-/*
- * This code assumes that a manifest is stitched together with newline
- * ('\n') characters.
- */
-static PyObject *parse_manifest(PyObject *self, PyObject *args)
-{
-   PyObject *mfdict, *fdict;
-   char *str, *start, *end;
-   int len;
-
-   if (!PyArg_ParseTuple(args, "O!O!s#:parse_manifest",
- _Type, ,
- _Type, ,
- , ))
-   goto quit;
-
-   start = str;
-   end = str + len;
-   while (start < end) {
-   PyObject *file = NULL, *node = NULL;
-   PyObject *flags = NULL;
-   char *zero = NULL, *newline = NULL;
-   ptrdiff_t nlen;
-
-   zero = memchr(start, '\0', end - start);
-   if (!zero) {
-   PyErr_SetString(PyExc_ValueError,
-   "manifest entry has no separator");
-   goto quit;
-   }
-
-   newline = memchr(zero + 1, '\n', end - (zero + 1));
-   if (!newline) {
-   PyErr_SetString(PyExc_ValueError,
-   "manifest contains trailing garbage");
-   goto quit;
-   }
-
-   file = PyBytes_FromStringAndSize(start, zero - start);
-
-   if (!file)
-   goto bail;
-
-   nlen = newline - zero - 1;
-
-   node = unhexlify(zero + 1, nlen > 40 ? 40 : (int)nlen);
-   if (!node)
-   goto bail;
-
-   if (nlen > 40) {
-   flags = PyBytes_FromStringAndSize(zero + 41,
-  nlen - 40);
-   if (!flags)
-   goto bail;
-
-   if (PyDict_SetItem(fdict, file, flags) == -1)
-   goto bail;
-   }
-
-   if (PyDict_SetItem(mfdict, file, node) == -1)
-   

D242: context: rename troubled into isunstable

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D242?vs=587=626

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.isunstable'")
+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


D260: chg: define _GNU_SOURCE to allow CentOS 5 compilation

2017-08-08 Thread Mathias De Maré
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5544af862286: chg: define _GNU_SOURCE to allow CentOS 5 
compilation (authored by Mathiasdm).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D260?vs=605=625

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, yuja
Cc: yuja, quark, 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-08 Thread Mathias De Maré
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGaa7a3f6e3729: centos5: use vault urls (authored by 
Mathiasdm).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D261?vs=606=624

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, quark
Cc: quark, 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-08 Thread yuja (Yuya Nishihara)
yuja added a comment.


  I've queued these for stable so 4.3 rpm can be built for CentOS 5.

REPOSITORY
  rHG Mercurial

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

To: Mathiasdm, #hg-reviewers, yuja
Cc: yuja, quark, 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-08 Thread yuja (Yuya Nishihara)
yuja accepted this revision as: yuja.
yuja added a comment.


  Looks good. The manpage says
  
  > The O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags are not specified in 
POSIX.1-2001, but are specified  in
  >  POSIX.1-2008.  Since glibc 2.12, one can obtain their definitions by 
defining either _POSIX_C_SOURCE with
  >  a value greater than or equal to 200809L or _XOPEN_SOURCE with a value 
greater than or equal to 700.   In
  >  glibc 2.11 and earlier, one obtains the definitions by defining 
_GNU_SOURCE.
  
  and the compiler error appears to be included in the commit message.

REPOSITORY
  rHG Mercurial

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

To: Mathiasdm, #hg-reviewers, yuja
Cc: yuja, quark, 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-08 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> indygreg wrote in context.py:246-248
> This feels like it should be a set not a list.
> 
> Should this be changed as part of changing the API?

Semantically I agree, but the list has the nice property of being sorted.

If we change it to a set, I think we would be forced to sort it in order to 
have stable test outputs.

> indygreg wrote in exchange.py:694
> Why does this only print 1 instability?

I think it was easier to display a message when considering a single trouble. 
We could do better, but I'm not sure how displaying all troubles would interact 
with translation.

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-08 Thread lothiraldan (Boris Feld)
lothiraldan marked an inline comment as done.
lothiraldan added inline comments.

INLINE COMMENTS

> indygreg wrote in context.py:208
> Typo. Can be fixed in flight if you don't submit a new series.

I have made the fix as I sent another 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


D239: context: rename unstable into orphan

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D239?vs=584=623

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.orphan'")
+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, 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-08 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> lothiraldan wrote in context.py:227
> Damn it you are right, good catch!

Sorry for the tone of my comment, I was only angry against myself, I thought I 
have fixed this code too many times due to merge conflicts.

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


D240: context: rename divergent into contentdivergent

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D240?vs=585=621

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.contentdivergent()
+
+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, indygreg
Cc: indygreg, 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-08 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 622.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D241?vs=586=622

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.phasedivergent()
+
+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, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5650] New: Ability to use timestamp from GIT_AUTHOR_DATE

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

Bug ID: 5650
   Summary: Ability to use timestamp from GIT_AUTHOR_DATE
   Product: Mercurial
   Version: 4.2.2
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: convert
  Assignee: bugzi...@mercurial-scm.org
  Reporter: mojca.miklavec.li...@gmail.com
CC: duri...@gmail.com, mercurial-devel@mercurial-scm.org

I'm trying to convert a repository from git to hg with

hg convert git-repo hg-repo

Git stores two different timestamps:
* GIT_AUTHOR_DATE
* GIT_COMMIT_DATE
(maybe the name of the variables is not 100% exact).

The problem is that I ran some repo modifications (some rebasing etc.) before
doing the conversion, so GIT_COMMIT_DATE has been changed to the time when I
did those modifications, while GIT_AUTHOR_DATE remains the same.

The conversion then used GIT_COMMIT_DATE (but GIT_AUTHOR_NAME!!!) as the source
of the data which is completely useless for me.

My workaround was eventually to run

git rebase --committer-date-is-author-date 

to modify the timestamps (luckily I have a linear history; I could probably
modify the timestamps in another way, but ...)

I would say that GIT_AUTHOR_DATE would make more sense in the conversion
anyway, but if you feel that GIT_COMMITTER_DATE is more useful as default, I
would like to request at least an option to fix that during conversion without
having to do acrobatics with git history first.

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


D240: context: rename divergent into contentdivergent

2017-08-08 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> indygreg wrote in context.py:227
> This should be `self.contentdivergent()` no?

Damn it you are right, good catch!

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


D241: context: rename bumped into phasedivergent

2017-08-08 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> indygreg wrote in context.py:220
> Shouldn't this be `self.phasedivergent()`?

Yes definitely, thanks for the catch

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