D2694: merge: deprecate accessing update results by index

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that we have named attributes, let's convert the code base to use
  them. We also add deprecation warnings so legacy consumers are aware
  of their transgressions.
  
  ``stats.unresolvedcount`` is much easier to read than ``stats[3]``,
  don't you think?

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  mercurial/commands.py
  mercurial/hg.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1407,9 +1407,15 @@
 removedcount = attr.ib()
 unresolvedcount = attr.ib()
 
+def isempty(self):
+return (not self.updatedcount and not self.mergedcount
+and not self.removedcount and not self.unresolvedcount)
+
 # TODO remove container emulation once consumers switch to new API.
 
 def __getitem__(self, x):
+util.nouideprecwarn('access merge.update() results by name instead of '
+'index', '4.6', 2)
 if x == 0:
 return self.updatedcount
 elif x == 1:
@@ -1422,6 +1428,8 @@
 raise IndexError('can only access items 0-3')
 
 def __len__(self):
+util.nouideprecwarn('access merge.update() results by name instead of '
+'index', '4.6', 2)
 return 4
 
 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
@@ -2069,7 +2077,8 @@
 sparse.prunetemporaryincludes(repo)
 
 if not partial:
-repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
+repo.hook('update', parent1=xp1, parent2=xp2,
+  error=stats.unresolvedcount)
 return stats
 
 def graft(repo, ctx, pctx, labels, keepparent=False):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -744,7 +744,7 @@
 return srcpeer, destpeer
 
 def _showstats(repo, stats, quietempty=False):
-if quietempty and not any(stats):
+if quietempty and stats.isempty():
 return
 repo.ui.status(_("%d files updated, %d files merged, "
  "%d files removed, %d files unresolved\n") % (
@@ -765,9 +765,9 @@
 """update the working directory to node"""
 stats = updaterepo(repo, node, False, updatecheck=updatecheck)
 _showstats(repo, stats, quietempty)
-if stats[3]:
+if stats.unresolvedcount:
 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n"))
-return stats[3] > 0
+return stats.unresolvedcount > 0
 
 # naming conflict in clone()
 _update = update
@@ -778,7 +778,7 @@
 repo.vfs.unlinkpath('graftstate', ignoremissing=True)
 if show_stats:
 _showstats(repo, stats, quietempty)
-return stats[3] > 0
+return stats.unresolvedcount > 0
 
 # naming conflict in updatetotally()
 _clean = clean
@@ -877,12 +877,12 @@
 labels=labels)
 
 _showstats(repo, stats)
-if stats[3]:
+if stats.unresolvedcount:
 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
  "or 'hg merge --abort' to abandon\n"))
 elif remind and not abort:
 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
-return stats[3] > 0
+return stats.unresolvedcount > 0
 
 def _incoming(displaychlist, subreporecurse, ui, repo, source,
 opts, buffered=False):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -624,7 +624,7 @@
 repo.setparents(op1, op2)
 dsguard.close()
 hg._showstats(repo, stats)
-if stats[3]:
+if stats.unresolvedcount:
 repo.ui.status(_("use 'hg resolve' to retry unresolved "
  "file merges\n"))
 return 1
@@ -2301,7 +2301,7 @@
 finally:
 repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
 # report any conflicts
-if stats[3] > 0:
+if stats.unresolvedcount > 0:
 # write out state for --continue
 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
 repo.vfs.write('graftstate', ''.join(nodelines))
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -490,7 +490,7 @@
  'rebase')
 stats = rebasenode(repo, rev, p1, base, self.state,
self.collapsef, dest, 
wctx=self.wctx)
-if stats[3] > 0:
+if stats.unresolvedcount > 0:
 if self.wctx.isinmemory():
  

D2691: commands: don't check for merge.update() truthiness

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  AFAICT ``stats`` is always a tuple in these cases. We don't
  need to check if the variable has a truthy value.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2301,7 +2301,7 @@
 finally:
 repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
 # report any conflicts
-if stats and stats[3] > 0:
+if stats[3] > 0:
 # write out state for --continue
 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
 repo.vfs.write('graftstate', ''.join(nodelines))
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -490,7 +490,7 @@
  'rebase')
 stats = rebasenode(repo, rev, p1, base, self.state,
self.collapsef, dest, 
wctx=self.wctx)
-if stats and stats[3] > 0:
+if stats[3] > 0:
 if self.wctx.isinmemory():
 raise error.InMemoryMergeConflictsError()
 else:



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


D2693: histedit: always define update results

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before, we had a branch that could return None for the update stats.
  Let's just return an updateresult instance instead.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -556,7 +556,7 @@
 # edits are "in place" we do not need to make any merge,
 # just applies changes on parent for editing
 cmdutil.revert(ui, repo, ctx, (wcpar, node.nullid), all=True)
-stats = None
+stats = mergemod.updateresult(0, 0, 0, 0)
 else:
 try:
 # ui.forcemerge is an internal variable, do not document



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


D2692: merge: return an attrs class from update() and applyupdates()

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously, we returned a tuple containing counts. The result of an
  update is kind of complex and the use of tuples with nameless fields
  made the code a bit harder to read and constrained future expansion
  of the return value.
  
  Let's invent an attrs-defined class for representing the result of
  an update operation.
  
  We provide __getitem__ and __len__ implementations for backwards
  compatibility as a container type to minimize code churn.
  
  In (at least) Python 2, the % operator seems to insist on using
  tuples. So we had to update a consumer using the % operator.
  
  .. api::
  
merge.update() and merge.applyupdates() now return a class
with named attributes instead of a tuple. Switch consumers
to access elements by name instead of by offset.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hg.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -22,6 +22,9 @@
 nullid,
 nullrev,
 )
+from .thirdparty import (
+attr,
+)
 from . import (
 copies,
 error,
@@ -1397,6 +1400,30 @@
 prefetch = scmutil.fileprefetchhooks
 prefetch(repo, ctx, [f for sublist in oplist for f, args, msg in sublist])
 
+@attr.s(frozen=True)
+class updateresult(object):
+updatedcount = attr.ib()
+mergedcount = attr.ib()
+removedcount = attr.ib()
+unresolvedcount = attr.ib()
+
+# TODO remove container emulation once consumers switch to new API.
+
+def __getitem__(self, x):
+if x == 0:
+return self.updatedcount
+elif x == 1:
+return self.mergedcount
+elif x == 2:
+return self.removedcount
+elif x == 3:
+return self.unresolvedcount
+else:
+raise IndexError('can only access items 0-3')
+
+def __len__(self):
+return 4
+
 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
 """apply the merge action list to the working directory
 
@@ -1580,7 +1607,8 @@
 if not proceed:
 # XXX setting unresolved to at least 1 is a hack to make sure we
 # error out
-return updated, merged, removed, max(len(unresolvedf), 1)
+return updateresult(updated, merged, removed,
+max(len(unresolvedf), 1))
 newactions = []
 for f, args, msg in mergeactions:
 if f in unresolvedf:
@@ -1655,8 +1683,7 @@
 actions['m'] = [a for a in actions['m'] if a[0] in mfiles]
 
 progress(_updating, None, total=numupdates, unit=_files)
-
-return updated, merged, removed, unresolved
+return updateresult(updated, merged, removed, unresolved)
 
 def recordupdates(repo, actions, branchmerge):
 "record merge actions to the dirstate"
@@ -1877,7 +1904,7 @@
 # call the hooks and exit early
 repo.hook('preupdate', throw=True, parent1=xp2, parent2='')
 repo.hook('update', parent1=xp2, parent2='', error=0)
-return 0, 0, 0, 0
+return updateresult(0, 0, 0, 0)
 
 if (updatecheck == 'linear' and
 pas not in ([p1], [p2])):  # nonlinear
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -747,7 +747,9 @@
 if quietempty and not any(stats):
 return
 repo.ui.status(_("%d files updated, %d files merged, "
- "%d files removed, %d files unresolved\n") % stats)
+ "%d files removed, %d files unresolved\n") % (
+   stats.updatedcount, stats.mergedcount,
+   stats.removedcount, stats.unresolvedcount))
 
 def updaterepo(repo, node, overwrite, updatecheck=None):
 """Update the working directory to node.



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


D2686: xdiff: add a preprocessing step that trims files

2018-03-04 Thread quark (Jun Wu)
quark updated this revision to Diff 6650.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2686?vs=6645=6650

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiffi.c
  mercurial/thirdparty/xdiff/xemit.c
  mercurial/thirdparty/xdiff/xprepare.c
  mercurial/thirdparty/xdiff/xprepare.h
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -60,6 +60,7 @@
 
 typedef struct s_xdfenv {
xdfile_t xdf1, xdf2;
+   long prefix_lines, suffix_lines;
 } xdfenv_t;
 
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.h 
b/mercurial/thirdparty/xdiff/xprepare.h
--- a/mercurial/thirdparty/xdiff/xprepare.h
+++ b/mercurial/thirdparty/xdiff/xprepare.h
@@ -26,7 +26,7 @@
 
 
 int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
-   xdfenv_t *xe);
+   xdfenv_t *xe, xdemitconf_t const *xecfg);
 void xdl_free_env(xdfenv_t *xe);
 
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.c 
b/mercurial/thirdparty/xdiff/xprepare.c
--- a/mercurial/thirdparty/xdiff/xprepare.c
+++ b/mercurial/thirdparty/xdiff/xprepare.c
@@ -61,6 +61,8 @@
 static void xdl_free_ctx(xdfile_t *xdf);
 static int xdl_clean_mmatch(char const *dis, long i, long s, long e);
 static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t 
*xdf2);
+static void xdl_trim_files(mmfile_t *mf1, mmfile_t *mf2, long reserved,
+   xdfenv_t* xe, mmfile_t *out_mf1, mmfile_t *out_mf2);
 static int xdl_trim_ends(xdfile_t *xdf1, xdfile_t *xdf2);
 static int xdl_optimize_ctxs(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t 
*xdf2);
 
@@ -156,6 +158,99 @@
 }
 
 
+/*
+ * Trim common prefix from files.
+ * Note: trimming common prefix and suffix as-is will break hunk shifting, and
+ * context lines.
+ *
+ * a.py| common | b.py| common | diff
+ * | p | s  | | p | s  |
+ * ---
+ * try:| Y  | try:| Y  |
+ *   1 | Y  |   1 | Y  |
+ * except: | Y  y   | except: | Y  |
+ *   pass  | Y  y   |   pass  | Y  |
+ * try:| Y  y   | try:| Y  | +
+ *   3 |Y   |   2 || +
+ * except: |Y   | except: | y  | +
+ *   pass  |Y   |   pass  | y  | +
+ * || try:| y  |
+ * ||   3 | Y  |
+ * || except: | Y  |
+ * ||   pass  | Y  |
+ *
+ * Since the diff output tends to shift hunks towards the end, common prefix is
+ * first calculated, and common suffix is calculated in a way that it cannot
+ * overlap with common prefix (ex. "y" in the above table is not considered as
+ * common suffix). Then remove "reserved" lines from both prefix and suffix to
+ * make shifting and context lines work.
+ */
+static void xdl_trim_files(mmfile_t *mf1, mmfile_t *mf2, long reserved,
+   xdfenv_t *xe, mmfile_t *out_mf1, mmfile_t *out_mf2) {
+   mmfile_t msmall, mlarge;
+   long plines = 0, pbytes = 0, slines = 0, sbytes = 0, i;
+   const char *pp1, *pp2, *ps1, *ps2;
+
+   /* reserved must >= 0 for the line boundary adjustment to work */
+   if (reserved < 0)
+   reserved = 0;
+
+   if (mf1->size < mf2->size) {
+   memcpy(, mf1, sizeof(mmfile_t));
+   memcpy(, mf2, sizeof(mmfile_t));
+   } else {
+   memcpy(, mf2, sizeof(mmfile_t));
+   memcpy(, mf1, sizeof(mmfile_t));
+   }
+
+   pp1 = msmall.ptr, pp2 = mlarge.ptr;
+   for (i = 0; i < msmall.size && *pp1 == *pp2; ++i) {
+   plines += (*pp1 == '\n');
+   pp1++, pp2++;
+   }
+
+   ps1 = msmall.ptr + msmall.size - 1, ps2 = mlarge.ptr + mlarge.size - 1;
+   for (; ps1 > pp1 && *ps1 == *ps2; ++i) {
+   slines += (*ps1 == '\n');
+   ps1--, ps2--;
+   }
+
+   /* Retract common prefix and suffix boundaries for reserved lines */
+   if (plines <= reserved + 1) {
+   plines = 0;
+   } else {
+   for (i = 0; i <= reserved;) {
+   pp1--;
+   i += (*pp1 == '\n');
+   }
+   /* The new mmfile starts at the next char just after '\n' */
+   pbytes = pp1 - msmall.ptr + 1;
+   plines -= reserved;
+   }
+
+   if (slines <= reserved + 1) {
+   slines = 0;
+   } else {
+   for (i = 0; i <= reserved;) {
+   ps1++;
+   i += (*ps1 == '\n');
+   }
+   /* The new mmfile includes this '\n' */
+   sbytes = msmall.ptr + msmall.size - ps1 - 1;
+   slines 

D2624: perf: teach perfbdiff to call blocks() and to use xdiff

2018-03-04 Thread quark (Jun Wu)
quark added inline comments.

INLINE COMMENTS

> perf.py:1024-1029
> +if xdiff:
> +mdiff.bdiff.xdiffblocks(*pair)
> +elif blocks:
> +mdiff.bdiff.blocks(*pair)
> +else:
> +mdiff.textdiff(*pair)

Might move the assignment out of the loop:

if xdiff:
f = mdiff.bdiff.xdiffblocks
elif blocks:
f = mdiff.bdiff.blocks
else:
f = mdiff.textdiff
  def d():
 ...
 f(*pairs)

REPOSITORY
  rHG Mercurial

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

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


D2668: rebase: introduce support for automatically rebasing orphan changes

2018-03-04 Thread quark (Jun Wu)
quark added a comment.


  My initial idea was to allow `-r 'orphan()-obsolete()' -d auto`. That can be 
actually done without any code change by defining `auto` as a complex revset.
  
  That idea derived an idea of allowing omitting arguments.
  
rebase.autodest = ... # when -r or -s is provided
rebase.autosrc = ...  # when -d is provided
rebase.autosrcdest = ..., ... # when nothing is provided
  
  So people can run `hg rebase`, `hg rebase -r orphan()-obsolete()`.
  
  I have also thought about "rebase presets", like:
  
rebase.preset.linearize.src = orphan() - obsolete()
rebase.preset.linearize.dest = (a complex revset using SRC, ALLSRC)
rebase.preset.master.src = ". % @"
rebase.preset.master.dest = @
  
  If preset name is the unnamed argument, then people can use `rebase master`, 
`rebase linearize`.

REPOSITORY
  rHG Mercurial

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

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


D2681: [PoC] scmutil: support local only obsolescence

2018-03-04 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  re: the "(testcase !)" syntax- I agree that it would be better if "(false !)" 
means the line is *not* present, instead of optional.
  
  I made an attempt to do that, but somehow I came up with a test in 
test-run-tests.t that failed there, but the exact same test ran fine in another 
*.t.  I wondered if it was a case of run-tests.py processing it for a test 
inside test-run-tests.t, and then the main instance of run-tests.py 
re-processing it.  If I can find that code, I can post it if you think it might 
be useful.  But I've long forgotten the nuance in that code.

REPOSITORY
  rHG Mercurial

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

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


D2690: sslutil: some more forcebytes() on some exception messages

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

REVISION SUMMARY
  At this point, test-https.t no longer dumps tracebacks
  everywhere. Instead, we get some results that look like we're not
  adequately finding things in hg's configuration, which should be
  manageable (if somewhat annoying to find and fix.)

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/sslutil.py

CHANGE DETAILS

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -346,10 +346,11 @@
 
 for f in (keyfile, certfile):
 if f and not os.path.exists(f):
-raise error.Abort(_('certificate file (%s) does not exist; '
-'cannot connect to %s') % (f, serverhostname),
-  hint=_('restore missing file or fix references '
- 'in Mercurial config'))
+raise error.Abort(
+_('certificate file (%s) does not exist; cannot connect to 
%s') % (
+f, pycompat.bytesurl(serverhostname)),
+hint=_('restore missing file or fix references '
+   'in Mercurial config'))
 
 settings = _hostsettings(ui, serverhostname)
 
@@ -372,9 +373,10 @@
 try:
 sslcontext.set_ciphers(pycompat.sysstr(settings['ciphers']))
 except ssl.SSLError as e:
-raise error.Abort(_('could not set ciphers: %s') % e.args[0],
-  hint=_('change cipher string (%s) in config') %
-   settings['ciphers'])
+raise error.Abort(
+_('could not set ciphers: %s') % util.forcebytestr(e.args[0]),
+hint=_('change cipher string (%s) in config') %
+settings['ciphers'])
 
 if certfile is not None:
 def password():



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


D2687: sslutil: lots of unicode/bytes cleanup

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

REVISION SUMMARY
  In general, we handle hostnames as bytes, except where Python forces
  them to be unicodes.
  
  This fixes all the tracebacks I was seeing in test-https.t, but
  there's still some ECONNRESET weirdness that I can't hunt down...

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/sslutil.py

CHANGE DETAILS

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -113,6 +113,7 @@
 
 Returns a dict of settings relevant to that hostname.
 """
+bhostname = pycompat.bytesurl(hostname)
 s = {
 # Whether we should attempt to load default/available CA certs
 # if an explicit ``cafile`` is not defined.
@@ -162,14 +163,14 @@
 ui.warn(_('warning: connecting to %s using legacy security '
   'technology (TLS 1.0); see '
   'https://mercurial-scm.org/wiki/SecureConnections for '
-  'more info\n') % hostname)
+  'more info\n') % bhostname)
 defaultprotocol = 'tls1.0'
 
 key = 'minimumprotocol'
 protocol = ui.config('hostsecurity', key, defaultprotocol)
 validateprotocol(protocol, key)
 
-key = '%s:minimumprotocol' % hostname
+key = '%s:minimumprotocol' % bhostname
 protocol = ui.config('hostsecurity', key, protocol)
 validateprotocol(protocol, key)
 
@@ -182,25 +183,25 @@
 s['protocol'], s['ctxoptions'], s['protocolui'] = 
protocolsettings(protocol)
 
 ciphers = ui.config('hostsecurity', 'ciphers')
-ciphers = ui.config('hostsecurity', '%s:ciphers' % hostname, ciphers)
+ciphers = ui.config('hostsecurity', '%s:ciphers' % bhostname, ciphers)
 s['ciphers'] = ciphers
 
 # Look for fingerprints in [hostsecurity] section. Value is a list
 # of : strings.
-fingerprints = ui.configlist('hostsecurity', '%s:fingerprints' % hostname)
+fingerprints = ui.configlist('hostsecurity', '%s:fingerprints' % bhostname)
 for fingerprint in fingerprints:
 if not (fingerprint.startswith(('sha1:', 'sha256:', 'sha512:'))):
 raise error.Abort(_('invalid fingerprint for %s: %s') % (
-hostname, fingerprint),
+bhostname, fingerprint),
   hint=_('must begin with "sha1:", "sha256:", '
  'or "sha512:"'))
 
 alg, fingerprint = fingerprint.split(':', 1)
 fingerprint = fingerprint.replace(':', '').lower()
 s['certfingerprints'].append((alg, fingerprint))
 
 # Fingerprints from [hostfingerprints] are always SHA-1.
-for fingerprint in ui.configlist('hostfingerprints', hostname):
+for fingerprint in ui.configlist('hostfingerprints', bhostname):
 fingerprint = fingerprint.replace(':', '').lower()
 s['certfingerprints'].append(('sha1', fingerprint))
 s['legacyfingerprint'] = True
@@ -223,11 +224,11 @@
 # If both fingerprints and a per-host ca file are specified, issue a 
warning
 # because users should not be surprised about what security is or isn't
 # being performed.
-cafile = ui.config('hostsecurity', '%s:verifycertsfile' % hostname)
+cafile = ui.config('hostsecurity', '%s:verifycertsfile' % bhostname)
 if s['certfingerprints'] and cafile:
 ui.warn(_('(hostsecurity.%s:verifycertsfile ignored when host '
   'fingerprints defined; using host fingerprints for '
-  'verification)\n') % hostname)
+  'verification)\n') % bhostname)
 
 # Try to hook up CA certificate validation unless something above
 # makes it not necessary.
@@ -237,8 +238,8 @@
 cafile = util.expandpath(cafile)
 if not os.path.exists(cafile):
 raise error.Abort(_('path specified by %s does not exist: %s') 
%
-  ('hostsecurity.%s:verifycertsfile' % 
hostname,
-   cafile))
+  ('hostsecurity.%s:verifycertsfile' % (
+  bhostname,), cafile))
 s['cafile'] = cafile
 else:
 # Find global certificates file in config.
@@ -390,7 +391,7 @@
 else:
 msg = e.args[1]
 raise error.Abort(_('error loading CA file %s: %s') % (
-  settings['cafile'], msg),
+  settings['cafile'], util.forcebytestr(msg)),
   hint=_('file is empty or malformed?'))
 caloaded = True
 elif settings['allowloaddefaultcerts']:
@@ -583,8 +584,10 @@
 pats = []
 if not dn:
 return False
+dn = pycompat.bytesurl(dn)
+hostname = pycompat.bytesurl(hostname)
 

D2689: sslutil: sslcontext needs the cipher name as a sysstr

2018-03-04 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/D2689

AFFECTED FILES
  mercurial/sslutil.py

CHANGE DETAILS

diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -370,7 +370,7 @@
 
 if settings['ciphers']:
 try:
-sslcontext.set_ciphers(settings['ciphers'])
+sslcontext.set_ciphers(pycompat.sysstr(settings['ciphers']))
 except ssl.SSLError as e:
 raise error.Abort(_('could not set ciphers: %s') % e.args[0],
   hint=_('change cipher string (%s) in config') %



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


D2688: hgweb: adapt to socket._fileobject changes in Python 3

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

REVISION SUMMARY
  These are the only uses of socket._fileobject in the codebase, so
  let's just do something inline here rather than adding something to
  pycompat.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/server.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -257,8 +257,10 @@
 
 def setup(self):
 self.connection = self.request
-self.rfile = socket._fileobject(self.request, "rb", self.rbufsize)
-self.wfile = socket._fileobject(self.request, "wb", self.wbufsize)
+fo = getattr(socket, '_fileobject',
+ lambda s, mode, bufsize: s.makefile(mode, bufsize))
+self.rfile = fo(self.request, r"rb", self.rbufsize)
+self.wfile = fo(self.request, r"wb", self.wbufsize)
 
 try:
 import threading



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


D2678: help: supporting both help and doc for aliases

2018-03-04 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  I really like this feature too.  Any plans to extend it to 
{fileset,revset,template}alias?
  
  I don't think this should prevent it from being accepted, but is there a way 
to get the help text rendered as-is, without reflowing?  For example, to 
simulate the usual 1 line summary + extended detail, I tried:
  
[alias]
phabimport:doc = Import a stack of revisions from phabricator.
  .
  This is extended help.
  
  That got me:
  
$ ../hg help phabimport
hg phabimport

shell alias for: "%HG%" phabread $1 | "%HG%" import --bypass -

Import a stack of revisions from phabricator. . This is extended help.

defined by: c:\Users\Matt\projects\hg\.hg\hgrc:28

(some details hidden, use --verbose to show complete help)
  
  (The middle '.' line is necessary, because the config parser throws away 
empty lines, complains about unexpected leading whitespace in the next line, 
and then exits without the usual 'abort: ' prefix.  That bad format even kills 
`hg version`, but the output does indicate exactly where the problem is.)

REPOSITORY
  rHG Mercurial

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

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


D2685: xdiff: add comments for fields in xdfile_t

2018-03-04 Thread quark (Jun Wu)
quark abandoned this revision.
quark added a comment.


  No longer needed

REPOSITORY
  rHG Mercurial

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

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


D2686: xdiff: add a preprocessing step that trims files

2018-03-04 Thread quark (Jun Wu)
quark updated this revision to Diff 6645.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2686?vs=6644=6645

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiffi.c
  mercurial/thirdparty/xdiff/xemit.c
  mercurial/thirdparty/xdiff/xprepare.c
  mercurial/thirdparty/xdiff/xprepare.h
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -60,6 +60,7 @@
 
 typedef struct s_xdfenv {
xdfile_t xdf1, xdf2;
+   long prefix_lines, suffix_lines;
 } xdfenv_t;
 
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.h 
b/mercurial/thirdparty/xdiff/xprepare.h
--- a/mercurial/thirdparty/xdiff/xprepare.h
+++ b/mercurial/thirdparty/xdiff/xprepare.h
@@ -26,7 +26,7 @@
 
 
 int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
-   xdfenv_t *xe);
+   xdfenv_t *xe, xdemitconf_t const *xecfg);
 void xdl_free_env(xdfenv_t *xe);
 
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.c 
b/mercurial/thirdparty/xdiff/xprepare.c
--- a/mercurial/thirdparty/xdiff/xprepare.c
+++ b/mercurial/thirdparty/xdiff/xprepare.c
@@ -61,6 +61,8 @@
 static void xdl_free_ctx(xdfile_t *xdf);
 static int xdl_clean_mmatch(char const *dis, long i, long s, long e);
 static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t 
*xdf2);
+static void xdl_trim_files(mmfile_t *mf1, mmfile_t *mf2, long reserved,
+   xdfenv_t* xe, mmfile_t *out_mf1, mmfile_t *out_mf2);
 static int xdl_trim_ends(xdfile_t *xdf1, xdfile_t *xdf2);
 static int xdl_optimize_ctxs(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t 
*xdf2);
 
@@ -156,6 +158,105 @@
 }
 
 
+/*
+ * Trim common prefix from files.
+ * Note: need to preserve some lines for shifting to work. For example,
+ *
+ * a.py| common | b.py| common | diff
+ * | p | s  | | p | s  |
+ * ---
+ * try:| Y  | try:| Y  |
+ *   1 | Y  |   1 | Y  |
+ * except: | Y  y   | except: | Y  |
+ *   pass  | Y  y   |   pass  | Y  |
+ * try:| Y  y   | try:| Y  | +
+ *   3 |Y   |   2 || +
+ * except: |Y   | except: | y  | +
+ *   pass  |Y   |   pass  | y  | +
+ * || try:| y  |
+ * ||   3 | Y  |
+ * || except: | Y  |
+ * ||   pass  | Y  |
+ *
+ * To make shifting work, common suffix is handled so it cannot overlap with
+ * common prefix (in the above case, lines marked with "y" will not count as
+ * common suffix). Then subtract some O(1) lines leaving room for shifting.
+ *
+ * Find common prefix first, since the diff algorithm moves hunks towards the
+ * end. For example,
+ *
+ * #!python
+ * open('a','w').write('x\n'* 1000)
+ * open('b','w').write('x\n'* 1001)
+ *
+ * Diffing the two files in either direction, will print a hunk at the end.
+ */
+static void xdl_trim_files(mmfile_t *mf1, mmfile_t *mf2, long reserved,
+   xdfenv_t *xe, mmfile_t *out_mf1, mmfile_t *out_mf2) {
+   mmfile_t msmall, mlarge;
+   long plines = 0, pbytes = 0, slines = 0, sbytes = 0, i;
+   const char *pp1, *pp2, *ps1, *ps2;
+
+   /* reserved must >= 0 for the line boundary adjustment to work */
+   if (reserved < 0)
+   reserved = 0;
+
+   if (mf1->size < mf2->size) {
+   memcpy(, mf1, sizeof(mmfile_t));
+   memcpy(, mf2, sizeof(mmfile_t));
+   } else {
+   memcpy(, mf2, sizeof(mmfile_t));
+   memcpy(, mf1, sizeof(mmfile_t));
+   }
+
+   pp1 = msmall.ptr, pp2 = mlarge.ptr;
+   for (i = 0; i < msmall.size && *pp1 == *pp2; ++i) {
+   plines += (*pp1 == '\n');
+   pp1++, pp2++;
+   }
+
+   ps1 = msmall.ptr + msmall.size - 1, ps2 = mlarge.ptr + mlarge.size - 1;
+   for (; ps1 > pp1 && *ps1 == *ps2; ++i) {
+   slines += (*ps1 == '\n');
+   ps1--, ps2--;
+   }
+
+   /* Retract common prefix and suffix boundaries for reserved lines */
+   if (plines <= reserved + 1) {
+   plines = 0;
+   } else {
+   for (i = 0; i <= reserved;) {
+   pp1--;
+   i += (*pp1 == '\n');
+   }
+   /* The new mmfile starts at the next char just after '\n' */
+   pbytes = pp1 - msmall.ptr + 1;
+   plines -= reserved;
+   }
+
+   if (slines <= reserved + 1) {
+   slines = 0;
+   } else {
+   for (i = 0; i <= reserved;) {
+   ps1++;
+   i += (*ps1 == '\n');
+   }
+ 

D2684: xdiff: remove unused structure and functions

2018-03-04 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `bdiffparam_t` seems unused even in git's repo. `xdl_fall_back_diff` is no
  longer used after https://phab.mercurial-scm.org/D2573.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiff.h
  mercurial/thirdparty/xdiff/xutils.c

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xutils.c 
b/mercurial/thirdparty/xdiff/xutils.c
--- a/mercurial/thirdparty/xdiff/xutils.c
+++ b/mercurial/thirdparty/xdiff/xutils.c
@@ -241,34 +241,3 @@
 
return 0;
 }
-
-int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
-   int line1, int count1, int line2, int count2)
-{
-   /*
-* This probably does not work outside Git, since
-* we have a very simple mmfile structure.
-*
-* Note: ideally, we would reuse the prepared environment, but
-* the libxdiff interface does not (yet) allow for diffing only
-* ranges of lines instead of the whole files.
-*/
-   mmfile_t subfile1, subfile2;
-   xdfenv_t env;
-
-   subfile1.ptr = (char *)diff_env->xdf1.recs[line1 - 1]->ptr;
-   subfile1.size = diff_env->xdf1.recs[line1 + count1 - 2]->ptr +
-   diff_env->xdf1.recs[line1 + count1 - 2]->size - subfile1.ptr;
-   subfile2.ptr = (char *)diff_env->xdf2.recs[line2 - 1]->ptr;
-   subfile2.size = diff_env->xdf2.recs[line2 + count2 - 2]->ptr +
-   diff_env->xdf2.recs[line2 + count2 - 2]->size - subfile2.ptr;
-   if (xdl_do_diff(, , xpp, ) < 0)
-   return -1;
-
-   memcpy(diff_env->xdf1.rchg + line1 - 1, env.xdf1.rchg, count1);
-   memcpy(diff_env->xdf2.rchg + line2 - 1, env.xdf2.rchg, count2);
-
-   xdl_free_env();
-
-   return 0;
-}
diff --git a/mercurial/thirdparty/xdiff/xdiff.h 
b/mercurial/thirdparty/xdiff/xdiff.h
--- a/mercurial/thirdparty/xdiff/xdiff.h
+++ b/mercurial/thirdparty/xdiff/xdiff.h
@@ -101,10 +101,6 @@
xdl_emit_hunk_consume_func_t hunk_func;
 } xdemitconf_t;
 
-typedef struct s_bdiffparam {
-   long bsize;
-} bdiffparam_t;
-
 
 #define xdl_malloc(x) malloc(x)
 #define xdl_free(ptr) free(ptr)



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


D2683: xdiff: remove whitespace related feature

2018-03-04 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In Mercurial, whitespace related handling are done at a higher level than
  the low-level diff algorithm so "ignore spaces". So it's not used by mdiff.
  Some of the upcoming optimizations would be more difficult with whitespace
  related features kept. So let's remove them.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiff.h
  mercurial/thirdparty/xdiff/xdiffi.c
  mercurial/thirdparty/xdiff/xutils.c
  mercurial/thirdparty/xdiff/xutils.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xutils.h 
b/mercurial/thirdparty/xdiff/xutils.h
--- a/mercurial/thirdparty/xdiff/xutils.h
+++ b/mercurial/thirdparty/xdiff/xutils.h
@@ -32,7 +32,6 @@
 void xdl_cha_free(chastore_t *cha);
 void *xdl_cha_alloc(chastore_t *cha);
 long xdl_guess_lines(mmfile_t *mf, long sample);
-int xdl_blankline(const char *line, long size, long flags);
 int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags);
 unsigned long xdl_hash_record(char const **data, char const *top, long flags);
 unsigned int xdl_hashbits(unsigned int size);
diff --git a/mercurial/thirdparty/xdiff/xutils.c 
b/mercurial/thirdparty/xdiff/xutils.c
--- a/mercurial/thirdparty/xdiff/xutils.c
+++ b/mercurial/thirdparty/xdiff/xutils.c
@@ -143,168 +143,17 @@
return nl + 1;
 }
 
-int xdl_blankline(const char *line, long size, long flags)
-{
-   long i;
-
-   if (!(flags & XDF_WHITESPACE_FLAGS))
-   return (size <= 1);
-
-   for (i = 0; i < size && XDL_ISSPACE(line[i]); i++)
-   ;
-
-   return (i == size);
-}
-
-/*
- * Have we eaten everything on the line, except for an optional
- * CR at the very end?
- */
-static int ends_with_optional_cr(const char *l, long s, long i)
-{
-   int complete = s && l[s-1] == '\n';
-
-   if (complete)
-   s--;
-   if (s == i)
-   return 1;
-   /* do not ignore CR at the end of an incomplete line */
-   if (complete && s == i + 1 && l[i] == '\r')
-   return 1;
-   return 0;
-}
-
 int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
 {
-   int i1, i2;
-
if (s1 == s2 && !memcmp(l1, l2, s1))
return 1;
-   if (!(flags & XDF_WHITESPACE_FLAGS))
-   return 0;
-
-   i1 = 0;
-   i2 = 0;
-
-   /*
-* -w matches everything that matches with -b, and -b in turn
-* matches everything that matches with --ignore-space-at-eol,
-* which in turn matches everything that matches with 
--ignore-cr-at-eol.
-*
-* Each flavor of ignoring needs different logic to skip whitespaces
-* while we have both sides to compare.
-*/
-   if (flags & XDF_IGNORE_WHITESPACE) {
-   goto skip_ws;
-   while (i1 < s1 && i2 < s2) {
-   if (l1[i1++] != l2[i2++])
-   return 0;
-   skip_ws:
-   while (i1 < s1 && XDL_ISSPACE(l1[i1]))
-   i1++;
-   while (i2 < s2 && XDL_ISSPACE(l2[i2]))
-   i2++;
-   }
-   } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) {
-   while (i1 < s1 && i2 < s2) {
-   if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) {
-   /* Skip matching spaces and try again */
-   while (i1 < s1 && XDL_ISSPACE(l1[i1]))
-   i1++;
-   while (i2 < s2 && XDL_ISSPACE(l2[i2]))
-   i2++;
-   continue;
-   }
-   if (l1[i1++] != l2[i2++])
-   return 0;
-   }
-   } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) {
-   while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
-   i1++;
-   i2++;
-   }
-   } else if (flags & XDF_IGNORE_CR_AT_EOL) {
-   /* Find the first difference and see how the line ends */
-   while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
-   i1++;
-   i2++;
-   }
-   return (ends_with_optional_cr(l1, s1, i1) &&
-   ends_with_optional_cr(l2, s2, i2));
-   }
-
-   /*
-* After running out of one side, the remaining side must have
-* nothing but whitespace for the lines to match.  Note that
-* ignore-whitespace-at-eol case may break out of the loop
-* while there still are characters remaining on both lines.
-*/
-   if (i1 < s1) {
-   while (i1 < s1 && XDL_ISSPACE(l1[i1]))
-  

D2686: xdiff: add a preprocessing step that trims files

2018-03-04 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  xdiff has a `xdl_trim_ends` step that removes common lines, unmatchable
  lines. That is in theory good, but happens too late - after splitting,
  hashing, and adjusting the hash values so they are unique. Those splitting,
  hashing and adjusting hash values steps could have noticeable overhead.
  
  For not uncommon cases like diffing two large files with minor differences,
  the raw performance of those preparation steps seriously matter. Even
  allocating an O(N) array and storing line offsets to it is expensive.
  Therefore my previous attempts [1] [2] cannot be good enough since they do
  not remove the O(N) array assignment.
  
  This patch adds a preprocessing step - `xdl_trim_files` that runs before
  other preprocessing steps. It counts common prefix and suffix and lines in
  them (needed for displaying line number), without doing anything else.
  
  Testing with an emulated large (57MB) file, minor change case:
  
open('a','w').write(''.join('%s\n' % (i % 10) for i in 
xrange(1000)))
open('b','w').write(''.join('%s\n' % (i % 10) for i in xrange(1000) 
if i != 600))
  
  This patch improves the perf by more than 5x:
  
# before this patch
xdiff a b  0.65s user 0.37s system 98% cpu 1.033 total
# after this patch, gcc -O2
xdiff a b  0.10s user 0.08s system 97% cpu 0.179 total
# after this patch, gcc -O3 -mavx2
xdiff a b  0.06s user 0.08s system 98% cpu 0.142 total
# gnu diffutils
diff a b   0.04s user 0.05s system 98% cpu 0.088 total
# (best of 20 runs)
  
  It's still slow than GNU diffutils in this case. But it's much closer.
  
  Testing with real repo data:
  
  For the whole repo, this patch makes xdiff 25% faster:
  
# hg perfbdiff --count 100 --alldata -c d334afc585e2 --blocks [--xdiff]
# xdiff, after
! wall 0.058861 comb 0.05 user 0.05 sys 0.00 (best of 100)
# xdiff, before
! wall 0.077816 comb 0.08 user 0.08 sys 0.00 (best of 91)
# bdiff
! wall 0.117473 comb 0.12 user 0.12 sys 0.00 (best of 67)
  
  For files that are long (ex. commands.py), the speedup is more than 3x, very
  significant:
  
# hg perfbdiff --count 3000 --blocks commands.py.i 1 [--xdiff]
# xdiff, after
! wall 0.690583 comb 0.69 user 0.69 sys 0.00 (best of 12)
# xdiff, before
! wall 2.240361 comb 2.21 user 2.21 sys 0.00 (best of 4)
# bdiff
! wall 2.469852 comb 2.44 user 2.44 sys 0.00 (best of 4)
  
  [1]: https://phab.mercurial-scm.org/D2631
  [1]: https://phab.mercurial-scm.org/D2634

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiffi.c
  mercurial/thirdparty/xdiff/xemit.c
  mercurial/thirdparty/xdiff/xprepare.c
  mercurial/thirdparty/xdiff/xprepare.h
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -94,6 +94,7 @@
 
 typedef struct s_xdfenv {
xdfile_t xdf1, xdf2;
+   long prefix_lines, suffix_lines;
 } xdfenv_t;
 
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.h 
b/mercurial/thirdparty/xdiff/xprepare.h
--- a/mercurial/thirdparty/xdiff/xprepare.h
+++ b/mercurial/thirdparty/xdiff/xprepare.h
@@ -26,7 +26,7 @@
 
 
 int xdl_prepare_env(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
-   xdfenv_t *xe);
+   xdfenv_t *xe, xdemitconf_t const *xecfg);
 void xdl_free_env(xdfenv_t *xe);
 
 
diff --git a/mercurial/thirdparty/xdiff/xprepare.c 
b/mercurial/thirdparty/xdiff/xprepare.c
--- a/mercurial/thirdparty/xdiff/xprepare.c
+++ b/mercurial/thirdparty/xdiff/xprepare.c
@@ -61,6 +61,8 @@
 static void xdl_free_ctx(xdfile_t *xdf);
 static int xdl_clean_mmatch(char const *dis, long i, long s, long e);
 static int xdl_cleanup_records(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t 
*xdf2);
+static void xdl_trim_files(mmfile_t *mf1, mmfile_t *mf2, long reserved,
+   xdfenv_t* xe, mmfile_t *out_mf1, mmfile_t *out_mf2);
 static int xdl_trim_ends(xdfile_t *xdf1, xdfile_t *xdf2);
 static int xdl_optimize_ctxs(xdlclassifier_t *cf, xdfile_t *xdf1, xdfile_t 
*xdf2);
 
@@ -156,6 +158,105 @@
 }
 
 
+/*
+ * Trim common prefix from files.
+ * Note: need to preserve some lines for shifting to work. For example,
+ *
+ * a.py| common | b.py| common | diff
+ * | p | s  | | p | s  |
+ * ---
+ * try:| Y  | try:| Y  |
+ *   1 | Y  |   1 | Y  |
+ * except: | Y  y   | except: | Y  |
+ *   pass  | Y  y   |   pass  | Y  |
+ * try:| Y  y   | try:| Y  | +
+ *   3 |Y   |  

D2685: xdiff: add comments for fields in xdfile_t

2018-03-04 Thread quark (Jun Wu)
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes the related code easier to understand.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/thirdparty/xdiff/xtypes.h

CHANGE DETAILS

diff --git a/mercurial/thirdparty/xdiff/xtypes.h 
b/mercurial/thirdparty/xdiff/xtypes.h
--- a/mercurial/thirdparty/xdiff/xtypes.h
+++ b/mercurial/thirdparty/xdiff/xtypes.h
@@ -46,15 +46,49 @@
 } xrecord_t;
 
 typedef struct s_xdfile {
+   /* manual memory management */
chastore_t rcha;
+
+   /* number of records (lines) */
long nrec;
+
+   /* hash table size
+* the maximum hash value in the table is (1 << hbits) */
unsigned int hbits;
+
+   /* hash table, hash value => xrecord_t
+* note: xrecord_t is a linked list. */
xrecord_t **rhash;
+
+   /* range excluding common prefix and suffix
+* [recs[i] for i in range(0, dstart)] are common prefix.
+* [recs[i] for i in range(dstart, dend + 1 - dstart)] are interesting
+* lines */
long dstart, dend;
+
+   /* pointer to records (lines) */
xrecord_t **recs;
+
+   /* record changed, use original "recs" index
+* rchag[i] can be either 0 or 1. 1 means recs[i] (line i) is marked
+* "changed". */
char *rchg;
+
+   /* cleaned-up record index => original "recs" index
+* clean-up means:
+*  rule 1. remove common prefix and suffix
+*  rule 2. remove records that are only on one side, since they can
+*  not match the other side
+* rindex[0] is likely dstart, if not removed up by rule 2.
+* rindex[nreff - 1] is likely dend, if not removed by rule 2.
+*/
long *rindex;
+
+   /* rindex size */
long nreff;
+
+   /* cleaned-up record index => hash value
+* ha[i] = recs[rindex[i]]->ha */
unsigned long *ha;
 } xdfile_t;
 



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


D2634: [DRAFT] xdiff: avoid hashing trimmed lines

2018-03-04 Thread quark (Jun Wu)
quark abandoned this revision.
quark added a comment.


  https://phab.mercurial-scm.org/D2686 is a better fix

REPOSITORY
  rHG Mercurial

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

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


D2681: [PoC] scmutil: support local only obsolescence

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that we have a config option for enabling local-only obsolescence,
  it is time to do something with it.
  
  This commit teaches cleanupnodes() - which is called after rewrite
  operations - to handle local only obsolescence mode.
  
  In this mode, we create a backup bundle of the obsoleted changesets -
  just like what happens if obsolescence is disabled. But we don't strip
  the repo: we keep the original changesets around in a non-visible state.
  
  The new code verifies that no unstable changesets are introduced in
  local-only obsolescence mode.
  
  The new code hackily only runs if the action is "amend." The intent
  is to make this conditional only on the feature option. However,
  doing that would have significant test fallout. So we limit to "amend"
  for now.
  
  TODO:
  
  - Better test coverage (I think the "(testcase !)" syntax might be subtly 
wrong by flagging output as optional and not required).
  - Delete obsolescence markers when we pull and unbundle from the bundle.
  - Support pulling locally-hidden heads.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py
  tests/test-amend.t

CHANGE DETAILS

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -1,4 +1,4 @@
-#testcases obsstore-off obsstore-on
+#testcases obsstore-off obsstore-on evolution-on
 
   $ cat << EOF >> $HGRCPATH
   > [extensions]
@@ -8,10 +8,17 @@
   > git=1
   > EOF
 
-#if obsstore-on
+#if obsstore-off
+  $ cat << EOF >> $HGRCPATH
+  > [ui]
+  > localobsolescence = false
+  > EOF
+#endif
+
+#if evolution-on
   $ cat << EOF >> $HGRCPATH
   > [experimental]
-  > evolution.createmarkers=True
+  > evolution.createmarkers = true
   > EOF
 #endif
 
@@ -49,6 +56,8 @@
  +A
  \ No newline at end of file
   
+  $ hg debugobsolete
+
 #else
   $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
   @  2 be169c7e8dbe B
@@ -77,6 +86,95 @@
  +A
  \ No newline at end of file
   
+
+  $ hg debugobsolete
+  112478962961147124edd43549aedd1a335e44bf 
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'operation': 'amend', 'user': 'test'}
+
+#endif
+
+Unbundling from backup bundle restores visibility
+
+#if obsstore-on
+
+  $ cd ..
+  $ cp -r repo1 repo1-unbundle-backup
+  $ cd repo1-unbundle-backup
+
+  $ hg unbundle .hg/strip-backup/112478962961-7e959a55-amend.hg
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 0 changes to 1 files
+  (run 'hg update' to get a working copy)
+
+TODO obsmarker should be deleted, both versions should be visible
+
+  $ hg debugobsolete
+  112478962961147124edd43549aedd1a335e44bf 
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'operation': 'amend', 'user': 'test'}
+
+  $ hg log -G
+  @  changeset:   2:be169c7e8dbe
+  |  tag: tip
+  |  parent:  0:426bada5c675
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: B
+  |
+  | x  changeset:   1:112478962961
+  |/   tag: B
+  |user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |obsolete:rewritten using amend as 2:be169c7e8dbe
+  |summary: B
+  |
+  o  changeset:   0:426bada5c675
+ tag: A
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: A
+  
+
+  $ cd ..
+
+Pulling from a backup bundle restores visibility
+
+  $ cp -r repo1 repo1-pull-backup
+  $ cd repo1-pull-backup
+
+  $ hg pull .hg/strip-backup/112478962961-7e959a55-amend.hg
+  pulling from .hg/strip-backup/112478962961-7e959a55-amend.hg
+  searching for changes
+  no changes found
+
+TODO obsmarker should be deleted, both versions should be visible
+
+  $ hg debugobsolete
+  112478962961147124edd43549aedd1a335e44bf 
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'operation': 'amend', 'user': 'test'}
+
+  $ hg log -G
+  @  changeset:   2:be169c7e8dbe
+  |  tag: tip
+  |  parent:  0:426bada5c675
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: B
+  |
+  | x  changeset:   1:112478962961
+  |/   tag: B
+  |user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |obsolete:rewritten using amend as 2:be169c7e8dbe
+  |summary: B
+  |
+  o  changeset:   0:426bada5c675
+ tag: A
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: A
+  
+
+  $ cd ../repo1
+
 #endif
 
 Nothing changed
@@ -174,7 +272,7 @@
   abort: cannot amend changeset with children
   [255]
 
-#if obsstore-on
+#if evolution-on
 
 With allowunstable, amend could work in the middle of a stack
 
diff --git 

D2680: [PoC] obsolete: make markers database writable if local-only mode enabled

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg 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/D2680

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
@@ -783,7 +783,9 @@
 kwargs = {}
 if defaultformat is not None:
 kwargs[r'defaultformat'] = defaultformat
-readonly = not isenabled(repo, createmarkersopt)
+
+obsopts = getoptions(repo)
+readonly = not obsopts[createmarkersopt] and not obsopts[localonlymodeopt]
 store = obsstore(repo.svfs, readonly=readonly, **kwargs)
 if store and readonly:
 ui.warn(_('obsolete feature not enabled but %i markers found!\n')



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


D2666: repair: rename _backup to backupbundle

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg updated this revision to Diff 6636.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2666?vs=6607=6636

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

AFFECTED FILES
  hgext/histedit.py
  mercurial/repair.py

CHANGE DETAILS

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -27,7 +27,8 @@
 util,
 )
 
-def _bundle(repo, bases, heads, node, suffix, compress=True, 
obsolescence=True):
+def backupbundle(repo, bases, heads, node, suffix, compress=True,
+ obsolescence=True):
 """create a bundle with the specified revisions as a backup"""
 
 backupdir = "strip-backup"
@@ -166,7 +167,7 @@
 vfs = repo.vfs
 node = nodelist[-1]
 if backup:
-backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
+backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
 repo.ui.status(_("saved backup bundle to %s\n") %
vfs.join(backupfile))
 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
@@ -179,8 +180,8 @@
 # we are trying to strip.  This is harmless since the stripped markers
 # are already backed up and we did not touched the markers for the
 # saved changesets.
-tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
-compress=False, obsolescence=False)
+tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp',
+ compress=False, obsolescence=False)
 
 try:
 with repo.transaction("strip") as tr:
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1317,8 +1317,8 @@
 # Create a backup so we can always abort completely.
 backupfile = None
 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
-backupfile = repair._bundle(repo, [parentctxnode], [topmost], root,
-'histedit')
+backupfile = repair.backupbundle(repo, [parentctxnode],
+ [topmost], root, 'histedit')
 state.backupfile = backupfile
 
 def _getsummary(ctx):



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


D2682: [PoC] changegroup: delete obs markers when applying changegroup

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In local-only obsolescence mode, our short-term hack to unhide a
  changeset is to delete obsolescence markers causing it to be hidden.
  We need to do this every time a changeset is introduced into the
  repository.
  
  I was hoping we could implement the unhide logic once, around
  transaction close time. However, it appears that we'll need to
  teach every mechanism that introduces changesets to unhide
  changesets because of interaction between those mechanisms and
  visibility. For example, changegroup application no-ops on incoming
  changesets that are present but hidden. The code that scans for
  "new" changesets is based on changesets between the old and new
  changelog length. Since the unhidden changeset is possibly older
  than the old changelog length, we need to either track unhides
  explicitly or deal with them specially.
  
  This commit teaches changegroup application to record which changesets
  are in the incoming changegroup so it can scan for relevant
  obsolescence markers after changegroup applications and delete
  their markers.
  
  I'm not convinced this is the best approach to the problem. But it's
  a start.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changegroup.py
  tests/test-amend.t

CHANGE DETAILS

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -102,15 +102,13 @@
 
   $ hg unbundle .hg/strip-backup/112478962961-7e959a55-amend.hg
   adding changesets
+  unhiding 1 changesets
   adding manifests
   adding file changes
   added 0 changesets with 0 changes to 1 files
   (run 'hg update' to get a working copy)
 
-TODO obsmarker should be deleted, both versions should be visible
-
   $ hg debugobsolete
-  112478962961147124edd43549aedd1a335e44bf 
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '8', 'operation': 'amend', 'user': 'test'}
 
   $ hg log -G
   @  changeset:   2:be169c7e8dbe
@@ -120,11 +118,10 @@
   |  date:Thu Jan 01 00:00:00 1970 +
   |  summary: B
   |
-  | x  changeset:   1:112478962961
+  | o  changeset:   1:112478962961
   |/   tag: B
   |user:test
   |date:Thu Jan 01 00:00:00 1970 +
-  |obsolete:rewritten using amend as 2:be169c7e8dbe
   |summary: B
   |
   o  changeset:   0:426bada5c675
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -23,6 +23,7 @@
 dagutil,
 error,
 mdiff,
+obsolete,
 phases,
 pycompat,
 util,
@@ -259,7 +260,15 @@
 - number of heads stays the same: 1
 """
 repo = repo.unfiltered()
+
+incomingnodes = set()
+localonlyobs = obsolete.getoptions(repo)[obsolete.localonlymodeopt]
+
 def csmap(x):
+# Don't bother tracking if we don't do anything with data.
+if localonlyobs:
+incomingnodes.add(x)
+
 repo.ui.debug("add changeset %s\n" % short(x))
 return len(cl)
 
@@ -308,6 +317,17 @@
 cgnodes = cl.addgroup(deltas, csmap, trp, 
addrevisioncb=onchangelog)
 efiles = len(efiles)
 
+# TODO do we need to invalidate visibility caches when we
+# remove markers?
+if localonlyobs and incomingnodes:
+indices = [i for i, t in enumerate(repo.obsstore._all)
+   if t[0] in incomingnodes]
+if indices:
+from . import repair
+# TODO is # markers == # unhidden changesets?
+repo.ui.status(_('unhiding %d changesets\n') % 
len(indices))
+repair.deleteobsmarkers(repo.obsstore, indices)
+
 if not cgnodes:
 repo.ui.develwarn('applied empty changegroup',
   config='warn-empty-changegroup')



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


D2679: [PoC] obsolete: config option to enable local only obsolescence mode

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Our path to enable obsolescence/evolve in core is to enable
  creation of markers locally (no exchange) with user-facing behavior
  that mimics existing behavior as closely as possible. Think of it
  as evolve light.
  
  We introduce a config option to control this behavior.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -98,6 +98,7 @@
 createmarkersopt = 'createmarkers'
 allowunstableopt = 'allowunstable'
 exchangeopt = 'exchange'
+localonlymodeopt = 'localonly'
 
 def _getoptionvalue(repo, option):
 """Returns True if the given repository has the given obsolete option
@@ -139,6 +140,15 @@
 createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
 unstablevalue = _getoptionvalue(repo, allowunstableopt)
 exchangevalue = _getoptionvalue(repo, exchangeopt)
+localonlyvalue = repo.ui.configbool('ui', 'localobsolescence')
+
+# Evolution options take precedence over local only mode.
+if createmarkersvalue or unstablevalue or exchangevalue:
+localonlyvalue = False
+
+# We /could/ have local only mode imply createmarkers, but this would
+# have significant implications in core. For now, wait until core
+# consumers are aware of local only mode before implying this option.
 
 # createmarkers must be enabled if other options are enabled
 if ((unstablevalue or exchangevalue) and not createmarkersvalue):
@@ -149,6 +159,7 @@
 createmarkersopt: createmarkersvalue,
 allowunstableopt: unstablevalue,
 exchangeopt: exchangevalue,
+localonlymodeopt: localonlyvalue,
 }
 
 def isenabled(repo, option):
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1038,6 +1038,9 @@
 coreconfigitem('ui', 'interface.chunkselector',
 default=None,
 )
+coreconfigitem('ui', 'localobsolescence',
+default=True,
+)
 coreconfigitem('ui', 'logblockedtimes',
 default=False,
 )



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


D2678: help: supporting both help and doc for aliases

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  Ok, should be good to go now :)

REPOSITORY
  rHG Mercurial

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

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


D2678: help: supporting both help and doc for aliases

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 6635.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2678?vs=6634=6635

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

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

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -769,9 +769,9 @@
   $ hg help shellalias
   hg shellalias
   
-  shell alias for:
-  
-echo hi
+  shell alias for: echo hi
+  
+  (no help text available)
   
   defined by: helpext
   
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -4,9 +4,13 @@
   > # should clobber ci but not commit (issue2993)
   > ci = version
   > myinit = init
+  > myinit:doc = This is my documented alias for init.
+  > myinit:help = [OPTIONS] [BLA] [BLE]
   > mycommit = commit
+  > mycommit:doc = This is my alias with only doc.
   > optionalrepo = showconfig alias.myinit
   > cleanstatus = status -c
+  > cleanstatus:help = [ONLYHELPHERE]
   > unknown = bargle
   > ambiguous = s
   > recursive = recursive
@@ -53,11 +57,135 @@
   > log = -v
   > EOF
 
-
 basic
 
   $ hg myinit alias
 
+help
+
+  $ hg help -c | grep myinit
+   myinit This is my documented alias for init.
+  $ hg help -c | grep mycommit
+   mycommit   This is my alias with only doc.
+  $ hg help -c | grep cleanstatus
+   cleanstatusshow changed files in the working directory
+  $ hg help myinit
+  hg myinit [OPTIONS] [BLA] [BLE]
+  
+  alias for: hg init
+  
+  This is my documented alias for init.
+  
+  defined by: * (glob)
+  */* (glob) (?)
+  */* (glob) (?)
+  */* (glob) (?)
+  
+  options:
+  
+   -e --ssh CMD   specify ssh command to use
+  --remotecmd CMD specify hg command to run on the remote side
+  --insecure  do not verify server certificate (ignoring web.cacerts
+  config)
+  
+  (some details hidden, use --verbose to show complete help)
+
+  $ hg help mycommit
+  hg mycommit [OPTION]... [FILE]...
+  
+  alias for: hg commit
+  
+  This is my alias with only doc.
+  
+  defined by: * (glob)
+  */* (glob) (?)
+  */* (glob) (?)
+  */* (glob) (?)
+  
+  options ([+] can be repeated):
+  
+   -A --addremove   mark new/missing files as added/removed before
+committing
+  --close-branchmark a branch head as closed
+  --amend   amend the parent of the working directory
+   -s --secret  use the secret phase for committing
+   -e --editinvoke editor on commit messages
+   -i --interactive use interactive mode
+   -I --include PATTERN [+] include names matching the given patterns
+   -X --exclude PATTERN [+] exclude names matching the given patterns
+   -m --message TEXTuse text as commit message
+   -l --logfile FILEread commit message from file
+   -d --date DATE   record the specified date as commit date
+   -u --user USER   record the specified user as committer
+   -S --subreposrecurse into subrepositories
+  
+  (some details hidden, use --verbose to show complete help)
+
+  $ hg help cleanstatus
+  hg cleanstatus [ONLYHELPHERE]
+  
+  alias for: hg status -c
+  
+  show changed files in the working directory
+  
+  Show status of files in the repository. If names are given, only files
+  that match are shown. Files that are clean or ignored or the source of a
+  copy/move operation, are not listed unless -c/--clean, -i/--ignored,
+  -C/--copies or -A/--all are given. Unless options described with "show
+  only ..." are given, the options -mardu are used.
+  
+  Option -q/--quiet hides untracked (unknown and ignored) files unless
+  explicitly requested with -u/--unknown or -i/--ignored.
+  
+  Note:
+ 'hg status' may appear to disagree with diff if permissions have
+ changed or a merge has occurred. The standard diff format does not
+ report permission changes and diff only reports changes relative to 
one
+ merge parent.
+  
+  If one revision is given, it is used as the base revision. If two
+  revisions are given, the differences between them are shown. The --change
+  option can also be used as a shortcut to list the changed files of a
+  revision from its first parent.
+  
+  The codes used to show the status of files are:
+  
+M = modified
+A = added
+R = removed
+C = clean
+! = missing (deleted by non-hg command, but still tracked)
+? = not tracked
+I = ignored
+  = origin of the previous file (with --copies)
+  
+  Returns 0 on success.
+  
+  defined by: * (glob)
+  */* (glob) (?)
+  */* (glob) (?)
+  */* (glob) (?)
+  
+  options ([+] can be repeated):
+  
+   -A --all 

D2678: help: supporting both help and doc for aliases

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  (I'll have more test updates in a min, sorry, please hold :) )

REPOSITORY
  rHG Mercurial

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

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


D2678: help: supporting both help and doc for aliases

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  In https://phab.mercurial-scm.org/D2678#43196, @pulkit wrote:
  
  > I am very very much excited about this. But, this patch lacks test. :(
  
  
  Sorry, added now (and re-running tests in parallel)

REPOSITORY
  rHG Mercurial

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

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


D2678: help: supporting both help and doc for aliases

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 6634.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2678?vs=6632=6634

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

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

CHANGE DETAILS

diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -4,6 +4,8 @@
   > # should clobber ci but not commit (issue2993)
   > ci = version
   > myinit = init
+  > myinit:doc = This is my documented alias for init.
+  > myinit:help = [OPTIONS] [BLA] [BLE]
   > mycommit = commit
   > optionalrepo = showconfig alias.myinit
   > cleanstatus = status -c
@@ -53,11 +55,34 @@
   > log = -v
   > EOF
 
-
 basic
 
   $ hg myinit alias
 
+help
+
+  $ hg help -c | grep myinit
+   myinit This is my documented alias for init.
+  $ hg help myinit
+  hg myinit [OPTIONS] [BLA] [BLE]
+  
+  alias for: hg init
+  
+  This is my documented alias for init.
+  
+  defined by: * (glob)
+  */* (glob) (?)
+  */* (glob) (?)
+  */* (glob) (?)
+  
+  options:
+  
+   -e --ssh CMD   specify ssh command to use
+  --remotecmd CMD specify hg command to run on the remote side
+  --insecure  do not verify server certificate (ignoring web.cacerts
+  config)
+  
+  (some details hidden, use --verbose to show complete help)
 
 unknown
 
@@ -440,6 +465,10 @@
   > rebate = !echo this is \$HG_ARGS
   > EOF
 #endif
+  $ cat >> .hg/hgrc < rebate:doc = This is my alias which just prints something.
+  > rebate:help = [MYARGS]
+  > EOF
   $ hg reba
   hg: command 'reba' is ambiguous:
   rebase rebate
@@ -449,6 +478,24 @@
   $ hg rebat --foo-bar
   this is rebate --foo-bar
 
+help for a shell alias
+
+  $ hg help -c | grep rebate
+   rebate This is my alias which just prints something.
+  $ hg help rebate
+  hg rebate [MYARGS]
+  
+  shell alias for:: echo this is $HG_ARGS
+  
+  This is my alias which just prints something.
+  
+  defined by:* (glob)
+  */* (glob) (?)
+  */* (glob) (?)
+  */* (glob) (?)
+  
+  (some details hidden, use --verbose to show complete help)
+
 invalid arguments
 
   $ hg rt foo
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -366,8 +366,8 @@
 if util.safehasattr(entry[0], 'definition'):  # aliased command
 source = entry[0].source
 if entry[0].definition.startswith('!'):  # shell alias
-doc = (_('shell alias for::\n\n%s\n\ndefined by: %s\n') %
-   (entry[0].definition[1:], source))
+doc = (_('shell alias for:: %s\n\n%s\n\ndefined by: %s\n') %
+   (entry[0].definition[1:], doc, source))
 else:
 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') %
(entry[0].definition, doc, source))
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -420,7 +420,7 @@
 return r.sub(lambda x: replacemap[x.group()], cmd)
 
 class cmdalias(object):
-def __init__(self, name, definition, cmdtable, source):
+def __init__(self, ui, name, definition, cmdtable, source):
 self.name = self.cmd = name
 self.cmdname = ''
 self.definition = definition
@@ -447,6 +447,7 @@
 return
 
 if self.definition.startswith('!'):
+shdef = self.definition[1:]
 self.shell = True
 def fn(ui, *args):
 env = {'HG_ARGS': ' '.join((self.name,) + args)}
@@ -460,11 +461,12 @@
  "of %i variable in alias '%s' definition.\n"
  % (int(m.groups()[0]), self.name))
 return ''
-cmd = re.sub(br'\$(\d+|\$)', _checkvar, self.definition[1:])
+cmd = re.sub(br'\$(\d+|\$)', _checkvar, shdef)
 cmd = aliasinterpolate(self.name, args, cmd)
 return ui.system(cmd, environ=env,
  blockedtag='alias_%s' % self.name)
 self.fn = fn
+self._populatehelp(ui, name, shdef, self.fn)
 return
 
 try:
@@ -486,14 +488,12 @@
 try:
 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
 if len(tableentry) > 2:
-self.fn, self.opts, self.help = tableentry
+self.fn, self.opts, cmdhelp = tableentry
 else:
 self.fn, self.opts = tableentry
+cmdhelp = None
 
-if self.help.startswith("hg " + cmd):
-# drop prefix in old-style help lines so hg shows the alias
-self.help = self.help[4 + len(cmd):]
-self.__doc__ = self.fn.__doc__
+self._populatehelp(ui, name, cmd, self.fn, cmdhelp)
 
 except 

Re: [PATCH 1 of 4] py3: fix int formatting of "incoming changes" log

2018-03-04 Thread Pulkit Goyal
Queued the series. Many thanks.

On Mon, Mar 5, 2018 at 3:49 AM, Yuya Nishihara  wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1520200097 18000
> #  Sun Mar 04 16:48:17 2018 -0500
> # Node ID bbfaa4a0a9fde9170af65ef333e63f7e4626e81e
> # Parent  b77ff4fbe9ad2a27454f0edc9a9772bbc3128b28
> py3: fix int formatting of "incoming changes" log
>
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -411,7 +411,7 @@ class cg1unpacker(object):
>  newheads = [h for h in repo.heads()
>  if h not in oldheads]
>  repo.ui.log("incoming",
> -"%s incoming changes - new heads: %s\n",
> +"%d incoming changes - new heads: %s\n",
>  len(added),
>  ', '.join([hex(c[:6]) for c in newheads]))
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4] py3: make blackbox-readonly-dispatch.py use ui instead of print()

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520200235 18000
#  Sun Mar 04 16:50:35 2018 -0500
# Node ID 57d883c2f3d5bd975985356e7d9a8942d72cac9e
# Parent  bbfaa4a0a9fde9170af65ef333e63f7e4626e81e
py3: make blackbox-readonly-dispatch.py use ui instead of print()

diff --git a/tests/blackbox-readonly-dispatch.py 
b/tests/blackbox-readonly-dispatch.py
--- a/tests/blackbox-readonly-dispatch.py
+++ b/tests/blackbox-readonly-dispatch.py
@@ -1,7 +1,8 @@
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import
 import os
 from mercurial import (
 dispatch,
+ui as uimod,
 )
 
 def testdispatch(cmd):
@@ -9,10 +10,11 @@ def testdispatch(cmd):
 
 Prints command and result value, but does not handle quoting.
 """
-print("running: %s" % (cmd,))
-req = dispatch.request(cmd.split())
+ui = uimod.ui.load()
+ui.status("running: %s\n" % cmd)
+req = dispatch.request(cmd.split(), ui)
 result = dispatch.dispatch(req)
-print("result: %r" % (result,))
+ui.status("result: %r\n" % result)
 
 # create file 'foo', add and commit
 f = open('foo', 'wb')
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 4] py3: byte-stringify blackbox-readonly-dispatch.py

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520200454 18000
#  Sun Mar 04 16:54:14 2018 -0500
# Node ID 1bae4c65f65cce76e5337fd392db53ca442bdfec
# Parent  57d883c2f3d5bd975985356e7d9a8942d72cac9e
py3: byte-stringify blackbox-readonly-dispatch.py

# skip-blame because just adding some b''

diff --git a/tests/blackbox-readonly-dispatch.py 
b/tests/blackbox-readonly-dispatch.py
--- a/tests/blackbox-readonly-dispatch.py
+++ b/tests/blackbox-readonly-dispatch.py
@@ -11,28 +11,28 @@ def testdispatch(cmd):
 Prints command and result value, but does not handle quoting.
 """
 ui = uimod.ui.load()
-ui.status("running: %s\n" % cmd)
+ui.status(b"running: %s\n" % cmd)
 req = dispatch.request(cmd.split(), ui)
 result = dispatch.dispatch(req)
-ui.status("result: %r\n" % result)
+ui.status(b"result: %r\n" % result)
 
 # create file 'foo', add and commit
-f = open('foo', 'wb')
-f.write('foo\n')
+f = open(b'foo', 'wb')
+f.write(b'foo\n')
 f.close()
-testdispatch("--debug add foo")
-testdispatch("--debug commit -m commit1 -d 2000-01-01 foo")
+testdispatch(b"--debug add foo")
+testdispatch(b"--debug commit -m commit1 -d 2000-01-01 foo")
 
 # append to file 'foo' and commit
-f = open('foo', 'ab')
-f.write('bar\n')
+f = open(b'foo', 'ab')
+f.write(b'bar\n')
 f.close()
 # remove blackbox.log directory (proxy for readonly log file)
-os.rmdir(".hg/blackbox.log")
+os.rmdir(b".hg/blackbox.log")
 # replace it with the real blackbox.log file
-os.rename(".hg/blackbox.log-", ".hg/blackbox.log")
-testdispatch("--debug commit -m commit2 -d 2000-01-02 foo")
+os.rename(b".hg/blackbox.log-", b".hg/blackbox.log")
+testdispatch(b"--debug commit -m commit2 -d 2000-01-02 foo")
 
 # check 88803a69b24 (fancyopts modified command table)
-testdispatch("--debug log -r 0")
-testdispatch("--debug log -r tip")
+testdispatch(b"--debug log -r 0")
+testdispatch(b"--debug log -r tip")
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 4] py3: byte-stringify test-blackbox.t

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520200551 18000
#  Sun Mar 04 16:55:51 2018 -0500
# Node ID 8c6317e695dc2e9721b83f67079c5d129685395e
# Parent  1bae4c65f65cce76e5337fd392db53ca442bdfec
py3: byte-stringify test-blackbox.t

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -16,6 +16,7 @@ test-backwards-remove.t
 test-basic.t
 test-bheads.t
 test-bisect2.t
+test-blackbox.t
 test-bookmarks-current.t
 test-bookmarks-merge.t
 test-bookmarks-rebase.t
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -265,7 +265,7 @@ Test log recursion from dirty status che
   > from mercurial import context, error, extensions
   > x=[False]
   > def status(orig, *args, **opts):
-  > args[0].repo().ui.log("broken", "recursion?")
+  > args[0].repo().ui.log(b"broken", b"recursion?")
   > return orig(*args, **opts)
   > def reposetup(ui, repo):
   > extensions.wrapfunction(context.basectx, 'status', status)
@@ -344,7 +344,7 @@ blackbox should work if repo.ui.log is n
   > from mercurial import registrar, scmutil
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('raise')
+  > @command(b'raise')
   > def raisecmd(*args):
   > raise RuntimeError('raise')
   > EOF
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 4] py3: fix int formatting of "incoming changes" log

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520200097 18000
#  Sun Mar 04 16:48:17 2018 -0500
# Node ID bbfaa4a0a9fde9170af65ef333e63f7e4626e81e
# Parent  b77ff4fbe9ad2a27454f0edc9a9772bbc3128b28
py3: fix int formatting of "incoming changes" log

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -411,7 +411,7 @@ class cg1unpacker(object):
 newheads = [h for h in repo.heads()
 if h not in oldheads]
 repo.ui.log("incoming",
-"%s incoming changes - new heads: %s\n",
+"%d incoming changes - new heads: %s\n",
 len(added),
 ', '.join([hex(c[:6]) for c in newheads]))
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2676: tests: stop over-specifying tempfile name

2018-03-04 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 6633.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2676?vs=6628=6633

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

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-merge-tools.t

CHANGE DETAILS

diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -1558,7 +1558,7 @@
   $ hg update -q -C 2
   $ hg merge -y -r tip --tool echo --config merge-tools.echo.args='$base 
$local $other $output'
   merging f and f.txt to f.txt
-  */f~base.?? $TESTTMP/f.txt.orig */f~other.??.txt $TESTTMP/f.txt 
(glob)
+  */f~base.* $TESTTMP/f.txt.orig */f~other.*.txt $TESTTMP/f.txt (glob)
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -204,6 +204,7 @@
 test-merge-revert2.t
 test-merge-subrepos.t
 test-merge-symlinks.t
+test-merge-tools.t
 test-merge-types.t
 test-merge1.t
 test-merge10.t



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


D2678: help: supporting both help and doc for aliases

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  I am very very much excited about this. But, this patch lacks test. :(

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 1 of 4 STABLE] test-subrepo: demonstrate problems with subrepo sharing and absolute paths

2018-03-04 Thread Matt Harbison

On Sun, 04 Mar 2018 08:20:07 -0500, Yuya Nishihara  wrote:


On Sat, 03 Mar 2018 23:03:25 -0500, Matt Harbison wrote:

# HG changeset patch
# User Matt Harbison 
# Date 1519795767 18000
#  Wed Feb 28 00:29:27 2018 -0500
# Branch stable
# Node ID eca5075fdd5ec15e1a4917c0cadeb23e00feb2fe
# Parent  0a7c59a4c8352b9277a9676708cf6a30d3e2e306
test-subrepo: demonstrate problems with subrepo sharing and absolute  
paths


Queued for stable, many thanks.


Any idea what the easiest way to snoop on the manifest hash generation is,  
to see what is being fed in, and hopefully why the test is unstable?  I  
have no idea where that's done.

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


D2678: help: supporting both help and doc for aliases

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

REVISION SUMMARY
  This allows an alias to be definted like:
  
  [alias]
  lj = log -Tjson
  lj:help = [-r REV]
  lj:doc = Shows the revision log in JSON format.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -420,7 +420,7 @@
 return r.sub(lambda x: replacemap[x.group()], cmd)
 
 class cmdalias(object):
-def __init__(self, name, definition, cmdtable, source):
+def __init__(self, ui, name, definition, cmdtable, source):
 self.name = self.cmd = name
 self.cmdname = ''
 self.definition = definition
@@ -447,6 +447,7 @@
 return
 
 if self.definition.startswith('!'):
+shdef = self.definition[1:]
 self.shell = True
 def fn(ui, *args):
 env = {'HG_ARGS': ' '.join((self.name,) + args)}
@@ -460,11 +461,12 @@
  "of %i variable in alias '%s' definition.\n"
  % (int(m.groups()[0]), self.name))
 return ''
-cmd = re.sub(br'\$(\d+|\$)', _checkvar, self.definition[1:])
+cmd = re.sub(br'\$(\d+|\$)', _checkvar, shdef)
 cmd = aliasinterpolate(self.name, args, cmd)
 return ui.system(cmd, environ=env,
  blockedtag='alias_%s' % self.name)
 self.fn = fn
+self._populatehelp(ui, name, shdef, self.fn)
 return
 
 try:
@@ -486,14 +488,12 @@
 try:
 tableentry = cmdutil.findcmd(cmd, cmdtable, False)[1]
 if len(tableentry) > 2:
-self.fn, self.opts, self.help = tableentry
+self.fn, self.opts, cmdhelp = tableentry
 else:
 self.fn, self.opts = tableentry
+cmdhelp = None
 
-if self.help.startswith("hg " + cmd):
-# drop prefix in old-style help lines so hg shows the alias
-self.help = self.help[4 + len(cmd):]
-self.__doc__ = self.fn.__doc__
+self._populatehelp(ui, name, cmd, self.fn, cmdhelp)
 
 except error.UnknownCommand:
 self.badalias = (_("alias '%s' resolves to unknown command '%s'")
@@ -503,6 +503,14 @@
 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'")
  % (self.name, cmd))
 
+def _populatehelp(self, ui, name, cmd, fn, defaulthelp=None):
+self.help = ui.config('alias', '%s:help' % name, defaulthelp or '')
+if self.help and self.help.startswith("hg " + cmd):
+# drop prefix in old-style help lines so hg shows the alias
+self.help = self.help[4 + len(cmd):]
+
+self.__doc__ = ui.config('alias', '%s:doc' % name, fn.__doc__)
+
 @property
 def args(self):
 args = pycompat.maplist(util.expandpath, self.givenargs)
@@ -547,15 +555,17 @@
 class lazyaliasentry(object):
 """like a typical command entry (func, opts, help), but is lazy"""
 
-def __init__(self, name, definition, cmdtable, source):
+def __init__(self, ui, name, definition, cmdtable, source):
+self.ui = ui
 self.name = name
 self.definition = definition
 self.cmdtable = cmdtable.copy()
 self.source = source
 
 @util.propertycache
 def _aliasdef(self):
-return cmdalias(self.name, self.definition, self.cmdtable, self.source)
+return cmdalias(self.ui, self.name, self.definition, self.cmdtable,
+self.source)
 
 def __getitem__(self, n):
 aliasdef = self._aliasdef
@@ -579,16 +589,16 @@
 # aliases are processed after extensions have been loaded, so they
 # may use extension commands. Aliases can also use other alias definitions,
 # but only if they have been defined prior to the current definition.
-for alias, definition in ui.configitems('alias'):
+for alias, definition in ui.configitems('alias', ignoresub=True):
 try:
 if cmdtable[alias].definition == definition:
 continue
 except (KeyError, AttributeError):
 # definition might not exist or it might not be a cmdalias
 pass
 
 source = ui.configsource('alias', alias)
-entry = lazyaliasentry(alias, definition, cmdtable, source)
+entry = lazyaliasentry(ui, alias, definition, cmdtable, source)
 cmdtable[alias] = entry
 
 def _parse(ui, args):
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -114,7 +114,7 @@
 coreconfigitem = 

D2677: largefiles: use %d instead of %s to process ints

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5c72b52d3dd0: largefiles: use %d instead of %s to process 
ints (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2677?vs=6629=6631

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

AFFECTED FILES
  hgext/largefiles/overrides.py

CHANGE DETAILS

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -812,7 +812,7 @@
 repo.firstpulled = revsprepull # for pulled() revset expression
 try:
 for rev in scmutil.revrange(repo, lfrevs):
-ui.note(_('pulling largefiles for revision %s\n') % rev)
+ui.note(_('pulling largefiles for revision %d\n') % rev)
 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
 numcached += len(cached)
 finally:



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


D2674: transaction: fix an error string with bytestr() on a repr()d value

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGef345f9e4295: transaction: fix an error string with 
bytestr() on a repr()d value (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2674?vs=6626=6630

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

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/transaction.py

CHANGE DETAILS

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -18,6 +18,7 @@
 from .i18n import _
 from . import (
 error,
+pycompat,
 util,
 )
 
@@ -604,7 +605,8 @@
 f, o = l.split('\0')
 entries.append((f, int(o), None))
 except ValueError:
-report(_("couldn't read journal entry %r!\n") % l)
+report(
+_("couldn't read journal entry %r!\n") % pycompat.bytestr(l))
 
 backupjournal = "%s.backupfiles" % file
 if opener.exists(backupjournal):
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -347,6 +347,7 @@
 test-revlog-packentry.t
 test-revset-dirstate-parents.t
 test-revset-outgoing.t
+test-rollback.t
 test-run-tests.py
 test-schemes.t
 test-serve.t



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


D2668: rebase: introduce support for automatically rebasing orphan changes

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


  I'm +1 on the feature. We should bikeshed the naming.

INLINE COMMENTS

> rebase.py:123
>  
> +def _possibledestination(repo, rev):
> +"""Return all changesets that may be a new parent for `rev`."""

Let's add this to `destutil.py` instead of adding more code to `rebase.py`.

> rebase.py:147
> +dr = torev(n)
> +if dr != -1:
> +dest.add(dr)

This should use the `node.nullrev` constant.

> rebase.py:702
> +('a', 'abort', False, _('abort an interrupted rebase')),
> +('', 'auto', '', _('automatically rebase orphan revisions '
> +   'in the specified revset (EXPERIMENTAL)')),

The fact that `auto` takes an argument makes it... not very //auto//.

I have a slight preference for ``--orphans ``. All the other arguments 
that take revsets are nouns describing what will be operated on, what the 
revisions are being used for, etc.

> rebase.py:837
> +if opts.get('auto'):
> +for disallowed in 'rev', 'source', 'base', 'dest':
> +if opts.get(disallowed):

An allow list is better. But I could let this slide.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH] xdiff: fix trivial build warnings on Windows

2018-03-04 Thread Matt Harbison
On Sun, 04 Mar 2018 16:45:28 -0500, Matt Harbison   
wrote:



# HG changeset patch
# User Matt Harbison 
# Date 1520197662 18000
#  Sun Mar 04 16:07:42 2018 -0500
# Node ID c4a6b599a46f93070f5492c9e68566e6be570d2f
# Parent  1f9bbd1d6b8ae4f7ea5d9f4310269a3b0242e7b0
xdiff: fix trivial build warnings on Windows

These are mostly size_t to int/long conversions that are obviously safe,  
along
with a signed/unsigned comparison.  I don't have clang, so I tried  
following the

existing whitespace convention in each module.


The remaining xdiff warnings are:

mercurial/thirdparty/xdiff/xmerge.c(352) : warning C4244: '=' : conversion  
from '__int64' to 'long', possible loss of data
mercurial/thirdparty/xdiff/xmerge.c(355) : warning C4244: '=' : conversion  
from '__int64' to 'long', possible loss of data
mercurial/thirdparty/xdiff/xutils.c(412) : warning C4244: '=' : conversion  
from '__int64' to 'long', possible loss of data
mercurial/thirdparty/xdiff/xutils.c(415) : warning C4244: '=' : conversion  
from '__int64' to 'long', possible loss of data


These are a bit more concerning, because it looks like two randomish  
pointers are subtracted.  I haven't spent much time trying to understand  
the code, so presumably there's something ensuring that these values stay  
close to each other?  'long' is only 32 bit on Windows, so maybe the size  
field in mmbuffer_t and mmfile_t should be size_t/ptrdiff_t?

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


D2676: tests: stop over-specifying tempfile name

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

REVISION SUMMARY
  Python 3 has more random characters in the default template, which is fine.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-merge-tools.t

CHANGE DETAILS

diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -1558,7 +1558,7 @@
   $ hg update -q -C 2
   $ hg merge -y -r tip --tool echo --config merge-tools.echo.args='$base 
$local $other $output'
   merging f and f.txt to f.txt
-  */f~base.?? $TESTTMP/f.txt.orig */f~other.??.txt $TESTTMP/f.txt 
(glob)
+  */f~base.* $TESTTMP/f.txt.orig */f~other.*.txt $TESTTMP/f.txt (glob)
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
 
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -201,6 +201,7 @@
 test-merge-revert2.t
 test-merge-subrepos.t
 test-merge-symlinks.t
+test-merge-tools.t
 test-merge-types.t
 test-merge1.t
 test-merge10.t



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


D2675: debugcommands: fix some %r output with bytestr() wrappers

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

REVISION SUMMARY
  Almost fixes test-merge-tools.t. I think the remaining failure there
  is due to some overspecified tempfile names.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1770,15 +1770,15 @@
 overrides = {}
 if opts['tool']:
 overrides[('ui', 'forcemerge')] = opts['tool']
-ui.note(('with --tool %r\n') % (opts['tool']))
+ui.note(('with --tool %r\n') % (pycompat.bytestr(opts['tool'])))
 
 with ui.configoverride(overrides, 'debugmergepatterns'):
 hgmerge = encoding.environ.get("HGMERGE")
 if hgmerge is not None:
-ui.note(('with HGMERGE=%r\n') % (hgmerge))
+ui.note(('with HGMERGE=%r\n') % (pycompat.bytestr(hgmerge)))
 uimerge = ui.config("ui", "merge")
 if uimerge:
-ui.note(('with ui.merge=%r\n') % (uimerge))
+ui.note(('with ui.merge=%r\n') % (pycompat.bytestr(uimerge)))
 
 ctx = scmutil.revsingle(repo, opts.get('rev'))
 m = scmutil.match(ctx, pats, opts)



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


D2677: largefiles: use %d instead of %s to process ints

2018-03-04 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/D2677

AFFECTED FILES
  hgext/largefiles/overrides.py

CHANGE DETAILS

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -812,7 +812,7 @@
 repo.firstpulled = revsprepull # for pulled() revset expression
 try:
 for rev in scmutil.revrange(repo, lfrevs):
-ui.note(_('pulling largefiles for revision %s\n') % rev)
+ui.note(_('pulling largefiles for revision %d\n') % rev)
 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
 numcached += len(cached)
 finally:



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


D2674: transaction: fix an error string with bytestr() on a repr()d value

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

REVISION SUMMARY
  Fixes test-rollback.t on Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/transaction.py

CHANGE DETAILS

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -18,6 +18,7 @@
 from .i18n import _
 from . import (
 error,
+pycompat,
 util,
 )
 
@@ -604,7 +605,8 @@
 f, o = l.split('\0')
 entries.append((f, int(o), None))
 except ValueError:
-report(_("couldn't read journal entry %r!\n") % l)
+report(
+_("couldn't read journal entry %r!\n") % pycompat.bytestr(l))
 
 backupjournal = "%s.backupfiles" % file
 if opener.exists(backupjournal):
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -344,6 +344,7 @@
 test-revlog-packentry.t
 test-revset-dirstate-parents.t
 test-revset-outgoing.t
+test-rollback.t
 test-run-tests.py
 test-schemes.t
 test-serve.t



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


Re: [PATCH 1 of 6] py3: use startswith() instead of slicing to detect leading whitespace

2018-03-04 Thread Pulkit Goyal
Queued the series. Many thanks!

On Mon, Mar 5, 2018 at 3:11 AM, Yuya Nishihara  wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1520195085 18000
> #  Sun Mar 04 15:24:45 2018 -0500
> # Node ID f7cd53c5127f248f5d075ad28b6be82558b7c35d
> # Parent  6bacb2f663cb07f58bb493db5f21ae321d5a2e06
> py3: use startswith() instead of slicing to detect leading whitespace
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -158,7 +158,7 @@ def _formatparse(write, inst):
>  if len(inst.args) > 1:
>  write(_("hg: parse error at %s: %s\n") %
>(pycompat.bytestr(inst.args[1]), inst.args[0]))
> -if (inst.args[0][0] == ' '):
> +if inst.args[0].startswith(' '):
>  write(_("unexpected leading whitespace\n"))
>  else:
>  write(_("hg: parse error: %s\n") % inst.args[0])
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] xdiff: fix trivial build warnings on Windows

2018-03-04 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1520197662 18000
#  Sun Mar 04 16:07:42 2018 -0500
# Node ID c4a6b599a46f93070f5492c9e68566e6be570d2f
# Parent  1f9bbd1d6b8ae4f7ea5d9f4310269a3b0242e7b0
xdiff: fix trivial build warnings on Windows

These are mostly size_t to int/long conversions that are obviously safe, along
with a signed/unsigned comparison.  I don't have clang, so I tried following the
existing whitespace convention in each module.

diff --git a/mercurial/thirdparty/xdiff/xemit.c 
b/mercurial/thirdparty/xdiff/xemit.c
--- a/mercurial/thirdparty/xdiff/xemit.c
+++ b/mercurial/thirdparty/xdiff/xemit.c
@@ -31,7 +31,7 @@
 
 
 static int xdl_emit_record(xdfile_t *xdf, long ri, char const *pre, xdemitcb_t 
*ecb) {
-   long size, psize = strlen(pre);
+   long size, psize = (long)strlen(pre);
char const *rec;
 
size = xdl_get_rec(xdf, ri, );
@@ -81,7 +81,8 @@
} else if (distance < max_ignorable && xch->ignore) {
ignored += xch->chg2;
} else if (lxch != xchp &&
-  xch->i1 + ignored - (lxch->i1 + lxch->chg1) > 
max_common) {
+  xch->i1 + ignored - (lxch->i1 + lxch->chg1)
+   > (unsigned long)max_common) {
break;
} else if (!xch->ignore) {
lxch = xch;
diff --git a/mercurial/thirdparty/xdiff/xmerge.c 
b/mercurial/thirdparty/xdiff/xmerge.c
--- a/mercurial/thirdparty/xdiff/xmerge.c
+++ b/mercurial/thirdparty/xdiff/xmerge.c
@@ -199,9 +199,9 @@
  int size, int i, int style,
  xdmerge_t *m, char *dest, int marker_size)
 {
-   int marker1_size = (name1 ? strlen(name1) + 1 : 0);
-   int marker2_size = (name2 ? strlen(name2) + 1 : 0);
-   int marker3_size = (name3 ? strlen(name3) + 1 : 0);
+   int marker1_size = (name1 ? (int)strlen(name1) + 1 : 0);
+   int marker2_size = (name2 ? (int)strlen(name2) + 1 : 0);
+   int marker3_size = (name3 ? (int)strlen(name3) + 1 : 0);
int needs_cr = is_cr_needed(xe1, xe2, m);
 
if (marker_size <= 0)
diff --git a/mercurial/thirdparty/xdiff/xutils.c 
b/mercurial/thirdparty/xdiff/xutils.c
--- a/mercurial/thirdparty/xdiff/xutils.c
+++ b/mercurial/thirdparty/xdiff/xutils.c
@@ -51,7 +51,7 @@
mb[1].size = size;
if (size > 0 && rec[size - 1] != '\n') {
mb[2].ptr = (char *) "\n\\ No newline at end of file\n";
-   mb[2].size = strlen(mb[2].ptr);
+   mb[2].size = (long) strlen(mb[2].ptr);
i++;
}
if (ecb->outf(ecb->priv, mb, i) < 0) {
@@ -341,7 +341,7 @@
*str++ = '0';
*str = '\0';
 
-   return str - out;
+   return (int) (str - out);
 }
 
 int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2673: archival: use py3 friendly replacements for chr() and long()

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf14ba6eb2b5a: archival: use py3 friendly replacements for 
chr() and long() (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2673?vs=6616=6625

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

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -142,8 +142,8 @@
 flags = 0
 if fname:
 flags = gzip.FNAME
-self.fileobj.write(chr(flags))
-gzip.write32u(self.fileobj, long(self.timestamp))
+self.fileobj.write(pycompat.bytechr(flags))
+gzip.write32u(self.fileobj, int(self.timestamp))
 self.fileobj.write('\002')
 self.fileobj.write('\377')
 if fname:
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -177,6 +177,7 @@
 test-issue842.t
 test-journal-exists.t
 test-largefiles-cache.t
+test-largefiles-misc.t
 test-largefiles-small-disk.t
 test-locate.t
 test-lock-badness.t
@@ -227,6 +228,7 @@
 test-mq-safety.t
 test-mq-symlinks.t
 test-mv-cp-st-diff.t
+test-narrow-archive.t
 test-narrow-clone-no-ellipsis.t
 test-narrow-clone-nonlinear.t
 test-narrow-clone.t
@@ -362,6 +364,7 @@
 test-status-terse.t
 test-strip-cross.t
 test-strip.t
+test-subrepo-deep-nested-change.t
 test-subrepo.t
 test-symlinks.t
 test-treemanifest.t



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


D2669: util: fix unsafe url abort with bytestr() on url

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGca201470abb4: util: fix unsafe url abort with bytestr() on 
url (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2669?vs=6612=6621

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3097,7 +3097,7 @@
 path = urlreq.unquote(path)
 if path.startswith('ssh://-') or path.startswith('svn+ssh://-'):
 raise error.Abort(_('potentially unsafe url: %r') %
-  (path,))
+  (pycompat.bytestr(path),))
 
 def hidepassword(u):
 '''hide user credential in a url string'''



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


D2672: archival: ensure file mode for gzipfile is sysstr

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd3c231f8d27d: archival: ensure file mode for gzipfile is 
sysstr (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2672?vs=6615=6624

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

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -158,7 +158,8 @@
 mode = mode[0:1]
 if not fileobj:
 fileobj = open(name, mode + 'b')
-gzfileobj = self.GzipFileWithTime(name, mode + 'b',
+gzfileobj = self.GzipFileWithTime(name,
+  pycompat.sysstr(mode + 'b'),
   zlib.Z_BEST_COMPRESSION,
   fileobj, timestamp=mtime)
 self.fileobj = gzfileobj



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


D2670: py3: more passing tests (ten this time)

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG93b8c83ef136: py3: more passing tests (ten this time) 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2670?vs=6613=6622

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -25,6 +25,7 @@
 test-branch-tag-confict.t
 test-branches.t
 test-bundle-phases.t
+test-bundle-type.t
 test-bundle-vs-outgoing.t
 test-bundle2-multiple-changegroups.t
 test-cappedreader.py
@@ -59,6 +60,7 @@
 test-convert-hg-source.t
 test-convert-hg-startrev.t
 test-copy-move-merge.t
+test-copy.t
 test-copytrace-heuristics.t
 test-debugbuilddag.t
 test-debugbundle.t
@@ -85,6 +87,7 @@
 test-empty-file.t
 test-empty-group.t
 test-empty.t
+test-encode.t
 test-encoding-func.py
 test-encoding.t
 test-eol-add.t
@@ -151,6 +154,7 @@
 test-http-bundle1.t
 test-http-clone-r.t
 test-identify.t
+test-import-unknown.t
 test-imports-checker.t
 test-inherit-mode.t
 test-issue1089.t
@@ -228,16 +232,19 @@
 test-narrow-clone.t
 test-narrow-commit.t
 test-narrow-copies.t
+test-narrow-debugcommands.t
 test-narrow-debugrebuilddirstate.t
 test-narrow-exchange-merges.t
 test-narrow-exchange.t
+test-narrow-expanddirstate.t
 test-narrow-merge.t
 test-narrow-patch.t
 test-narrow-patterns.t
 test-narrow-pull.t
 test-narrow-rebase.t
 test-narrow-shallow-merges.t
 test-narrow-shallow.t
+test-narrow-strip.t
 test-narrow-update.t
 test-nested-repo.t
 test-newbranch.t
@@ -355,7 +362,9 @@
 test-status-terse.t
 test-strip-cross.t
 test-strip.t
+test-subrepo.t
 test-symlinks.t
+test-treemanifest.t
 test-unamend.t
 test-uncommit.t
 test-unified-test.t
@@ -366,6 +375,7 @@
 test-update-issue1456.t
 test-update-names.t
 test-update-reverse.t
+test-upgrade-repo.t
 test-url-rev.t
 test-username-newline.t
 test-verify.t



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


D2671: archival: fix a missing r'' on a kwargs check

2018-03-04 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG009da8c28e4d: archival: fix a missing r on a 
kwargs check (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2671?vs=6614=6623

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

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -125,7 +125,7 @@
 
 def __init__(self, *args, **kw):
 timestamp = None
-if 'timestamp' in kw:
+if r'timestamp' in kw:
 timestamp = kw.pop(r'timestamp')
 if timestamp is None:
 self.timestamp = time.time()



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


[PATCH 1 of 6] py3: use startswith() instead of slicing to detect leading whitespace

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520195085 18000
#  Sun Mar 04 15:24:45 2018 -0500
# Node ID f7cd53c5127f248f5d075ad28b6be82558b7c35d
# Parent  6bacb2f663cb07f58bb493db5f21ae321d5a2e06
py3: use startswith() instead of slicing to detect leading whitespace

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -158,7 +158,7 @@ def _formatparse(write, inst):
 if len(inst.args) > 1:
 write(_("hg: parse error at %s: %s\n") %
   (pycompat.bytestr(inst.args[1]), inst.args[0]))
-if (inst.args[0][0] == ' '):
+if inst.args[0].startswith(' '):
 write(_("unexpected leading whitespace\n"))
 else:
 write(_("hg: parse error: %s\n") % inst.args[0])
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 6] py3: fix type of ui.configitems(ignoresub=True) result

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520197278 18000
#  Sun Mar 04 16:01:18 2018 -0500
# Node ID 8fe5cf00bb5e51dadafa1811c9fc1aeb2fdb47d4
# Parent  9e19942b51da8d09f6a6eea8dc12b1d7a2c4adab
py3: fix type of ui.configitems(ignoresub=True) result

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -735,7 +735,7 @@ class ui(object):
 for k, v in items:
 if ':' not in k:
 newitems[k] = v
-items = newitems.items()
+items = list(newitems.iteritems())
 if self.debugflag and not untrusted and self._reportuntrusted:
 for k, v in self._ucfg.items(section):
 if self._tcfg.get(section, k) != v:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 6] py3: don't use str() to stringify pushloc

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520196790 18000
#  Sun Mar 04 15:53:10 2018 -0500
# Node ID 9e19942b51da8d09f6a6eea8dc12b1d7a2c4adab
# Parent  794b80520f0f47171ccb1e2db142e9bff1351cde
py3: don't use str() to stringify pushloc

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -67,6 +67,7 @@ test-debugbundle.t
 test-debugextensions.t
 test-debugindexdot.t
 test-debugrename.t
+test-default-push.t
 test-diff-binary-file.t
 test-diff-change.t
 test-diff-copy-depth.t
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1757,7 +1757,7 @@ def pushurlpathoption(ui, path, value):
   'ignoring)\n') % path.name)
 u.fragment = None
 
-return str(u)
+return bytes(u)
 
 @pathsuboption('pushrev', 'pushrev')
 def pushrevpathoption(ui, path, value):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 6] py3: byte-stringify test-config.t and test-config-env.py

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520195186 18000
#  Sun Mar 04 15:26:26 2018 -0500
# Node ID 794b80520f0f47171ccb1e2db142e9bff1351cde
# Parent  f7cd53c5127f248f5d075ad28b6be82558b7c35d
py3: byte-stringify test-config.t and test-config-env.py

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -47,6 +47,8 @@ test-commit-amend.t
 test-commit-unresolved.t
 test-commit.t
 test-completion.t
+test-config-env.py
+test-config.t
 test-conflict.t
 test-confused-revert.t
 test-contrib-check-code.t
diff --git a/tests/test-config-env.py b/tests/test-config-env.py
--- a/tests/test-config-env.py
+++ b/tests/test-config-env.py
@@ -11,24 +11,24 @@ from mercurial import (
 util,
 )
 
-testtmp = encoding.environ['TESTTMP']
+testtmp = encoding.environ[b'TESTTMP']
 
 # prepare hgrc files
 def join(name):
 return os.path.join(testtmp, name)
 
-with open(join('sysrc'), 'w') as f:
-f.write('[ui]\neditor=e0\n[pager]\npager=p0\n')
+with open(join(b'sysrc'), 'wb') as f:
+f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n')
 
-with open(join('userrc'), 'w') as f:
-f.write('[ui]\neditor=e1')
+with open(join(b'userrc'), 'wb') as f:
+f.write(b'[ui]\neditor=e1')
 
 # replace rcpath functions so they point to the files above
 def systemrcpath():
-return [join('sysrc')]
+return [join(b'sysrc')]
 
 def userrcpath():
-return [join('userrc')]
+return [join(b'userrc')]
 
 rcutil.systemrcpath = systemrcpath
 rcutil.userrcpath = userrcpath
@@ -41,9 +41,10 @@ def printconfigs(env):
 ui = uimod.ui.load()
 for section, name, value in ui.walkconfig():
 source = ui.configsource(section, name)
-print('%s.%s=%s # %s' % (section, name, value, util.pconvert(source)))
-print('')
+util.stdout.write(b'%s.%s=%s # %s\n'
+  % (section, name, value, util.pconvert(source)))
+util.stdout.write(b'\n')
 
 # environment variable overrides
 printconfigs({})
-printconfigs({'EDITOR': 'e2', 'PAGER': 'p2'})
+printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})
diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -88,7 +88,7 @@ Test empty config source:
 
   $ cat < emptysource.py
   > def reposetup(ui, repo):
-  > ui.setconfig('empty', 'source', 'value')
+  > ui.setconfig(b'empty', b'source', b'value')
   > EOF
   $ cp .hg/hgrc .hg/hgrc.orig
   $ cat <> .hg/hgrc
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 6] py3: work around comparison between int and None in tagmerge

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520198590 18000
#  Sun Mar 04 16:23:10 2018 -0500
# Node ID 75ddae669c3dd713b44a4c87fcc17324ba26f37d
# Parent  8267c6e887a9473e849faf2ac2ab439b9cbffcbf
py3: work around comparison between int and None in tagmerge

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -359,6 +359,7 @@ test-status-terse.t
 test-strip-cross.t
 test-strip.t
 test-symlinks.t
+test-tag.t
 test-unamend.t
 test-uncommit.t
 test-unified-test.t
diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -73,8 +73,6 @@
 
 from __future__ import absolute_import
 
-import operator
-
 from .i18n import _
 from .node import (
 hex,
@@ -164,7 +162,7 @@ def writemergedtags(fcd, mergedtags):
 # before writing them
 # the position is calculated to ensure that the diff of the merged .hgtags
 # file to the first parent's .hgtags file is as small as possible
-finaltags.sort(key=operator.itemgetter(0))
+finaltags.sort(key=lambda x: -1 if x[0] is None else x[0])
 
 # finally we can join the sorted groups to get the final contents of the
 # merged .hgtags file, and then write it to disk
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 6] py3: do not mutate dict while iterating in tagmerge

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520198026 18000
#  Sun Mar 04 16:13:46 2018 -0500
# Node ID 8267c6e887a9473e849faf2ac2ab439b9cbffcbf
# Parent  8fe5cf00bb5e51dadafa1811c9fc1aeb2fdb47d4
py3: do not mutate dict while iterating in tagmerge

diff --git a/mercurial/tagmerge.py b/mercurial/tagmerge.py
--- a/mercurial/tagmerge.py
+++ b/mercurial/tagmerge.py
@@ -146,7 +146,7 @@ def writemergedtags(fcd, mergedtags):
 possible to the first parent's .hgtags file.
 '''
 # group the node-tag pairs that must be written next to each other
-for tname, taglist in mergedtags.items():
+for tname, taglist in list(mergedtags.items()):
 mergedtags[tname] = grouptagnodesbyline(taglist)
 
 # convert the grouped merged tags dict into a format that resembles the
@@ -269,4 +269,3 @@ def merge(repo, fcd, fco, fca):
 writemergedtags(fcd, mergedtags)
 ui.note(_('.hgtags merged successfully\n'))
 return False, 0
-
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2670: py3: more passing tests (ten this time)

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit accepted this revision.
pulkit added a comment.


  Many thanks!

REPOSITORY
  rHG Mercurial

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

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


D2593: state: add logic to parse the state file in old way if cbor fails

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> durin42 wrote in state.py:86
> Ugh. Yeah, maybe see if they'd take a patch upstream to raise a more explicit 
> exception type.

@durin42 I feel sorry about adding a TODO but I did that because I won't be 
able to work for a week or so dur to laptop issue. If you are not okay with 
that, I am fine with these lying here.

REPOSITORY
  rHG Mercurial

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

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


D2595: graft: start using the new state file

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6620.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2595?vs=6446=6620

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2169,19 +2169,17 @@
  **pycompat.strkwargs(opts))
 
 cont = False
+cmdstate = statemod.cmdstate(repo, 'graftstate')
 if opts.get('continue'):
 cont = True
 if revs:
 raise error.Abort(_("can't specify --continue and revisions"))
 # read in unfinished revisions
-try:
-with repo.vfs('graftstate', 'rb') as fp:
-stateopts = statemod.oldgraftstate(fp)
-nodes = stateopts['nodes']
+if cmdstate:
+cmdstate.load()
+nodes = cmdstate['nodes']
 revs = [repo[node].rev() for node in nodes]
-except IOError as inst:
-if inst.errno != errno.ENOENT:
-raise
+else:
 cmdutil.wrongtooltocontinue(repo, _('graft'))
 else:
 cmdutil.checkunfinished(repo)
@@ -2306,8 +2304,9 @@
 # report any conflicts
 if stats and stats[3] > 0:
 # write out state for --continue
-nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
-repo.vfs.write('graftstate', ''.join(nodelines))
+nodelines = [repo[rev].hex() for rev in revs[pos:]]
+cmdstate.addopts({'nodes': nodelines})
+cmdstate.save()
 extra = ''
 if opts.get('user'):
 extra += ' --user %s' % util.shellquote(opts['user'])



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


D2593: state: add logic to parse the state file in old way if cbor fails

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6618.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2593?vs=6444=6618

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

AFFECTED FILES
  mercurial/state.py
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -11,6 +11,7 @@
   > -X contrib/python-zstandard \
   > -X hgext/fsmonitor/pywatchman \
   > -X mercurial/thirdparty \
+  > -X mercurial/state.py \
   > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
   Skipping i18n/polib.py it has no-che?k-code (glob)
   Skipping mercurial/statprof.py it has no-che?k-code (glob)
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -22,6 +22,7 @@
 from .thirdparty import cbor
 
 from . import (
+error,
 util,
 )
 
@@ -77,8 +78,18 @@
 def _read(self):
 """reads the evolvestate file and returns a dictionary which contain
 data in the same format as it was before storing"""
-with self._repo.vfs(self.fname, 'rb') as fp:
-return cbor.load(fp)
+try:
+with self._repo.vfs(self.fname, 'rb') as fp:
+ret = cbor.load(fp)
+if not isinstance(ret, dict):
+raise error.ParseError("cbor parsed it wrong")
+return ret
+except: # cbor raises an Exception
+# TODO: patch upstream cbor library to raise a particular exception
+# and remove this file from test-check-code.t
+with self._repo.vfs(self.fname, 'rb') as fp:
+oldfn = oldstatefilefns[self.fname]
+return oldfn(fp)
 
 def delete(self):
 """drop the evolvestate file if exists"""



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


D2594: graft: move logic to read current graft state file in state.py

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6619.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2594?vs=6445=6619

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -116,3 +116,8 @@
 oldstatefilefns[path] = func
 return func
 return dec
+
+@readoldstatefile('graftstate')
+def oldgraftstate(fp):
+nodes = fp.read().splitlines()
+return {'nodes': nodes}
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -54,6 +54,7 @@
 rewriteutil,
 scmutil,
 server,
+state as statemod,
 streamclone,
 tags as tagsmod,
 templatekw,
@@ -2174,7 +2175,9 @@
 raise error.Abort(_("can't specify --continue and revisions"))
 # read in unfinished revisions
 try:
-nodes = repo.vfs.read('graftstate').splitlines()
+with repo.vfs('graftstate', 'rb') as fp:
+stateopts = statemod.oldgraftstate(fp)
+nodes = stateopts['nodes']
 revs = [repo[node].rev() for node in nodes]
 except IOError as inst:
 if inst.errno != errno.ENOENT:



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


D2640: cbor: remove tests files and fix core's test-check*

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6617.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2640?vs=6547=6617

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

AFFECTED FILES
  mercurial/thirdparty/cbor/cbor/tests/__init__.py
  mercurial/thirdparty/cbor/cbor/tests/test_cbor.py
  mercurial/thirdparty/cbor/cbor/tests/test_objects.py
  mercurial/thirdparty/cbor/cbor/tests/test_usage.py
  mercurial/thirdparty/cbor/cbor/tests/test_vectors.py
  mercurial/thirdparty/cbor/setup.py
  mercurial/thirdparty/cbor/utest.sh
  tests/test-check-execute.t
  tests/test-check-py3-compat.t
  tests/test-check-pyflakes.t
  tests/test-check-shbang.t

CHANGE DETAILS

diff --git a/tests/test-check-shbang.t b/tests/test-check-shbang.t
--- a/tests/test-check-shbang.t
+++ b/tests/test-check-shbang.t
@@ -5,11 +5,13 @@
 
 look for python scripts that do not use /usr/bin/env
 
-  $ testrepohg files 'set:grep(r"^#!.*?python") and not 
grep(r"^#!/usr/bi{1}n/env python") - **/*.t'
+  $ testrepohg files 'set:grep(r"^#!.*?python") and not 
grep(r"^#!/usr/bi{1}n/env python") - **/*.t' \
+  > -X mercurial/thirdparty/cbor/
   [1]
 
 In tests, enforce $PYTHON and *not* /usr/bin/env python or similar:
   $ testrepohg files 'set:grep(r"#!.*?python") and **/*.t' \
+  > -X mercurial/thirdparty/cbor/ \
   > -X tests/test-check-execute.t \
   > -X tests/test-check-module-imports.t \
   > -X tests/test-check-pyflakes.t \
diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
--- a/tests/test-check-pyflakes.t
+++ b/tests/test-check-pyflakes.t
@@ -16,6 +16,7 @@
   $ testrepohg locate 'set:**.py or grep("^#!.*python")' \
   > -X hgext/fsmonitor/pywatchman \
   > -X mercurial/pycompat.py -X contrib/python-zstandard \
+  > -X mercurial/thirdparty/cbor \
   > 2>/dev/null \
   > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
   
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -5,6 +5,7 @@
 
   $ testrepohg files 'set:(**.py)' \
   > -X hgdemandimport/demandimportpy2.py \
+  > -X mercurial/thirdparty/cbor \
   > | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py
   contrib/python-zstandard/setup.py not using absolute_import
   contrib/python-zstandard/setup_zstd.py not using absolute_import
diff --git a/tests/test-check-execute.t b/tests/test-check-execute.t
--- a/tests/test-check-execute.t
+++ b/tests/test-check-execute.t
@@ -5,7 +5,8 @@
 
 look for python scripts without the execute bit
 
-  $ testrepohg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
+  $ testrepohg files 'set:**.py and not exec() and grep(r"^#!.*?python")' \
+  > -X mercurial/thirdparty/cbor/
   [1]
 
 look for python scripts with execute bit but not shebang
diff --git a/mercurial/thirdparty/cbor/utest.sh 
b/mercurial/thirdparty/cbor/utest.sh
deleted file mode 100755
--- a/mercurial/thirdparty/cbor/utest.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh -x
-
-python -m cbor.tests.test_cbor
-python -m cbor.tests.test_objects
-python -m cbor.tests.test_usage
-python -m cbor.tests.test_vectors
-
-#python cbor/tests/test_cbor.py
-#python cbor/tests/test_objects.py
-#python cbor/tests/test_usage.py
-#python cbor/tests/test_vectors.py
diff --git a/mercurial/thirdparty/cbor/setup.py 
b/mercurial/thirdparty/cbor/setup.py
--- a/mercurial/thirdparty/cbor/setup.py
+++ b/mercurial/thirdparty/cbor/setup.py
@@ -1,4 +1,3 @@
-#! /usr/bin/env python
 # Copyright 2014 Brian Olson
 # 
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/mercurial/thirdparty/cbor/cbor/tests/test_vectors.py 
b/mercurial/thirdparty/cbor/cbor/tests/test_vectors.py
deleted file mode 100644
--- a/mercurial/thirdparty/cbor/cbor/tests/test_vectors.py
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Test CBOR implementation against common "test vectors" set from
-https://github.com/cbor/test-vectors/
-"""
-
-import base64
-import json
-import logging
-import math
-import os
-import sys
-import unittest
-
-
-_IS_PY3 = sys.version_info[0] >= 3
-
-
-logger = logging.getLogger(__name__)
-
-
-#from cbor.cbor import dumps as pydumps
-from cbor.cbor import loads as pyloads
-try:
-#from cbor._cbor import dumps as cdumps
-from cbor._cbor import loads as cloads
-except ImportError:
-# still test what we can without C fast mode
-logger.warn('testing without C accelerated CBOR', exc_info=True)
-#cdumps, cloads = None, None
-cloads = None
-from cbor import Tag
-
-
-# Accomodate several test vectors that have diagnostic descriptors but not JSON
-_DIAGNOSTIC_TESTS = {
-'Infinity': lambda x: x == float('Inf'),
-'-Infinity': lambda x: x == float('-Inf'),
-'NaN': math.isnan,
-'undefined': lambda x: x is None,
-
-# TODO: parse into datetime.datetime()
-'0("2013-03-21T20:04:00Z")': lambda x: isinstance(x, Tag) and (x.tag == 0) 
and (x.value == '2013-03-21T20:04:00Z'),
-
-

D2673: archival: use py3 friendly replacements for chr() and long()

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -142,8 +142,8 @@
 flags = 0
 if fname:
 flags = gzip.FNAME
-self.fileobj.write(chr(flags))
-gzip.write32u(self.fileobj, long(self.timestamp))
+self.fileobj.write(pycompat.bytechr(flags))
+gzip.write32u(self.fileobj, int(self.timestamp))
 self.fileobj.write('\002')
 self.fileobj.write('\377')
 if fname:
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -177,6 +177,7 @@
 test-issue842.t
 test-journal-exists.t
 test-largefiles-cache.t
+test-largefiles-misc.t
 test-largefiles-small-disk.t
 test-locate.t
 test-lock-badness.t
@@ -227,6 +228,7 @@
 test-mq-safety.t
 test-mq-symlinks.t
 test-mv-cp-st-diff.t
+test-narrow-archive.t
 test-narrow-clone-no-ellipsis.t
 test-narrow-clone-nonlinear.t
 test-narrow-clone.t
@@ -362,6 +364,7 @@
 test-status-terse.t
 test-strip-cross.t
 test-strip.t
+test-subrepo-deep-nested-change.t
 test-subrepo.t
 test-symlinks.t
 test-treemanifest.t



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


D2670: py3: more passing tests (ten this time)

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -25,6 +25,7 @@
 test-branch-tag-confict.t
 test-branches.t
 test-bundle-phases.t
+test-bundle-type.t
 test-bundle-vs-outgoing.t
 test-bundle2-multiple-changegroups.t
 test-cappedreader.py
@@ -59,6 +60,7 @@
 test-convert-hg-source.t
 test-convert-hg-startrev.t
 test-copy-move-merge.t
+test-copy.t
 test-copytrace-heuristics.t
 test-debugbuilddag.t
 test-debugbundle.t
@@ -85,6 +87,7 @@
 test-empty-file.t
 test-empty-group.t
 test-empty.t
+test-encode.t
 test-encoding-func.py
 test-encoding.t
 test-eol-add.t
@@ -151,6 +154,7 @@
 test-http-bundle1.t
 test-http-clone-r.t
 test-identify.t
+test-import-unknown.t
 test-imports-checker.t
 test-inherit-mode.t
 test-issue1089.t
@@ -228,16 +232,19 @@
 test-narrow-clone.t
 test-narrow-commit.t
 test-narrow-copies.t
+test-narrow-debugcommands.t
 test-narrow-debugrebuilddirstate.t
 test-narrow-exchange-merges.t
 test-narrow-exchange.t
+test-narrow-expanddirstate.t
 test-narrow-merge.t
 test-narrow-patch.t
 test-narrow-patterns.t
 test-narrow-pull.t
 test-narrow-rebase.t
 test-narrow-shallow-merges.t
 test-narrow-shallow.t
+test-narrow-strip.t
 test-narrow-update.t
 test-nested-repo.t
 test-newbranch.t
@@ -355,7 +362,9 @@
 test-status-terse.t
 test-strip-cross.t
 test-strip.t
+test-subrepo.t
 test-symlinks.t
+test-treemanifest.t
 test-unamend.t
 test-uncommit.t
 test-unified-test.t
@@ -366,6 +375,7 @@
 test-update-issue1456.t
 test-update-names.t
 test-update-reverse.t
+test-upgrade-repo.t
 test-url-rev.t
 test-username-newline.t
 test-verify.t



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


D2669: util: fix unsafe url abort with bytestr() on url

2018-03-04 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/D2669

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3097,7 +3097,7 @@
 path = urlreq.unquote(path)
 if path.startswith('ssh://-') or path.startswith('svn+ssh://-'):
 raise error.Abort(_('potentially unsafe url: %r') %
-  (path,))
+  (pycompat.bytestr(path),))
 
 def hidepassword(u):
 '''hide user credential in a url string'''



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


D2672: archival: ensure file mode for gzipfile is sysstr

2018-03-04 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/D2672

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -158,7 +158,8 @@
 mode = mode[0:1]
 if not fileobj:
 fileobj = open(name, mode + 'b')
-gzfileobj = self.GzipFileWithTime(name, mode + 'b',
+gzfileobj = self.GzipFileWithTime(name,
+  pycompat.sysstr(mode + 'b'),
   zlib.Z_BEST_COMPRESSION,
   fileobj, timestamp=mtime)
 self.fileobj = gzfileobj



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


D2671: archival: fix a missing r'' on a kwargs check

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

REVISION SUMMARY
  1. skip-blame just an r prefix

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -125,7 +125,7 @@
 
 def __init__(self, *args, **kw):
 timestamp = None
-if 'timestamp' in kw:
+if r'timestamp' in kw:
 timestamp = kw.pop(r'timestamp')
 if timestamp is None:
 self.timestamp = time.time()



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


D2596: state: raise ProgrammingError if an invalid key is being accessed

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D2596#42818, @yuja wrote:
  
  > In https://phab.mercurial-scm.org/D2596#42678, @pulkit wrote:
  >
  > > In https://phab.mercurial-scm.org/D2596#42672, @durin42 wrote:
  > >
  > > > Hmm, really? Do any states have optional entries that would make this 
awkward?
  > >
  > >
  > > Nope, but I wanted to be safe here raising a ProgrammingError instead of 
KeyError.
  >
  >
  > I don't follow, but what if the state file was written by old hg client 
where some new keys
  >  were missing, and read by new client? Perhaps we'll have to support that 
scenario.
  
  
  I am going to drop this patch for now so in cases which Yuya mentioned, we 
can catch the KeyError to realize that key is not available.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH] xdiff: fix builds on Windows

2018-03-04 Thread Augie Fackler


> On Mar 4, 2018, at 15:33, Matt Harbison  wrote:
> 
> # HG changeset patch
> # User Matt Harbison 
> # Date 1520194602 18000
> #  Sun Mar 04 15:16:42 2018 -0500
> # Node ID 0c7679474cdf8077f53e470c1c4e1c7626dc0ba4
> # Parent  abf252a1c9387f69f2ad493c490a25cb68b88ded
> xdiff: fix builds on Windows

queued, thanks

> This works on my ancient Fedora system too, without warnings.  There are,
> however, warnings about various 64 to 32 bit conversions on Windows that need 
> to
> be examined.
> 
> diff --git a/mercurial/thirdparty/xdiff/xdiffi.c 
> b/mercurial/thirdparty/xdiff/xdiffi.c
> --- a/mercurial/thirdparty/xdiff/xdiffi.c
> +++ b/mercurial/thirdparty/xdiff/xdiffi.c
> @@ -30,6 +30,10 @@
> #define XDL_SNAKE_CNT 20
> #define XDL_K_HEUR 4
> 
> +/* VC 2008 doesn't know about the inline keyword. */
> +#if defined(_MSC_VER)
> +#define inline __forceinline
> +#endif
> 
> 
> typedef struct s_xdpsplit {
> diff --git a/mercurial/thirdparty/xdiff/xinclude.h 
> b/mercurial/thirdparty/xdiff/xinclude.h
> --- a/mercurial/thirdparty/xdiff/xinclude.h
> +++ b/mercurial/thirdparty/xdiff/xinclude.h
> @@ -26,7 +26,6 @@
> #include 
> #include 
> #include 
> -#include 
> #include 
> #include 
> 
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


D2668: rebase: introduce support for automatically rebasing orphan changes

2018-03-04 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 6611.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2668?vs=6610=6611

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -482,7 +482,31 @@
   |/
   o  0:cd010b8cd998 A
   
+  $ cd ..
+  $ cp -R hidden stabilize
+  $ cd stabilize
+  $ hg rebase --auto 'orphan()'
+  rebasing 9:cf44d2f5a9f4 "D"
+  $ hg log -G
+  o  12:7e3935feaa68 D
+  |
+  o  11:0d8f238b634c C
+  |
+  o  10:7c6027df6a99 B
+  |
+  @  7:02de42196ebe H
+  |
+  | o  6:eea13746799a G
+  |/|
+  o |  5:24b6387c8c8c F
+  | |
+  | o  4:9520eea781bc E
+  |/
+  o  0:cd010b8cd998 A
+  
 
+  $ cd ../hidden
+  $ rm -r ../stabilize
 
 Test multiple root handling
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -120,6 +120,53 @@
 sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
 return subset & smartset.baseset([_destrebase(repo, sourceset)])
 
+def _possibledestination(repo, rev):
+"""Return all changesets that may be a new parent for `rev`."""
+tonode = repo.changelog.node
+parents = repo.changelog.parentrevs
+torev = repo.changelog.rev
+dest = set()
+tovisit = list(parents(rev))
+while tovisit:
+r = tovisit.pop()
+succsets = obsutil.successorssets(repo, tonode(r))
+if not succsets:
+# if there are no successors for r, r was probably pruned
+# and we should walk up to r's parents to try and find
+# some successors.
+tovisit.extend(parents(r))
+else:
+# We should probably pick only one destination from split
+# (case where '1 < len(ss)'), This could be the currently
+# tipmost, but the correct result is less clear when
+# results of the split have been moved such that they
+# reside on multiple branches.
+for ss in succsets:
+for n in ss:
+dr = torev(n)
+if dr != -1:
+dest.add(dr)
+return dest
+
+@revsetpredicate('_destautorebase')
+def _revsetdestautorebase(repo, subset, x):
+"""automatic rebase destination for a single revision"""
+unfi = repo.unfiltered()
+obsoleted = unfi.revs('obsolete()')
+
+src = revset.getset(repo, subset, x).first()
+
+# Empty src or already obsoleted - Do not return a destination
+if not src or src in obsoleted:
+return smartset.baseset()
+dests = _possibledestination(repo, src)
+if len(dests) > 1:
+raise error.Abort(
+_("ambiguous automatic rebase: %r could end up on any of %r") % (
+src, dests))
+# We have zero or one destination, so we can just return here.
+return smartset.baseset(dests)
+
 def _ctxdesc(ctx):
 """short description for a context"""
 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
@@ -651,7 +698,10 @@
 ('i', 'interactive', False, _('(DEPRECATED)')),
 ('t', 'tool', '', _('specify merge tool')),
 ('c', 'continue', False, _('continue an interrupted rebase')),
-('a', 'abort', False, _('abort an interrupted rebase'))] +
+('a', 'abort', False, _('abort an interrupted rebase')),
+('', 'auto', '', _('automatically rebase orphan revisions '
+   'in the specified revset (EXPERIMENTAL)')),
+ ] +
 cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
@@ -783,6 +833,15 @@
 # fail the entire transaction.)
 inmemory = False
 
+if opts.get('auto'):
+for disallowed in 'rev', 'source', 'base', 'dest':
+if opts.get(disallowed):
+raise error.Abort(_('--auto is incompatible with %s') %
+  ('--' + disallowed))
+userrevs = list(repo.revs(opts.get('auto')))
+opts['rev'] = [revsetlang.formatspec('%ld', userrevs)]
+opts['dest'] = '_destautorebase(SRC)'
+
 if inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort



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


D2623: dispatch: adding config items for overriding flag defaults

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added inline comments.

INLINE COMMENTS

> yuja wrote in dispatch.py:624
> IIUC, an extension author may implement its own customopt subclasses, and
> put them into the command table, so we can't make ui.configtyped to
> support all of them.

Ah, makes sense. See if this addresses that case satisfactorily - it still has 
the caveat of not being able to "reset" container types, but that's true of the 
command line as well (if you have a list flag with a non-empty default, there's 
no way to remove that default item).

REPOSITORY
  rHG Mercurial

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

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


D2668: rebase: introduce support for automatically rebasing orphan changes

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

REVISION SUMMARY
  _destautorebase(SRC) is based on the _destrestack(SRC) revset from
  fbamend. The supporting _possibledestination function is extracted
  from evolve, with minor cleanups.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -482,7 +482,31 @@
   |/
   o  0:cd010b8cd998 A
   
+  $ cd ..
+  $ cp -r hidden stabilize
+  $ cd stabilize
+  $ hg rebase --auto 'orphan()'
+  rebasing 9:cf44d2f5a9f4 "D"
+  $ hg log -G
+  o  12:7e3935feaa68 D
+  |
+  o  11:0d8f238b634c C
+  |
+  o  10:7c6027df6a99 B
+  |
+  @  7:02de42196ebe H
+  |
+  | o  6:eea13746799a G
+  |/|
+  o |  5:24b6387c8c8c F
+  | |
+  | o  4:9520eea781bc E
+  |/
+  o  0:cd010b8cd998 A
+  
 
+  $ cd ../hidden
+  $ rm -r ../stabilize
 
 Test multiple root handling
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -120,6 +120,53 @@
 sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
 return subset & smartset.baseset([_destrebase(repo, sourceset)])
 
+def _possibledestination(repo, rev):
+"""Return all changesets that may be a new parent for `rev`."""
+tonode = repo.changelog.node
+parents = repo.changelog.parentrevs
+torev = repo.changelog.rev
+dest = set()
+tovisit = list(parents(rev))
+while tovisit:
+r = tovisit.pop()
+succsets = obsutil.successorssets(repo, tonode(r))
+if not succsets:
+# if there are no successors for r, r was probably pruned
+# and we should walk up to r's parents to try and find
+# some successors.
+tovisit.extend(parents(r))
+else:
+# We should probably pick only one destination from split
+# (case where '1 < len(ss)'), This could be the currently
+# tipmost, but the correct result is less clear when
+# results of the split have been moved such that they
+# reside on multiple branches.
+for ss in succsets:
+for n in ss:
+dr = torev(n)
+if dr != -1:
+dest.add(dr)
+return dest
+
+@revsetpredicate('_destautorebase')
+def _revsetdestautorebase(repo, subset, x):
+"""automatic rebase destination for a single revision"""
+unfi = repo.unfiltered()
+obsoleted = unfi.revs('obsolete()')
+
+src = revset.getset(repo, subset, x).first()
+
+# Empty src or already obsoleted - Do not return a destination
+if not src or src in obsoleted:
+return smartset.baseset()
+dests = _possibledestination(repo, src)
+if len(dests) > 1:
+raise error.Abort(
+_("ambiguous automatic rebase: %r could end up on any of %r") % (
+src, dests))
+# We have zero or one destination, so we can just return here.
+return smartset.baseset(dests)
+
 def _ctxdesc(ctx):
 """short description for a context"""
 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
@@ -651,7 +698,10 @@
 ('i', 'interactive', False, _('(DEPRECATED)')),
 ('t', 'tool', '', _('specify merge tool')),
 ('c', 'continue', False, _('continue an interrupted rebase')),
-('a', 'abort', False, _('abort an interrupted rebase'))] +
+('a', 'abort', False, _('abort an interrupted rebase')),
+('', 'auto', '', _('automatically rebase orphan revisions '
+   'in the specified revset (EXPERIMENTAL)')),
+ ] +
 cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
@@ -783,6 +833,15 @@
 # fail the entire transaction.)
 inmemory = False
 
+if opts.get('auto'):
+for disallowed in 'rev', 'source', 'base', 'dest':
+if opts.get(disallowed):
+raise error.Abort(_('--auto is incompatible with %s') %
+  ('--' + disallowed))
+userrevs = list(repo.revs(opts.get('auto')))
+opts['rev'] = [revsetlang.formatspec('%ld', userrevs)]
+opts['dest'] = '_destautorebase(SRC)'
+
 if inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort



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


D2623: dispatch: adding config items for overriding flag defaults

2018-03-04 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 6609.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2623?vs=6548=6609

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/dispatch.py
  mercurial/ui.py
  tests/test-dispatch.t

CHANGE DETAILS

diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -8,8 +8,10 @@
   $ hg -v log -v x
 
   $ echo a > a
+  $ echo b > b
   $ hg ci -Ama
   adding a
+  adding b
 
 Missing arg:
 
@@ -52,10 +54,10 @@
 Parsing of early options should stop at "--":
 
   $ hg cat -- --config=hooks.pre-cat=false
-  --config=hooks.pre-cat=false: no such file in rev cb9a9f314b8b
+  --config=hooks.pre-cat=false: no such file in rev 0cd96de13884
   [1]
   $ hg cat -- --debugger
-  --debugger: no such file in rev cb9a9f314b8b
+  --debugger: no such file in rev 0cd96de13884
   [1]
 
 Unparsable form of early options:
@@ -155,31 +157,75 @@
   abort: pre-log hook exited with status 1
   [255]
   $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default
-  0:cb9a9f314b8b
+  0:0cd96de13884
   $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default
-  0:cb9a9f314b8b
+  0:0cd96de13884
   $ HGPLAIN=+strictflags hg --cwd .. -q --repo a log -b default
-  0:cb9a9f314b8b
+  0:0cd96de13884
 
 For compatibility reasons, HGPLAIN=+strictflags is not enabled by plain 
HGPLAIN:
 
   $ HGPLAIN= hg log --config='hooks.pre-log=false' -b default
   abort: pre-log hook exited with status 1
   [255]
   $ HGPLAINEXCEPT= hg log --cwd .. -q -Ra -b default
-  0:cb9a9f314b8b
+  0:0cd96de13884
 
 [defaults]
 
   $ hg cat a
   a
+  $ cp $HGRCPATH hgrc.bak
   $ cat >> $HGRCPATH < [defaults]
   > cat = -r null
   > EOF
   $ hg cat a
   a: no such file in rev 
   [1]
+  $ cp -f hgrc.bak $HGRCPATH
+
+new-style [commands] defaults and overrides
+
+  $ hg cat a
+  a
+  $ cat >> $HGRCPATH < [commands]
+  > cat.default.rev = null
+  > EOF
+  $ hg cat a
+  a: no such file in rev 
+  [1]
+
+  $ mv -f hgrc.bak $HGRCPATH
+  $ echo foo >> a
+  $ hg rm b
+  $ echo bar > c
+  $ hg add c
+  $ hg status
+  M a
+  A c
+  R b
+  ? bad.py
+  ? bad.pyc
+  $ cat >> $HGRCPATH < [commands]
+  > status.default.removed = 1
+  > EOF
+  $ hg status
+  R b
+  $ hg status --modified
+  M a
+  R b
+  $ hg status --modified --no-removed
+  M a
+  $ hg status --no-removed
+  M a
+  A c
+  R b
+  ? bad.py
+  ? bad.pyc
+  $ hg revert a b c
 
   $ cd "$TESTTMP"
 
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -545,7 +545,8 @@
 
 return main, sub
 
-def configtyped(self, section, name, itemtype, default=_unset, 
untrusted=False):
+def configtyped(self, section, name, itemtype, default=_unset,
+untrusted=False):
 """Get a config item as the given type."""
 if itemtype is type(False) or itemtype is type(None):
 return self.configbool(section, name, default, untrusted)
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -611,6 +611,37 @@
 args = pycompat.maplist(
 util.expandpath, pycompat.shlexsplit(defaults)) + args
 c = list(entry[1])
+
+# Apply new-style defaults from config file by actually changing the
+# option defaults. We still let old-style defaults trump these (since
+# those are added to the command line).
+for idx, opt in enumerate(c):
+optname = opt[1]
+olddefault = opt[2]
+defaulttype = type(olddefault)
+cfgitem = "%s.default.%s" % (cmd, optname)
+
+# parse the new default as the same type as the original.
+newdefault = ui.configtyped("commands", cfgitem, defaulttype,
+olddefault)
+if isinstance(olddefault, fancyopts.customopt):
+def badvalue(s):
+raise error.Abort(
+_('invalid value %r for config option %s: %s') % (
+newdefault, cfgitem, s))
+
+# If it's a custom option, then configtyped must have parsed it
+# as string - ask the customopt to parse its new default.
+# Notice this does have limitations - since we have no way to
+# start with a "clean" old state, this is not overriding the
+# default, but rather adding to it - e.g. a non-empty list
+# default will be appended to.
+olddefault.defaultvalue = olddefault.newstate(
+olddefault.defaultvalue, newdefault, badvalue)
+elif olddefault != newdefault:
+# override the default in the flag declaration.
+c[idx] = (opt[0], opt[1], newdefault, opt[3])
+
 else:
 cmd = None
 

[PATCH] xdiff: fix builds on Windows

2018-03-04 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1520194602 18000
#  Sun Mar 04 15:16:42 2018 -0500
# Node ID 0c7679474cdf8077f53e470c1c4e1c7626dc0ba4
# Parent  abf252a1c9387f69f2ad493c490a25cb68b88ded
xdiff: fix builds on Windows

This works on my ancient Fedora system too, without warnings.  There are,
however, warnings about various 64 to 32 bit conversions on Windows that need to
be examined.

diff --git a/mercurial/thirdparty/xdiff/xdiffi.c 
b/mercurial/thirdparty/xdiff/xdiffi.c
--- a/mercurial/thirdparty/xdiff/xdiffi.c
+++ b/mercurial/thirdparty/xdiff/xdiffi.c
@@ -30,6 +30,10 @@
 #define XDL_SNAKE_CNT 20
 #define XDL_K_HEUR 4
 
+/* VC 2008 doesn't know about the inline keyword. */
+#if defined(_MSC_VER)
+#define inline __forceinline
+#endif
 
 
 typedef struct s_xdpsplit {
diff --git a/mercurial/thirdparty/xdiff/xinclude.h 
b/mercurial/thirdparty/xdiff/xinclude.h
--- a/mercurial/thirdparty/xdiff/xinclude.h
+++ b/mercurial/thirdparty/xdiff/xinclude.h
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] test-annotate: set stdin and stdout to binary to get CR unmodified

2018-03-04 Thread Augie Fackler


> On Mar 4, 2018, at 15:05, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1520193237 18000
> #  Sun Mar 04 14:53:57 2018 -0500
> # Branch stable
> # Node ID f89bc48f38c7d87e0810e9308e58bdf6ea565695
> # Parent  9a08f7d18c207c590bab631b6daeb5ecfcb6d4b0
> test-annotate: set stdin and stdout to binary to get CR unmodified

queued, thanks

> 
> diff --git a/tests/test-annotate.t b/tests/test-annotate.t
> --- a/tests/test-annotate.t
> +++ b/tests/test-annotate.t
> @@ -903,6 +903,9 @@ Annotate with orphaned CR (issue5798)
> 
>   $ cat <<'EOF' >> "$TESTTMP/substcr.py"
>> import sys
> +  > from mercurial import util
> +  > util.setbinary(sys.stdin)
> +  > util.setbinary(sys.stdout)
>> stdin = getattr(sys.stdin, 'buffer', sys.stdin)
>> stdout = getattr(sys.stdout, 'buffer', sys.stdout)
>> stdout.write(stdin.read().replace(b'\r', b'[CR]'))
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


D2666: repair: rename _backup to backupbundle

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  A future commit will introduce a caller from outside the module.
  
  The function should have already been public because histedit was
  calling it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  mercurial/repair.py

CHANGE DETAILS

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -27,7 +27,8 @@
 util,
 )
 
-def _bundle(repo, bases, heads, node, suffix, compress=True, 
obsolescence=True):
+def backupbundle(repo, bases, heads, node, suffix, compress=True,
+ obsolescence=True):
 """create a bundle with the specified revisions as a backup"""
 
 backupdir = "strip-backup"
@@ -166,7 +167,7 @@
 vfs = repo.vfs
 node = nodelist[-1]
 if backup:
-backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
+backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic)
 repo.ui.status(_("saved backup bundle to %s\n") %
vfs.join(backupfile))
 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
@@ -179,8 +180,8 @@
 # we are trying to strip.  This is harmless since the stripped markers
 # are already backed up and we did not touched the markers for the
 # saved changesets.
-tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
-compress=False, obsolescence=False)
+tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp',
+ compress=False, obsolescence=False)
 
 try:
 with repo.transaction("strip") as tr:
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1317,8 +1317,8 @@
 # Create a backup so we can always abort completely.
 backupfile = None
 if not obsolete.isenabled(repo, obsolete.createmarkersopt):
-backupfile = repair._bundle(repo, [parentctxnode], [topmost], root,
-'histedit')
+backupfile = repair.backupbundle(repo, [parentctxnode],
+ [topmost], root, 'histedit')
 state.backupfile = backupfile
 
 def _getsummary(ctx):



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


D2667: obsolete: refactor function for getting obsolete options

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The function for returning obsolete option values obtains all
  options, validates, then returns the option that was requested.
  
  Let's create a new function to return all obsolete option values
  so callers needing multiple values can call that.

REPOSITORY
  rHG Mercurial

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

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
@@ -133,20 +133,29 @@
 
 return option in result
 
+def getoptions(repo):
+"""Returns dicts showing state of obsolescence features."""
+
+createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
+unstablevalue = _getoptionvalue(repo, allowunstableopt)
+exchangevalue = _getoptionvalue(repo, exchangeopt)
+
+# createmarkers must be enabled if other options are enabled
+if ((unstablevalue or exchangevalue) and not createmarkersvalue):
+raise error.Abort(_("'createmarkers' obsolete option must be enabled "
+"if other obsolete options are enabled"))
+
+return {
+createmarkersopt: createmarkersvalue,
+allowunstableopt: unstablevalue,
+exchangeopt: exchangevalue,
+}
+
 def isenabled(repo, option):
 """Returns True if the given repository has the given obsolete option
 enabled.
 """
-createmarkersvalue = _getoptionvalue(repo, createmarkersopt)
-unstabluevalue = _getoptionvalue(repo, allowunstableopt)
-exchangevalue = _getoptionvalue(repo, exchangeopt)
-
-# createmarkers must be enabled if other options are enabled
-if ((unstabluevalue or exchangevalue) and not createmarkersvalue):
-raise error.Abort(_("'createmarkers' obsolete option must be enabled "
-"if other obsolete options are enabled"))
-
-return _getoptionvalue(repo, option)
+return getoptions(repo)[option]
 
 ### obsolescence marker flag
 



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


D2648: py3: use pycompat.bytestr instead of str

2018-03-04 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG390d16ea7c76: py3: use pycompat.bytestr instead of str 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2648?vs=6597=6603

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/debugcommands.py
  mercurial/subrepo.py
  mercurial/wireproto.py

CHANGE DETAILS

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -1043,7 +1043,7 @@
 util.stderr.write("(%s)\n" % exc.hint)
 return pushres(0, output.getvalue() if output else '')
 except error.PushRaced:
-return pusherr(str(exc),
+return pusherr(pycompat.bytestr(exc),
output.getvalue() if output else '')
 
 bundler = bundle2.bundle20(repo.ui)
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1123,7 +1123,7 @@
 doc = xml.dom.minidom.parseString(output)
 paths = []
 for e in doc.getElementsByTagName('entry'):
-kind = str(e.getAttribute('kind'))
+kind = pycompat.bytestr(e.getAttribute('kind'))
 if kind != 'file':
 continue
 name = ''.join(c.data for c
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1811,7 +1811,7 @@
 if keyinfo:
 key, old, new = keyinfo
 r = target.pushkey(namespace, key, old, new)
-ui.status(str(r) + '\n')
+ui.status(pycompat.bytestr(r) + '\n')
 return not r
 else:
 for k, v in sorted(target.listkeys(namespace).iteritems()):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1197,7 +1197,7 @@
 bcompression, cgversion, params = exchange.parsebundlespec(
 repo, bundletype, strict=False)
 except error.UnsupportedBundleSpecification as e:
-raise error.Abort(str(e),
+raise error.Abort(pycompat.bytestr(e),
   hint=_("see 'hg help bundlespec' for supported "
  "values for --type"))
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -362,7 +362,7 @@
 ui.debug(fp.getvalue())
 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
 except error.PatchError as err:
-raise error.Abort(str(err))
+raise error.Abort(pycompat.bytestr(err))
 del fp
 
 # 4. We prepared working directory according to filtered
@@ -1432,7 +1432,7 @@
 files=files, eolmode=None, similarity=sim / 100.0)
 except error.PatchError as e:
 if not partial:
-raise error.Abort(str(e))
+raise error.Abort(pycompat.bytestr(e))
 if partial:
 rejects = True
 
@@ -3043,7 +3043,7 @@
 try:
 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
 except error.PatchError as err:
-raise error.Abort(str(err))
+raise error.Abort(pycompat.bytestr(err))
 del fp
 else:
 for f in actions['revert'][0]:



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


D2663: py3: use util.forcebytestr to convert testedwith value to bytes

2018-03-04 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3fdba7fb264d: py3: use util.forcebytestr to convert 
testedwith value to bytes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2663?vs=6598=6604

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

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -990,7 +990,7 @@
 if worst[0] is not None:
 name, testedwith, report = worst
 if not isinstance(testedwith, (bytes, str)):
-testedwith = '.'.join([str(c) for c in testedwith])
+testedwith = '.'.join([util.forcebytestr(c) for c in testedwith])
 warning = (_('** Unknown exception encountered with '
  'possibly-broken third-party extension %s\n'
  '** which supports versions %s of Mercurial.\n'



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


D2664: py3: use b"%d" instead of str() to convert integers to bytes

2018-03-04 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG981f328d6d16: py3: use b%d instead of str() to 
convert integers to bytes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2664?vs=6601=6605

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

AFFECTED FILES
  mercurial/context.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1367,7 +1367,7 @@
 try:
 # str(rev)
 rev = int(id)
-if str(rev) != id:
+if "%d" % rev != id:
 raise ValueError
 if rev < 0:
 rev = len(self) + rev
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -433,7 +433,7 @@
 self._rev = changeid
 return
 if not pycompat.ispy3 and isinstance(changeid, long):
-changeid = str(changeid)
+changeid = "%d" % changeid
 if changeid == 'null':
 self._node = nullid
 self._rev = nullrev



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


D2665: py3: use bytes() instead of str()

2018-03-04 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6bacb2f663cb: py3: use bytes() instead of str() (authored 
by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2665?vs=6602=6606

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2468,7 +2468,7 @@
 if populatecachedelta:
 dp = self.deltaparent(rev)
 if dp != nullrev:
-cachedelta = (dp, str(self._chunk(rev)))
+cachedelta = (dp, bytes(self._chunk(rev)))
 
 if not cachedelta:
 rawtext = self.revision(rev, raw=True)



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


[PATCH STABLE] test-annotate: set stdin and stdout to binary to get CR unmodified

2018-03-04 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1520193237 18000
#  Sun Mar 04 14:53:57 2018 -0500
# Branch stable
# Node ID f89bc48f38c7d87e0810e9308e58bdf6ea565695
# Parent  9a08f7d18c207c590bab631b6daeb5ecfcb6d4b0
test-annotate: set stdin and stdout to binary to get CR unmodified

diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -903,6 +903,9 @@ Annotate with orphaned CR (issue5798)
 
   $ cat <<'EOF' >> "$TESTTMP/substcr.py"
   > import sys
+  > from mercurial import util
+  > util.setbinary(sys.stdin)
+  > util.setbinary(sys.stdout)
   > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
   > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
   > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] test-annotate: rewrite sed with some python

2018-03-04 Thread Matt Harbison

On Sun, 04 Mar 2018 14:53:00 -0500, Yuya Nishihara  wrote:


On Sun, 04 Mar 2018 14:45:01 -0500, Matt Harbison wrote:
On Sun, 04 Mar 2018 13:24:20 -0500, Yuya Nishihara   
wrote:


> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1520187545 18000
> #  Sun Mar 04 13:19:05 2018 -0500
> # Branch stable
> # Node ID 0c042b499ba989d193783a5cd64cca866ce01ae8
> # Parent  b394778b1a5042ca5799f5bae43620dd3324c797
> test-annotate: rewrite sed with some python

No joy, on Windows anyway:


Can you test this?

diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -903,6 +903,9 @@ Annotate with orphaned CR (issue5798)
  $ cat <<'EOF' >> "$TESTTMP/substcr.py"
   > import sys
+  > from mercurial import util
+  > util.setbinary(sys.stdin)
+  > util.setbinary(sys.stdout)
   > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
   > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
   > stdout.write(stdin.read().replace(b'\r', b'[CR]'))


This does the trick for Windows, thanks.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] lock: block signal interrupt while making a lock file

2018-03-04 Thread Yuya Nishihara
On Sun, 04 Mar 2018 14:31:30 -0500, Matt Harbison wrote:
> On Sun, 04 Mar 2018 14:18:04 -0500, Yuya Nishihara  wrote:
> 
> > On Sun, 04 Mar 2018 13:55:40 -0500, Matt Harbison wrote:
> >> On Sun, 04 Mar 2018 12:35:52 -0500, Kevin Bullock
> >>  wrote:
> >>
> >> >> On Mar 4, 2018, at 11:48, Yuya Nishihara  wrote:
> >> >>
> >> >> # HG changeset patch
> >> >> # User Yuya Nishihara 
> >> >> # Date 1520138979 18000
> >> >> #  Sat Mar 03 23:49:39 2018 -0500
> >> >> # Node ID 8ff5f6277e204df49b3426a144375db11b41b38d
> >> >> # Parent  dad68a609114750b5963a8e46563a0b73620156f
> >> >> lock: block signal interrupt while making a lock file
> >> >
> >> > Seems okay, queued, thanks.
> >>
> >> Any chance of getting this on stable, so it can go into the next thg  
> >> build?
> >
> > I thought about that, but this patch seemed a bit scary for pushing into
> > stable.
> 
> Fair enough.  But maybe thg should include it somehow?  The problem is, I  
> haven't been able to build thg on Windows, and unlike on Linux, I have no  
> idea how to point it at a different version of hg.  So aside from testing  
> in core (and I've never hit the problem with bare hg.exe), I'm not sure  
> how much testing this will get before 4.6.0 anyway.

Perhaps the easiest way to test is to write an extension that replaces
util.makelock(). A stale lock file might still be left, but at least it
should contain a pid in it.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] test-annotate: rewrite sed with some python

2018-03-04 Thread Yuya Nishihara
On Sun, 04 Mar 2018 14:45:01 -0500, Matt Harbison wrote:
> On Sun, 04 Mar 2018 13:24:20 -0500, Yuya Nishihara  wrote:
> 
> > # HG changeset patch
> > # User Yuya Nishihara 
> > # Date 1520187545 18000
> > #  Sun Mar 04 13:19:05 2018 -0500
> > # Branch stable
> > # Node ID 0c042b499ba989d193783a5cd64cca866ce01ae8
> > # Parent  b394778b1a5042ca5799f5bae43620dd3324c797
> > test-annotate: rewrite sed with some python
> 
> No joy, on Windows anyway:

Can you test this?

diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -903,6 +903,9 @@ Annotate with orphaned CR (issue5798)
 
   $ cat <<'EOF' >> "$TESTTMP/substcr.py"
   > import sys
+  > from mercurial import util
+  > util.setbinary(sys.stdin)
+  > util.setbinary(sys.stdout)
   > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
   > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
   > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2665: py3: use bytes() instead of str()

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6602.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2665?vs=6600=6602

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2468,7 +2468,7 @@
 if populatecachedelta:
 dp = self.deltaparent(rev)
 if dp != nullrev:
-cachedelta = (dp, str(self._chunk(rev)))
+cachedelta = (dp, bytes(self._chunk(rev)))
 
 if not cachedelta:
 rawtext = self.revision(rev, raw=True)



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


D2664: py3: use b"%d" instead of str() to convert integers to bytes

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6601.
Herald added a reviewer: indygreg.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2664?vs=6599=6601

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

AFFECTED FILES
  mercurial/context.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1367,7 +1367,7 @@
 try:
 # str(rev)
 rev = int(id)
-if str(rev) != id:
+if "%d" % rev != id:
 raise ValueError
 if rev < 0:
 rev = len(self) + rev
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -433,7 +433,7 @@
 self._rev = changeid
 return
 if not pycompat.ispy3 and isinstance(changeid, long):
-changeid = str(changeid)
+changeid = "%d" % changeid
 if changeid == 'null':
 self._node = nullid
 self._rev = nullrev



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


Re: [PATCH STABLE] test-annotate: rewrite sed with some python

2018-03-04 Thread Matt Harbison

On Sun, 04 Mar 2018 13:24:20 -0500, Yuya Nishihara  wrote:


# HG changeset patch
# User Yuya Nishihara 
# Date 1520187545 18000
#  Sun Mar 04 13:19:05 2018 -0500
# Branch stable
# Node ID 0c042b499ba989d193783a5cd64cca866ce01ae8
# Parent  b394778b1a5042ca5799f5bae43620dd3324c797
test-annotate: rewrite sed with some python


No joy, on Windows anyway:

--- c:/Users/Matt/projects/hg/tests/test-annotate.t
+++ c:/Users/Matt/projects/hg/tests/test-annotate.t.err
@@ -916,14 +916,14 @@
   $ hg ci -m1

   $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py"
-  0: 0a[CR]0b[CR]
-  0: 0c[CR]0d[CR]
+  0: 0a[CR]0b\r (esc)
+  0: 0c[CR]0d\r (esc)
   0: 0e
   0: 0f
   0: 0g
   $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py"
-  0: 0a[CR]0b[CR]
-  1: 1c[CR]1d[CR]
+  0: 0a[CR]0b\r (esc)
+  1: 1c[CR]1d\r (esc)
   0: 0e
   1: 1f
   0: 0g

The one difference I see from Linux (where it works), is that Windows does  
have the 'buffer' attribute on sys.stdout, while Linux doesn't.  Neither  
have 'buffer' in stdin.

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


D2647: setdiscovery: include all local heads in second "known" request (issue5809)

2018-03-04 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D2647#42980, @indygreg wrote:
  
  > The commit message looks incomplete?
  >
  > We really want a change like this to be documented. Could you please write 
more in the commit message and inline? The docstring of `_takequicksample()` is 
also now inaccurate.
  >
  > Also, I'm not convinced this change is correct. Should we connect IRL?
  
  
  Heh, I sent this by mistake. I think it should be functionally correct, but 
we can optimize better. I'll drop this patch.

REPOSITORY
  rHG Mercurial

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

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


D2648: py3: use pycompat.bytestr instead of str

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 6597.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2648?vs=6562=6597

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/debugcommands.py
  mercurial/subrepo.py
  mercurial/wireproto.py

CHANGE DETAILS

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -1043,7 +1043,7 @@
 util.stderr.write("(%s)\n" % exc.hint)
 return pushres(0, output.getvalue() if output else '')
 except error.PushRaced:
-return pusherr(str(exc),
+return pusherr(pycompat.bytestr(exc),
output.getvalue() if output else '')
 
 bundler = bundle2.bundle20(repo.ui)
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1123,7 +1123,7 @@
 doc = xml.dom.minidom.parseString(output)
 paths = []
 for e in doc.getElementsByTagName('entry'):
-kind = str(e.getAttribute('kind'))
+kind = pycompat.bytestr(e.getAttribute('kind'))
 if kind != 'file':
 continue
 name = ''.join(c.data for c
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1811,7 +1811,7 @@
 if keyinfo:
 key, old, new = keyinfo
 r = target.pushkey(namespace, key, old, new)
-ui.status(str(r) + '\n')
+ui.status(pycompat.bytestr(r) + '\n')
 return not r
 else:
 for k, v in sorted(target.listkeys(namespace).iteritems()):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1197,7 +1197,7 @@
 bcompression, cgversion, params = exchange.parsebundlespec(
 repo, bundletype, strict=False)
 except error.UnsupportedBundleSpecification as e:
-raise error.Abort(str(e),
+raise error.Abort(pycompat.bytestr(e),
   hint=_("see 'hg help bundlespec' for supported "
  "values for --type"))
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -362,7 +362,7 @@
 ui.debug(fp.getvalue())
 patch.internalpatch(ui, repo, fp, 1, eolmode=None)
 except error.PatchError as err:
-raise error.Abort(str(err))
+raise error.Abort(pycompat.bytestr(err))
 del fp
 
 # 4. We prepared working directory according to filtered
@@ -1432,7 +1432,7 @@
 files=files, eolmode=None, similarity=sim / 100.0)
 except error.PatchError as e:
 if not partial:
-raise error.Abort(str(e))
+raise error.Abort(pycompat.bytestr(e))
 if partial:
 rejects = True
 
@@ -3043,7 +3043,7 @@
 try:
 patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None)
 except error.PatchError as err:
-raise error.Abort(str(err))
+raise error.Abort(pycompat.bytestr(err))
 del fp
 else:
 for f in actions['revert'][0]:



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


D2664: py3: use b"%d" instead of str() to convert integers to bytes

2018-03-04 Thread pulkit (Pulkit Goyal)
pulkit 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/D2664

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
@@ -433,7 +433,7 @@
 self._rev = changeid
 return
 if not pycompat.ispy3 and isinstance(changeid, long):
-changeid = str(changeid)
+changeid = "%d" % changeid
 if changeid == 'null':
 self._node = nullid
 self._rev = nullrev



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


D2665: py3: use bytes() instead of str()

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2468,7 +2468,7 @@
 if populatecachedelta:
 dp = self.deltaparent(rev)
 if dp != nullrev:
-cachedelta = (dp, str(self._chunk(rev)))
+cachedelta = (dp, bytes(self._chunk(rev)))
 
 if not cachedelta:
 rawtext = self.revision(rev, raw=True)



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


D2663: py3: use util.forcebytestr to convert testedwith value to bytes

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

REVISION SUMMARY
  Bad extensions can put anything in testedwith so we should use 
util.forcebytestr
  here.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dispatch.py

CHANGE DETAILS

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -990,7 +990,7 @@
 if worst[0] is not None:
 name, testedwith, report = worst
 if not isinstance(testedwith, (bytes, str)):
-testedwith = '.'.join([str(c) for c in testedwith])
+testedwith = '.'.join([util.forcebytestr(c) for c in testedwith])
 warning = (_('** Unknown exception encountered with '
  'possibly-broken third-party extension %s\n'
  '** which supports versions %s of Mercurial.\n'



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


Re: [PATCH] lock: block signal interrupt while making a lock file

2018-03-04 Thread Matt Harbison

On Sun, 04 Mar 2018 14:18:04 -0500, Yuya Nishihara  wrote:


On Sun, 04 Mar 2018 13:55:40 -0500, Matt Harbison wrote:

On Sun, 04 Mar 2018 12:35:52 -0500, Kevin Bullock
 wrote:

>> On Mar 4, 2018, at 11:48, Yuya Nishihara  wrote:
>>
>> # HG changeset patch
>> # User Yuya Nishihara 
>> # Date 1520138979 18000
>> #  Sat Mar 03 23:49:39 2018 -0500
>> # Node ID 8ff5f6277e204df49b3426a144375db11b41b38d
>> # Parent  dad68a609114750b5963a8e46563a0b73620156f
>> lock: block signal interrupt while making a lock file
>
> Seems okay, queued, thanks.

Any chance of getting this on stable, so it can go into the next thg  
build?


I thought about that, but this patch seemed a bit scary for pushing into
stable.


Fair enough.  But maybe thg should include it somehow?  The problem is, I  
haven't been able to build thg on Windows, and unlike on Linux, I have no  
idea how to point it at a different version of hg.  So aside from testing  
in core (and I've never hit the problem with bare hg.exe), I'm not sure  
how much testing this will get before 4.6.0 anyway.

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


D2625: xxhash: vendor external library

2018-03-04 Thread indygreg (Gregory Szorc)
indygreg abandoned this revision.
indygreg added a comment.


  I'm going to let @quark do his work first. I may revive these later if 
there's still a need.

REPOSITORY
  rHG Mercurial

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

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


D2646: setdiscovery: avoid a Yoda condition

2018-03-04 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG59802fa590db: setdiscovery: avoid a Yoda condition 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2646?vs=6558=6596

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

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -106,7 +106,7 @@
 :nodes: set of nodes to discover
 :size: the maximum size of the sample"""
 sample = dag.headsetofconnecteds(nodes)
-if size <= len(sample):
+if len(sample) >= size:
 return _limitsample(sample, size)
 _updatesample(dag, None, sample, quicksamplesize=size)
 return sample



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


  1   2   3   >