D7570: match: resolve filesets against the passed `cwd`, not the current one

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


  In D7570#111295 , @yuja wrote:
  
  >>   if listsubrepos:
  >>   for subpath in ctx.substate:
  >>
  >> - sm = ctx.sub(subpath).matchfileset(pat, badfn=badfn)
  >>
  >> +sm = ctx.sub(subpath).matchfileset(
  >> +pat, badfn=badfn, cwd=cwd
  >> +)
  >
  > Might have to adjust cwd since it may be relative to the parent's repo.root.
  
  Do you think this patch is making it worse or can we leave it as is for now 
and let someone who cares about subrepos fix it?
  
  >> class matchctx(object):
  >>
  >> - def __init__(self, basectx, ctx, badfn=None):
  >>
  >> +def __init__(self, basectx, ctx, badfn=None, cwd=None):
  >>
  >>   self._basectx = basectx
  >>   self.ctx = ctx
  >>   self._badfn = badfn
  >>   self._match = None
  >>   self._status = None
  >>
  >> +self.cwd = cwd
  >>
  >>   def narrowed(self, match):
  >>   """Create matchctx for a sub-tree narrowed by the given matcher"""
  >
  > Perhaps self.cwd would have to be copied to the matchctx objects created
  > by itself.
  > One option to detect this kind of bugs is to remove the default parameters.
  
  Good idea, I've updated Matt's patch with that suggestion.

REPOSITORY
  rHG Mercurial

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

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

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


D7570: match: resolve filesets against the passed `cwd`, not the current one

2019-12-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 18596.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7570?vs=18508=18596

BRANCH
  default

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

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

AFFECTED FILES
  hgext/highlight/__init__.py
  mercurial/context.py
  mercurial/debugcommands.py
  mercurial/fileset.py
  mercurial/match.py
  mercurial/subrepo.py
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1333,24 +1333,20 @@
 Apparently fixing p1() and its descendants doesn't include wdir() unless
 explicitly stated.
 
-BROKEN: fileset matches aren't relative to repo.root for commits
-
   $ hg fix -r '.::'
   $ hg cat -r . ../quux
   quux
   $ hg cat -r tip ../quux
-  quux
+  fs: $TESTTMP/subprocesscwd
   $ cat ../quux
   quux
 
 Clean files are not fixed unless explicitly named
   $ echo 'dirty' > ../quux
 
-BROKEN: fileset matches aren't relative to repo.root for wdir
-
   $ hg fix --working-dir
   $ cat ../quux
-  dirty
+  fs: $TESTTMP/subprocesscwd
 
   $ cd ../..
 
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -355,7 +355,7 @@
 """return file flags"""
 return b''
 
-def matchfileset(self, expr, badfn=None):
+def matchfileset(self, cwd, expr, badfn=None):
 """Resolve the fileset expression for this repo"""
 return matchmod.never(badfn=badfn)
 
@@ -894,20 +894,20 @@
 return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt, subrepos)
 
 @annotatesubrepoerror
-def matchfileset(self, expr, badfn=None):
+def matchfileset(self, cwd, expr, badfn=None):
 if self._ctx.rev() is None:
 ctx = self._repo[None]
 else:
 rev = self._state[1]
 ctx = self._repo[rev]
 
-matchers = [ctx.matchfileset(expr, badfn=badfn)]
+matchers = [ctx.matchfileset(cwd, expr, badfn=badfn)]
 
 for subpath in ctx.substate:
 sub = ctx.sub(subpath)
 
 try:
-sm = sub.matchfileset(expr, badfn=badfn)
+sm = sub.matchfileset(cwd, expr, badfn=badfn)
 pm = matchmod.prefixdirmatcher(subpath, sm, badfn=badfn)
 matchers.append(pm)
 except error.LookupError:
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -57,7 +57,7 @@
 return m.match
 
 
-def _expandsets(kindpats, ctx=None, listsubrepos=False, badfn=None):
+def _expandsets(cwd, kindpats, ctx=None, listsubrepos=False, badfn=None):
 '''Returns the kindpats list with the 'set' patterns expanded to 
matchers'''
 matchers = []
 other = []
@@ -68,11 +68,11 @@
 raise error.ProgrammingError(
 b"fileset expression with no context"
 )
-matchers.append(ctx.matchfileset(pat, badfn=badfn))
+matchers.append(ctx.matchfileset(cwd, pat, badfn=badfn))
 
 if listsubrepos:
 for subpath in ctx.substate:
-sm = ctx.sub(subpath).matchfileset(pat, badfn=badfn)
+sm = ctx.sub(subpath).matchfileset(cwd, pat, badfn=badfn)
 pm = prefixdirmatcher(subpath, sm, badfn=badfn)
 matchers.append(pm)
 
@@ -117,11 +117,11 @@
 
 
 def _buildkindpatsmatcher(
-matchercls, root, kindpats, ctx=None, listsubrepos=False, badfn=None
+matchercls, root, cwd, kindpats, ctx=None, listsubrepos=False, badfn=None,
 ):
 matchers = []
 fms, kindpats = _expandsets(
-kindpats, ctx=ctx, listsubrepos=listsubrepos, badfn=badfn
+cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, badfn=badfn,
 )
 if kindpats:
 m = matchercls(root, kindpats, badfn=badfn)
@@ -256,6 +256,7 @@
 m = _buildkindpatsmatcher(
 patternmatcher,
 root,
+cwd,
 kindpats,
 ctx=ctx,
 listsubrepos=listsubrepos,
@@ -271,6 +272,7 @@
 im = _buildkindpatsmatcher(
 includematcher,
 root,
+cwd,
 kindpats,
 ctx=ctx,
 listsubrepos=listsubrepos,
@@ -282,6 +284,7 @@
 em = _buildkindpatsmatcher(
 includematcher,
 root,
+cwd,
 kindpats,
 ctx=ctx,
 listsubrepos=listsubrepos,
diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -520,29 +520,30 @@
 
 
 class matchctx(object):
-def __init__(self, basectx, ctx, badfn=None):
+def __init__(self, basectx, ctx, cwd, badfn=None):
 self._basectx = basectx
 self.ctx = ctx
 self._badfn = badfn
 self._match = None
 

D7570: match: resolve filesets against the passed `cwd`, not the current one

2019-12-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.
martinvonz added a subscriber: hooper.

INLINE COMMENTS

> mharbison72 wrote in test-fix.t:1336-1342
> I found a couple of things surprising here:
> 
> 1. `.::` doesn't include fixing wdir()
> 2. `.` isn't updated unless `-w` is specified
> 3. `-w` doesn't alter `wdir()` content unless there are dirty files (makes 
> sense), but //will// update `.` if starting with a clean `wdir()`
> 
> The first issue seems related to 
> https://www.mercurial-scm.org/wiki/RevsetVirtualRevisionPlan
> 
> I can't think of any reason you'd want to fix `.` and not `wdir()` other than 
> "I'm afraid the fixer will eat my uncommitted data".  Is there a reason not 
> to do it by default, and instead require --no-working-dir to get the current 
> behavior?  If there are uncommitted changes, it seems that the user would be 
> caught with needing to commit on top of the obsolete commit, and then 
> evolve/rebase and deal with the merge conflicts.
> 
> I ended up spending a bunch of time troubleshooting why the content of `-r .` 
> didn't seem to be updated here, without realizing the automatic evolve was 
> conditional.  Part of this was not being able to easily peek into the 
> finished test to see the state of the repo.  I guess it makes sense to keep 
> the diff from `wdir()` unchanged, and therefore keep the original parent.  
> But I think this confusion is another reason to default to `-w`.
> 
> Alternately if `.` is in the set of revisions being fixed and `wdir()` is 
> dirty, maybe it can abort and hint to add `-w` or `--force`?

> `.::` doesn't include fixing wdir()

Yes, that's how revsets work (as you noted)

> `.` isn't updated unless `-w` is specified

Yes, because otherwise the working directory would appear to undo the 
formatting changes. I don't remember why we don't just always format the 
working directory when we format the parent of the working directory. I'm sure 
@hooper remembers the reasoning better.

> `-w` doesn't alter `wdir()` content unless there are dirty files (makes 
> sense), but will update `.` if starting with a clean `wdir()`

Do you mean with *just* `-w`? That shouldn't change any commits, so it seems 
very weird if it checks out a different commit. If you meant something like `-w 
-r .`, then that *would* format the working copy too, but it may not seem like 
it if the working copy was clean before and after the command (but it was 
formatted to match the parent commit).

REPOSITORY
  rHG Mercurial

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

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

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


D7601: fuzz: fix test-fuzz-targets.t to run with python3

2019-12-10 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/dirstate_corpus.py
  contrib/fuzz/mpatch_corpus.py
  contrib/fuzz/revlog_corpus.py

CHANGE DETAILS

diff --git a/contrib/fuzz/revlog_corpus.py b/contrib/fuzz/revlog_corpus.py
--- a/contrib/fuzz/revlog_corpus.py
+++ b/contrib/fuzz/revlog_corpus.py
@@ -18,8 +18,8 @@
 
 with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
 if os.path.exists(changelog):
-with open(changelog) as f:
+with open(changelog, 'rb') as f:
 zf.writestr("00changelog.i", f.read())
 if os.path.exists(contributing):
-with open(contributing) as f:
+with open(contributing, 'rb') as f:
 zf.writestr("contributing.i", f.read())
diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py
--- a/contrib/fuzz/mpatch_corpus.py
+++ b/contrib/fuzz/mpatch_corpus.py
@@ -20,7 +20,11 @@
 self.end = end
 self.data = data
 
-def __str__(self):
+def __repr__(self):
+# py2 calls __repr__ when you do `bytes(foo)`
+return self.__bytes__()
+
+def __bytes__(self):
 return (
 struct.pack(">lll", self.start, self.end, len(self.data))
 + self.data
@@ -31,8 +35,12 @@
 def __init__(self, frags):
 self.frags = frags
 
-def __str__(self):
-return ''.join(str(f) for f in self.frags)
+def __repr__(self):
+# py2 calls __repr__ when you do `bytes(foo)`
+return self.__bytes__()
+
+def __bytes__(self):
+return b''.join(bytes(f) for f in self.frags)
 
 
 class corpus(object):
@@ -40,8 +48,12 @@
 self.base = base
 self.deltas = deltas
 
-def __str__(self):
-deltas = [str(d) for d in self.deltas]
+def __repr__(self):
+# py2 calls __repr__ when you do `bytes(foo)`
+return self.__bytes__()
+
+def __bytes__(self):
+deltas = [bytes(d) for d in self.deltas]
 parts = (
 [
 struct.pack(">B", len(deltas) + 1),
@@ -51,300 +63,301 @@
 + [self.base]
 + deltas
 )
-return "".join(parts)
+return b''.join(parts)
 
 
 with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
 # Manually constructed entries
 zf.writestr(
-"one_delta_applies", str(corpus('a', [delta([deltafrag(0, 1, 'b')])]))
+"one_delta_applies",
+bytes(corpus(b'a', [delta([deltafrag(0, 1, b'b')])]))
 )
 zf.writestr(
 "one_delta_starts_late",
-str(corpus('a', [delta([deltafrag(3, 1, 'b')])])),
+bytes(corpus(b'a', [delta([deltafrag(3, 1, b'b')])]))
 )
 zf.writestr(
 "one_delta_ends_late",
-str(corpus('a', [delta([deltafrag(0, 20, 'b')])])),
+bytes(corpus(b'a', [delta([deltafrag(0, 20, b'b')])]))
 )
 
 try:
 # Generated from repo data
-r = hg.repository(uimod.ui(), '../..')
-fl = r.file('mercurial/manifest.py')
+r = hg.repository(uimod.ui(), b'../..')
+fl = r.file(b'mercurial/manifest.py')
 rl = getattr(fl, '_revlog', fl)
 bins = rl._chunks(rl._deltachain(10)[0])
-zf.writestr('manifest_py_rev_10', str(corpus(bins[0], bins[1:])))
+zf.writestr('manifest_py_rev_10', bytes(corpus(bins[0], bins[1:])))
 except:  # skip this, so no re-raises
 print('skipping seed file from repo data')
 # Automatically discovered by running the fuzzer
 zf.writestr(
-"mpatch_decode_old_overread", "\x02\x00\x00\x00\x02\x00\x00\x00"
+"mpatch_decode_old_overread", b"\x02\x00\x00\x00\x02\x00\x00\x00"
 )
 # https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8876
 zf.writestr(
 "mpatch_ossfuzz_getbe32_ubsan",
-"\x02\x00\x00\x00\x0c\xff\xff\xff\xff",
+b"\x02\x00\x00\x00\x0c\xff\xff\xff\xff",
 )
 zf.writestr(
 "mpatch_apply_over_memcpy",
-'\x13\x01\x00\x05\xd0\x00\x00\x00\x00\x00\x00\x00\x00\n \x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
-

D7600: fuzz: add a seed corpus for the dirs fuzzer

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

REVISION SUMMARY
  I was hoping to trigger an asan violation under Python 3 that some internal
  tests at Google found, but for some reason that's beyond me I can't seem to
  manage.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile
  contrib/fuzz/dirs_corpus.py

CHANGE DETAILS

diff --git a/contrib/fuzz/dirs_corpus.py b/contrib/fuzz/dirs_corpus.py
new file mode 100644
--- /dev/null
+++ b/contrib/fuzz/dirs_corpus.py
@@ -0,0 +1,29 @@
+from __future__ import absolute_import, print_function
+
+import argparse
+import zipfile
+
+ap = argparse.ArgumentParser()
+ap.add_argument("out", metavar="some.zip", type=str, nargs=1)
+args = ap.parse_args()
+
+with zipfile.ZipFile(args.out[0], "w", zipfile.ZIP_STORED) as zf:
+zf.writestr(
+"greek-tree",
+"\n".join(
+[
+"iota",
+"A/mu",
+"A/B/lambda",
+"A/B/E/alpha",
+"A/B/E/beta",
+"A/D/gamma",
+"A/D/G/pi",
+"A/D/G/rho",
+"A/D/G/tau",
+"A/D/H/chi",
+"A/D/H/omega",
+"A/D/H/psi",
+]
+),
+)
diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -62,7 +62,7 @@
 
 PARSERS_OBJS=parsers-manifest.o parsers-charencode.o parsers-parsers.o 
parsers-dirs.o parsers-pathencode.o parsers-revlog.o
 
-dirs_fuzzer: dirs.cc pyutil.o $(PARSERS_OBJS)
+dirs_fuzzer: dirs.cc pyutil.o $(PARSERS_OBJS) $$OUT/dirs_fuzzer_seed_corpus.zip
$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirs.cc \



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


D7599: fuzz: clean up production of seed corpora

2019-12-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was getting out of hand.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -18,6 +18,9 @@
 
 standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cc
 
+$$OUT/%_fuzzer_seed_corpus.zip: %_corpus.py
+   python $< $@
+
 pyutil.o: pyutil.cc pyutil.h
$(CXX) $(CXXFLAGS) -g -O1 \
  `$(PYTHON_CONFIG) --cflags` \
@@ -38,14 +41,11 @@
 mpatch-oss-fuzz.o: ../../mercurial/mpatch.c
$(CC) $(CFLAGS) -c -o mpatch-oss-fuzz.o ../../mercurial/mpatch.c
 
-mpatch_fuzzer: mpatch.cc mpatch-oss-fuzz.o 
+mpatch_fuzzer: mpatch.cc mpatch-oss-fuzz.o $$OUT/mpatch_fuzzer_seed_corpus.zip
$(CXX) $(CXXFLAGS) -std=c++17 -I../../mercurial mpatch.cc \
  mpatch-oss-fuzz.o $(LIB_FUZZING_ENGINE) -o \
  $$OUT/mpatch_fuzzer
 
-mpatch_corpus.zip:
-   python mpatch_corpus.py $$OUT/mpatch_fuzzer_seed_corpus.zip
-
 fuzz-x%.o: ../../mercurial/thirdparty/xdiff/x%.c 
../../mercurial/thirdparty/xdiff/*.h
$(CC) $(CFLAGS) -c \
  -o $@ \
@@ -86,10 +86,7 @@
  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
  -o $$OUT/jsonescapeu8fast_fuzzer
 
-manifest_corpus.zip:
-   python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
-
-manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS)
+manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/manifest_fuzzer_seed_corpus.zip
$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial manifest.cc \
@@ -97,7 +94,7 @@
  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
  -o $$OUT/manifest_fuzzer
 
-revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS)
+revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/revlog_fuzzer_seed_corpus.zip
$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial revlog.cc \
@@ -105,10 +102,7 @@
  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
  -o $$OUT/revlog_fuzzer
 
-revlog_corpus.zip:
-   python revlog_corpus.py $$OUT/revlog_fuzzer_seed_corpus.zip
-
-dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS)
+dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/dirstate_fuzzer_seed_corpus.zip
$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirstate.cc \
@@ -116,10 +110,7 @@
  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
  -o $$OUT/dirstate_fuzzer
 
-dirstate_corpus.zip:
-   python dirstate_corpus.py $$OUT/dirstate_fuzzer_seed_corpus.zip
-
-fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS)
+fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/fm1readmarkers_fuzzer_seed_corpus.zip
$(CXX) $(CXXFLAGS) `$(PYTHON_CONFIG) --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial fm1readmarkers.cc \
@@ -127,15 +118,12 @@
  $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
  -o $$OUT/fm1readmarkers_fuzzer
 
-fm1readmarkers_corpus.zip:
-   python fm1readmarkers_corpus.py 
$$OUT/fm1readmarkers_fuzzer_seed_corpus.zip
-
 clean:
$(RM) *.o *_fuzzer \
  bdiff \
  mpatch \
  xdiff
 
-oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
dirs_fuzzer fncache_fuzzer jsonescapeu8fast_fuzzer manifest_fuzzer 
manifest_corpus.zip revlog_fuzzer revlog_corpus.zip dirstate_fuzzer 
dirstate_corpus.zip fm1readmarkers_fuzzer fm1readmarkers_corpus.zip
+oss-fuzz: bdiff_fuzzer mpatch_fuzzer xdiff_fuzzer dirs_fuzzer fncache_fuzzer 
jsonescapeu8fast_fuzzer manifest_fuzzer revlog_fuzzer dirstate_fuzzer 
fm1readmarkers_fuzzer
 
 .PHONY: all clean oss-fuzz



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


D7598: py3: fix a bytes vs str issue in remotefilelog extension

2019-12-10 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/remotefilelog/fileserverclient.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/fileserverclient.py 
b/hgext/remotefilelog/fileserverclient.py
--- a/hgext/remotefilelog/fileserverclient.py
+++ b/hgext/remotefilelog/fileserverclient.py
@@ -663,5 +663,5 @@
 self.ui.log(
 b'remotefilelog',
 b'excess remotefilelog fetching:\n%s\n',
-b''.join(traceback.format_stack()),
+b''.join(pycompat.sysbytes(traceback.format_stack())),
 )



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


D7597: dirs: fix out-of-bounds access in Py3

2019-12-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The hack for mutating Python's variable-length integers that was
  ported to py3 in cb3048746dae 
 
(dirs: port PyInt code to work on Python
  3, 2016-10-08) was reading from ob_digit[1] instead of ob_digit[0] for
  some reason. Space for ob_digit[1] would only be allocated for
  integers larger than 30 bits, so we ended up writing to unallocated
  memory. Also, we would write an integer that's 2^30 too large, so we
  would never free these integers.
  
  Found by AddressSanitizer.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/dirs.c

CHANGE DETAILS

diff --git a/mercurial/cext/dirs.c b/mercurial/cext/dirs.c
--- a/mercurial/cext/dirs.c
+++ b/mercurial/cext/dirs.c
@@ -14,7 +14,7 @@
 #include "util.h"
 
 #ifdef IS_PY3K
-#define PYLONG_VALUE(o) ((PyLongObject *)o)->ob_digit[1]
+#define PYLONG_VALUE(o) ((PyLongObject *)o)->ob_digit[0]
 #else
 #define PYLONG_VALUE(o) PyInt_AS_LONG(o)
 #endif



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


[PATCH 1 of 2] crecord: repurpose "a" key to toggle all selections (BC)

2019-12-10 Thread Jordi Gutiérrez Hermoso
# HG changeset patch
# User Jordi Gutiérrez Hermoso 
# Date 1576015329 18000
#  Tue Dec 10 17:02:09 2019 -0500
# Node ID bd10bc4bdb994b875040c0c58f1c341df66ddd46
# Parent  ce088b38f92b6d480df2072dc45fb068443758dd
crecord: repurpose "a" key to toggle all selections (BC)

I really don't like "a". I keep accidentally hitting it when I
actually want "A", and then I'm suddenly in a state I don't want to be
in. There's a big wall of text telling me that I've turned amend mode
on or off (which one was I orginally in?), and this seems very
useless.

If I wanted to amend or not, I would have chosen that from the
command-line, not change my mind after I've already started picking
hunks apart.

It seems much better to repurpose this key to be a "weaker" version of
"A". It toggles all selections. This is pretty harmless if hit
accidentally, (can just hit "a" again to undo it), and has immediate
visual feedback that something happened: all the x's and blank spaces
get switched around. And unlike with amend, the current flipped state
is also immediately visible without having to read a wall of text.

I'm calling this a BC, however, because somewhere, someone out there
has probably really fallen in love with the old use of "a" and will
get angry that we took it away.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -990,6 +990,13 @@ class curseschunkselector(object):
 self.toggleapply(item)
 self.waslasttoggleallapplied = not self.waslasttoggleallapplied
 
+def flipselections(self):
+b"flip all selections"
+for header in self.headerlist:
+for hunk in header.allchildren():
+for line in hunk.allchildren():
+self.toggleapply(line)
+
 def toggleallbetween(self):
 """toggle applied on or off for all items in range [lastapplied,
 current]. """
@@ -1637,7 +1644,7 @@ the following are valid keystrokes:
  ctrl-l : scroll the selected line to the top of the screen
   m : edit / resume editing the commit message
   e : edit the currently selected hunk
-  a : toggle amend mode, only with commit -i
+  a : toggle all selections
   c : confirm selected changes
   r : review/edit and confirm selected changes
   q : quit without confirming (no changes will be made)
@@ -1913,7 +1920,7 @@ are you sure you want to review/edit and
 elif keypressed in ["q"]:
 raise error.Abort(_(b'user quit'))
 elif keypressed in ['a']:
-self.toggleamend(self.opts, test)
+self.flipselections()
 elif keypressed in ["c"]:
 return True
 elif keypressed in ["r"]:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] crecord: remove toggleamend

2019-12-10 Thread Jordi Gutiérrez Hermoso
# HG changeset patch
# User Jordi Gutiérrez Hermoso 
# Date 1576015629 18000
#  Tue Dec 10 17:07:09 2019 -0500
# Node ID fa825ca77328e397df683a91c8beeca7060bf726
# Parent  bd10bc4bdb994b875040c0c58f1c341df66ddd46
crecord: remove toggleamend

Previous commit removed its only calling site.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1763,32 +1763,6 @@ are you sure you want to review/edit and
 else:
 return False
 
-def toggleamend(self, opts, test):
-"""Toggle the amend flag.
-
-When the amend flag is set, a commit will modify the most recently
-committed changeset, instead of creating a new changeset.  Otherwise, a
-new changeset will be created (the normal commit behavior).
-"""
-
-if opts.get(b'amend') is None:
-opts[b'amend'] = True
-msg = _(
-b"Amend option is turned on -- committing the currently "
-b"selected changes will not create a new changeset, but "
-b"instead update the most recently committed changeset.\n\n"
-b"Press any key to continue."
-)
-elif opts.get(b'amend') is True:
-opts[b'amend'] = None
-msg = _(
-b"Amend option is turned off -- committing the currently "
-b"selected changes will create a new changeset.\n\n"
-b"Press any key to continue."
-)
-if not test:
-self.confirmationwindow(msg)
-
 def recenterdisplayedarea(self):
 """
 once we scrolled with pg up pg down we can be pointing outside of the
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7528: rust-matchers: add `FileMatcher` implementation

2019-12-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> matchers.rs:129-132
> +/// assert_eq!(true, matcher.matches(HgPath::new(b"a.txt")));
> +/// assert_eq!(false, matcher.matches(HgPath::new(b"b.txt")));
> +/// assert_eq!(false, matcher.matches(HgPath::new(b"main.c")));
> +/// assert_eq!(true, matcher.matches(HgPath::new(br"re:.*\.c$")));

Same comment as on another (already submitted) patch: the argument order feels 
backwards. Do you mind changing it?

> matchers.rs:136
> +pub struct FileMatcher<'a> {
> +files: HashSet<&'a HgPath>,
> +dirs: DirsMultiset,

It would be slightly simpler if the paths were owned. It doesn't seem too 
expensive to take ownership of the paths. Do we have any call sites in this 
series that we can look at?

REPOSITORY
  rHG Mercurial

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

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

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


D7507: phabricator: add a "phabstatus" template keyword

2019-12-10 Thread dlax (Denis Laxalde)
dlax updated this revision to Diff 18590.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7507?vs=18321=18590

BRANCH
  default

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

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -1684,6 +1684,28 @@
 return None
 
 
+@eh.templatekeyword(b'phabstatus', requires={b'ctx', b'repo', b'ui'})
+def template_status(context, mapping):
+""":phabstatus: String. Status of Phabricator differential.
+"""
+ctx = context.resource(mapping, b'ctx')
+repo = context.resource(mapping, b'repo')
+ui = context.resource(mapping, b'ui')
+
+rev = ctx.rev()
+try:
+drevid = getdrevmap(repo, [rev])[rev]
+except KeyError:
+return None
+drevs = callconduit(ui, b'differential.query', {b'ids': [drevid]})
+for drev in drevs:
+if int(drev[b'id']) == drevid:
+return templateutil.hybriddict(
+{b'url': drev[b'uri'], b'status': drev[b'statusName'],}
+)
+return None
+
+
 @show.showview(b'phabstatus', csettopic=b'work')
 def phabstatusshowview(ui, repo, displayer):
 """Phabricator differiential status"""



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


D7506: phabricator: add a "phabstatus" show view

2019-12-10 Thread dlax (Denis Laxalde)
dlax updated this revision to Diff 18589.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7506?vs=18338=18589

BRANCH
  default

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

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -11,6 +11,10 @@
 revisions in a format suitable for :hg:`import`, and a ``phabupdate`` command
 to update statuses in batch.
 
+A "phabstatus" view for :hg:`show` is also provided; it displays status
+information of Phabricator differentials associated with unfinished
+changesets.
+
 By default, Phabricator requires ``Test Plan`` which might prevent some
 changeset from being sent. The requirement could be disabled by changing
 ``differential.require-test-plan-field`` config server side.
@@ -60,7 +64,9 @@
 encoding,
 error,
 exthelper,
+graphmod,
 httpconnection as httpconnectionmod,
+logcmdutil,
 match,
 mdiff,
 obsutil,
@@ -80,6 +86,8 @@
 procutil,
 stringutil,
 )
+from . import show
+
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -465,6 +473,29 @@
 return result
 
 
+def getdrevmap(repo, revs):
+"""Return a dict mapping each rev in `revs` to their Differential Revision
+ID or None.
+"""
+result = {}
+for rev in revs:
+result[rev] = None
+ctx = repo[rev]
+# Check commit message
+m = _differentialrevisiondescre.search(ctx.description())
+if m:
+result[rev] = int(m.group('id'))
+continue
+# Check tags
+for tag in repo.nodetags(ctx.node()):
+m = _differentialrevisiontagre.match(tag)
+if m:
+result[rev] = int(m.group(1))
+break
+
+return result
+
+
 def getdiff(ctx, diffopts):
 """plain-text diff without header (user, commit message, etc)"""
 output = util.stringio()
@@ -1651,3 +1682,42 @@
 
 return templateutil.hybriddict({b'url': url, b'id': t,})
 return None
+
+
+@show.showview(b'phabstatus', csettopic=b'work')
+def phabstatusshowview(ui, repo, displayer):
+"""Phabricator differiential status"""
+revs = repo.revs('sort(_underway(), topo)')
+drevmap = getdrevmap(repo, revs)
+unknownrevs, drevids, revsbydrevid = [], set([]), {}
+for rev, drevid in pycompat.iteritems(drevmap):
+if drevid is not None:
+drevids.add(drevid)
+revsbydrevid.setdefault(drevid, set([])).add(rev)
+else:
+unknownrevs.append(rev)
+
+drevs = callconduit(ui, b'differential.query', {b'ids': list(drevids)})
+drevsbyrev = {}
+for drev in drevs:
+for rev in revsbydrevid[int(drev[b'id'])]:
+drevsbyrev[rev] = drev
+
+def phabstatus(ctx):
+drev = drevsbyrev[ctx.rev()]
+ui.write(b"\n%(uri)s %(statusName)s\n" % drev)
+
+revs -= smartset.baseset(unknownrevs)
+revdag = graphmod.dagwalker(repo, revs)
+
+ui.setconfig(b'experimental', b'graphshorten', True)
+displayer._exthook = phabstatus
+nodelen = show.longestshortest(repo, revs)
+logcmdutil.displaygraph(
+ui,
+repo,
+revdag,
+displayer,
+graphmod.asciiedges,
+props={b'nodelen': nodelen},
+)



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


D7531: rust-matchers: add support for `explicitmatcher` in `dirstate.status`

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


  Did you mean s/explicitmatcher/exactmatcher/ in the description? Also, I 
thought you called it FileMatcher instead. What's the difference?

REPOSITORY
  rHG Mercurial

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

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

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


D7118: rust-dirstatemap: remove additional lookups in traverse

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


  What's the state of this patch? The description makes it sound like it's a 
Rust patch, but it only modifies Python code.

REPOSITORY
  rHG Mercurial

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

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

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


D7595: status: outputting structured unfinished-operation information

2019-12-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 18588.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7595?vs=18562=18588

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/configitems.py
  tests/test-conflict.t
  tests/test-status.t

CHANGE DETAILS

diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -254,35 +254,43 @@
   $ hg status -A -Tjson
   [
{
+"itemtype": "file",
 "path": "added",
 "status": "A"
},
{
+"itemtype": "file",
 "path": "copied",
 "source": "modified",
 "status": "A"
},
{
+"itemtype": "file",
 "path": "removed",
 "status": "R"
},
{
+"itemtype": "file",
 "path": "deleted",
 "status": "!"
},
{
+"itemtype": "file",
 "path": "unknown",
 "status": "?"
},
{
+"itemtype": "file",
 "path": "ignored",
 "status": "I"
},
{
+"itemtype": "file",
 "path": ".hgignore",
 "status": "C"
},
{
+"itemtype": "file",
 "path": "modified",
 "status": "C"
}
@@ -558,6 +566,7 @@
   $ hg status --config ui.formatdebug=True --rev 1 1
   status = [
   {
+  'itemtype': 'file',
   'path': '1/2/3/4/5/b.txt',
   'status': 'R'
   },
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -63,16 +63,38 @@
   $ hg status -Tjson
   [
{
+"itemtype": "file",
 "path": "a",
 "status": "M",
 "unresolved": true
},
{
+"itemtype": "file",
 "path": "a.orig",
 "status": "?"
}
   ]
 
+  $ hg status -Tjson --config commands.status.morestatus-item=1
+  [
+   {
+"itemtype": "file",
+"path": "a",
+"status": "M",
+"unresolved": true
+   },
+   {
+"itemtype": "file",
+"path": "a.orig",
+"status": "?"
+   },
+   {
+"itemtype": "morestatus",
+"unfinished": "merge",
+"unfinishedmsg": "To continue:hg commit\nTo abort:   hg merge 
--abort"
+   }
+  ]
+
   $ cat a
   Small Mathematical Series.
   1
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -244,6 +244,9 @@
 b'commands', b'show.aliasprefix', default=list,
 )
 coreconfigitem(
+b'commands', b'status.morestatus-item', default=False,
+)
+coreconfigitem(
 b'commands', b'status.relative', default=False,
 )
 coreconfigitem(
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6884,7 +6884,7 @@
 for f in files:
 fm.startitem()
 fm.context(ctx=ctx2)
-fm.data(path=f)
+fm.data(itemtype=b'file', path=f)
 fm.condwrite(showchar, b'status', b'%s ', char, label=label)
 fm.plain(fmt % uipathfn(f), label=label)
 if f in copy:
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -786,6 +786,7 @@
 unfinishedmsg = attr.ib()
 inmergestate = attr.ib()
 unresolvedpaths = attr.ib()
+adddataitem = attr.ib()
 _label = b'status.morestatus'
 
 def formatfile(self, path, fm):
@@ -797,6 +798,11 @@
  ) % self.unfinishedop
 fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
 
+if self.adddataitem:
+fm.startitem()
+fm.data(itemtype=b'morestatus', unfinished=self.unfinishedop,
+unfinishedmsg=self.unfinishedmsg)
+
 self._formatconflicts(fm)
 if self.unfinishedmsg:
 fm.plain(b'%s\n' % _commentlines(self.unfinishedmsg),
@@ -841,8 +847,9 @@
 unresolved = None
 if mergestate.active():
 unresolved = sorted(mergestate.unresolved())
+dataitem = repo.ui.config(b'commands', b'status.morestatus-item')
 return morestatus(repo.root, unfinishedop, unfinishedmsg,
-  unresolved is not None, unresolved)
+  unresolved is not None, unresolved, dataitem)
 
 
 def findpossible(cmd, table, strict=False):



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


D7593: status: split morestatus data loading from display

2019-12-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 18586.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7593?vs=18560=18586

BRANCH
  default

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

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

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

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6867,6 +6867,12 @@
 ) and not opts.get(b'no_status'):
 copy = copies.pathcopies(ctx1, ctx2, m)
 
+morestatus = None
+if (
+ui.verbose or ui.configbool(b'commands', b'status.verbose')
+) and not ui.plain():
+morestatus = cmdutil.readmorestatus(repo)
+
 ui.pager(b'status')
 fm = ui.formatter(b'status', opts)
 fmt = b'%s' + end
@@ -6888,10 +6894,8 @@
 label=b'status.copied',
 )
 
-if (
-ui.verbose or ui.configbool(b'commands', b'status.verbose')
-) and not ui.plain():
-cmdutil.morestatus(repo, fm)
+if morestatus:
+morestatus.formatfooter(fm)
 fm.end()
 
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -24,6 +24,7 @@
 open,
 setattr,
 )
+from .thirdparty import attr
 
 from . import (
 bookmarks,
@@ -778,47 +779,66 @@
 return b'\n'.join(commentedlines) + b'\n'
 
 
-def _conflictsmsg(repo):
-mergestate = mergemod.mergestate.read(repo)
-if not mergestate.active():
-return
-
-unresolvedlist = sorted(mergestate.unresolved())
-if unresolvedlist:
-mergeliststr = b'\n'.join(
-[
-b'%s' % util.pathto(repo.root, encoding.getcwd(), path)
-for path in unresolvedlist
-]
-)
-msg = (
-_(
-'''Unresolved merge conflicts:
+@attr.s(frozen=True)
+class morestatus(object):
+reporoot = attr.ib()
+unfinishedop = attr.ib()
+unfinishedmsg = attr.ib()
+inmergestate = attr.ib()
+unresolvedpaths = attr.ib()
+_label = b'status.morestatus'
+
+def formatfooter(self, fm):
+statemsg = _(b'The repository is in an unfinished *%s* state.'
+ ) % self.unfinishedop
+fm.plain(b'%s\n' % _commentlines(statemsg), label=self._label)
+
+self._formatconflicts(fm)
+if self.unfinishedmsg:
+fm.plain(b'%s\n' % _commentlines(self.unfinishedmsg),
+ label=self._label)
+
+def _formatconflicts(self, fm):
+if not self.inmergestate:
+return
+
+if self.unresolvedpaths:
+mergeliststr = b'\n'.join(
+[
+b'%s' % util.pathto(self.reporoot, encoding.getcwd(),
+path)
+for path in self.unresolvedpaths
+]
+)
+msg = (
+_(
+'''Unresolved merge conflicts:
 
 %s
 
 To mark files as resolved:  hg resolve --mark FILE'''
+)
+% mergeliststr
 )
-% mergeliststr
-)
-else:
-msg = _(b'No unresolved merge conflicts.')
-
-return _commentlines(msg)
-
-
-def morestatus(repo, fm):
+else:
+msg = _(b'No unresolved merge conflicts.')
+
+fm.plain(b'%s\n' % _commentlines(msg), label=self._label)
+
+
+def readmorestatus(repo):
+"""Returns a morestatus object if the repo has unfinished state."""
 statetuple = statemod.getrepostate(repo)
-label = b'status.morestatus'
-if statetuple:
-state, helpfulmsg = statetuple
-statemsg = _(b'The repository is in an unfinished *%s* state.') % state
-fm.plain(b'%s\n' % _commentlines(statemsg), label=label)
-conmsg = _conflictsmsg(repo)
-if conmsg:
-fm.plain(b'%s\n' % conmsg, label=label)
-if helpfulmsg:
-fm.plain(b'%s\n' % _commentlines(helpfulmsg), label=label)
+if not statetuple:
+return None
+
+unfinishedop, unfinishedmsg = statetuple
+mergestate = mergemod.mergestate.read(repo)
+unresolved = None
+if mergestate.active():
+unresolved = sorted(mergestate.unresolved())
+return morestatus(repo.root, unfinishedop, unfinishedmsg,
+  unresolved is not None, unresolved)
 
 
 def findpossible(cmd, table, strict=False):



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


D7594: status: add template/json data about whether a file has unresolved conflicts

2019-12-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio updated this revision to Diff 18587.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7594?vs=18561=18587

BRANCH
  default

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

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

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

CHANGE DETAILS

diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -64,7 +64,8 @@
   [
{
 "path": "a",
-"status": "M"
+"status": "M",
+"unresolved": true
},
{
 "path": "a.orig",
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6893,6 +6893,8 @@
 (b'  %s' + end) % uipathfn(copy[f]),
 label=b'status.copied',
 )
+if morestatus:
+morestatus.formatfile(f, fm)
 
 if morestatus:
 morestatus.formatfooter(fm)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -788,6 +788,10 @@
 unresolvedpaths = attr.ib()
 _label = b'status.morestatus'
 
+def formatfile(self, path, fm):
+if self.inmergestate and path in self.unresolvedpaths:
+fm.data(unresolved=True)
+
 def formatfooter(self, fm):
 statemsg = _(b'The repository is in an unfinished *%s* state.'
  ) % self.unfinishedop



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


D7593: status: split morestatus data loading from display

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


  In D7593#111728 , @rdamazio 
wrote:
  
  > In D7593#111696 , @pulkit 
wrote:
  >
  >> I pushed @martinvonz D7591 , so 
these need to be rebased. Thanks!
  >
  > Are you asking me to do something, or are you going to?
  > This supersedes his change completely.
  
  He's asking you to rebase this series. Pull from 
http://mercurial-scm.org/repo/hg-committed and then rebase on top of `@`.
  
  Even if my patch had not been queued, I would have preferred if you had split 
that change out from this patch since it's a separate change from what the 
commit message says.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7593: status: split morestatus data loading from display

2019-12-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  Just phabsended after a rebase onto hg-committed, let me know if that's not 
what you expected.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7593: status: split morestatus data loading from display

2019-12-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  In D7593#111696 , @pulkit wrote:
  
  > I pushed @martinvonz D7591 , so these 
need to be rebased. Thanks!
  
  Are you asking me to do something, or are you going to?
  This supersedes his change completely.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7595: status: outputting structured unfinished-operation information

2019-12-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added inline comments.

INLINE COMMENTS

> pulkit wrote in configitems.py:247
> IMO the whole morestatus functionality is already behind a config option, so 
> lets not have a config option just for that.
> 
> But I am not sure whether this change is a BC or not. I believe @yuja might 
> have thoughts here.

I'm fine with removing the config option, but will let yuja reply first.
About being BC or not - it depends on how people are parsing the JSON output :) 
If they're either turning off morestatus for -Tjson calls, or they're ok with 
an entry with no path, then it should work, but I won't be surprised if it 
breaks some callers.

REPOSITORY
  rHG Mercurial

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

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

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


D7526: rust-hg-path: add method to get part of a path relative to a prefix

2019-12-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> hg_path.rs:438
> +let base = HgPath::new(b"");
> +assert_eq!(Some(path), path.relative_to(base));
> +

The argument order here feels backwards. I know some frameworks (like Java's 
JUnit) put the expected value first, but the definition of `assert_eq!` doesn't 
seem to have any opinion and 
https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html puts 
the actual value first. What do you think about changing the order? That would 
make it more readable to me.

REPOSITORY
  rHG Mercurial

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

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

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


D7579: tests: add test for Rust formatting

2019-12-10 Thread Raphaël Gomès
Alphare added a comment.


  In D7579#111704 , @durin42 wrote:
  
  > What are we depending on in the rustfmt settings that's nightly behavior?
  
  
  
wrap_comments = true
error_on_line_overflow = true
  
  Both depend on nightly. I can live without `error_on_line_overflow`, 
`wrap_comments` is pretty neat.

REPOSITORY
  rHG Mercurial

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

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

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


mercurial@43818: new changeset

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

https://www.mercurial-scm.org/repo/hg/rev/ce088b38f92b
changeset:   43818:ce088b38f92b
bookmark:@
tag: tip
user:Gregory Szorc 
date:Sat Dec 07 13:06:25 2019 -0800
summary: rust: run rustfmt

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


D7527: rust-matchers: add doctests for `AlwaysMatcher`

2019-12-10 Thread Raphaël Gomès
Closed by commit rHG542c8b277261: rust-matchers: add doctests for 
`AlwaysMatcher` (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7527?vs=18403=18585

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

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

AFFECTED FILES
  rust/hg-core/src/matchers.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/matchers.rs b/rust/hg-core/src/matchers.rs
--- a/rust/hg-core/src/matchers.rs
+++ b/rust/hg-core/src/matchers.rs
@@ -78,6 +78,16 @@
 }
 
 /// Matches everything.
+///```
+/// use hg::{ matchers::{Matcher, AlwaysMatcher}, utils::hg_path::HgPath };
+///
+/// let matcher = AlwaysMatcher;
+///
+/// assert_eq!(true, matcher.matches(HgPath::new(b"whatever")));
+/// assert_eq!(true, matcher.matches(HgPath::new(b"b.txt")));
+/// assert_eq!(true, matcher.matches(HgPath::new(b"main.c")));
+/// assert_eq!(true, matcher.matches(HgPath::new(br"re:.*\.c$")));
+/// ```
 #[derive(Debug)]
 pub struct AlwaysMatcher;
 



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


D7526: rust-hg-path: add method to get part of a path relative to a prefix

2019-12-10 Thread Raphaël Gomès
Closed by commit rHG4f1543a2f5c3: rust-hg-path: add method to get part of a 
path relative to a prefix (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7526?vs=18422=18584

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

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

AFFECTED FILES
  rust/hg-core/src/utils/hg_path.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/utils/hg_path.rs 
b/rust/hg-core/src/utils/hg_path.rs
--- a/rust/hg-core/src/utils/hg_path.rs
+++ b/rust/hg-core/src/utils/hg_path.rs
@@ -112,6 +112,9 @@
 pub fn contains(, other: u8) -> bool {
 self.inner.contains()
 }
+pub fn starts_with(, needle: impl AsRef) -> bool {
+self.inner.starts_with(needle.as_ref().as_bytes())
+}
 pub fn join>(, other: ) -> HgPathBuf {
 let mut inner = self.inner.to_owned();
 if inner.len() != 0 && inner.last() != Some('/') {
@@ -120,6 +123,21 @@
 inner.extend(other.as_ref().bytes());
 HgPathBuf::from_bytes()
 }
+/// Given a base directory, returns the slice of `self` relative to the
+/// base directory. If `base` is not a directory (does not end with a
+/// `b'/'`), returns `None`.
+pub fn relative_to(, base: impl AsRef) -> Option<> {
+let base = base.as_ref();
+if base.is_empty() {
+return Some(self);
+}
+let is_dir = base.as_bytes().ends_with(b"/");
+if is_dir && self.starts_with(base) {
+Some(HgPath::new([base.len()..]))
+} else {
+None
+}
+}
 /// Checks for errors in the path, short-circuiting at the first one.
 /// This generates fine-grained errors useful for debugging.
 /// To simply check if the path is valid during tests, use `is_valid`.
@@ -412,4 +430,35 @@
 let path = HgPathBuf::from_bytes(b"a").join(HgPath::new(b"/b"));
 assert_eq!(b"a//b", path.as_bytes());
 }
+
+#[test]
+fn test_relative_to() {
+let path = HgPath::new(b"");
+let base = HgPath::new(b"");
+assert_eq!(Some(path), path.relative_to(base));
+
+let path = HgPath::new(b"path");
+let base = HgPath::new(b"");
+assert_eq!(Some(path), path.relative_to(base));
+
+let path = HgPath::new(b"a");
+let base = HgPath::new(b"b");
+assert_eq!(None, path.relative_to(base));
+
+let path = HgPath::new(b"a/b");
+let base = HgPath::new(b"a");
+assert_eq!(None, path.relative_to(base));
+
+let path = HgPath::new(b"a/b");
+let base = HgPath::new(b"a/");
+assert_eq!(Some(HgPath::new(b"b")), path.relative_to(base));
+
+let path = HgPath::new(b"nested/path/to/b");
+let base = HgPath::new(b"nested/path/");
+assert_eq!(Some(HgPath::new(b"to/b")), path.relative_to(base));
+
+let path = HgPath::new(b"ends/with/dir/");
+let base = HgPath::new(b"ends/");
+assert_eq!(Some(HgPath::new(b"with/dir/")), path.relative_to(base));
+}
 }



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


D7525: rust-matchers: improve `Matcher` trait ergonomics

2019-12-10 Thread Raphaël Gomès
Closed by commit rHG1bb4e9b02984: rust-matchers: improve `Matcher` trait 
ergonomics (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7525?vs=18401=18583

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

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

AFFECTED FILES
  rust/hg-core/src/matchers.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/matchers.rs b/rust/hg-core/src/matchers.rs
--- a/rust/hg-core/src/matchers.rs
+++ b/rust/hg-core/src/matchers.rs
@@ -10,21 +10,21 @@
 use crate::utils::hg_path::{HgPath, HgPathBuf};
 use std::collections::HashSet;
 
-pub enum VisitChildrenSet {
+pub enum VisitChildrenSet<'a> {
 /// Don't visit anything
 Empty,
 /// Only visit this directory
 This,
 /// Visit this directory and these subdirectories
 /// TODO Should we implement a `NonEmptyHashSet`?
-Set(HashSet),
+Set(HashSet<&'a HgPath>),
 /// Visit this directory and all subdirectories
 Recursive,
 }
 
 pub trait Matcher {
 /// Explicitly listed files
-fn file_set() -> HashSet<>;
+fn file_set() -> Option<<>>;
 /// Returns whether `filename` is in `file_set`
 fn exact_match(, filename: impl AsRef) -> bool;
 /// Returns whether `filename` is matched by this matcher
@@ -82,8 +82,8 @@
 pub struct AlwaysMatcher;
 
 impl Matcher for AlwaysMatcher {
-fn file_set() -> HashSet<> {
-HashSet::new()
+fn file_set() -> Option<<>> {
+None
 }
 fn exact_match(, _filename: impl AsRef) -> bool {
 false



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


D7524: rust-dirs-multiset: use `AsRef` instead of concrete types when possible

2019-12-10 Thread Raphaël Gomès
Closed by commit rHG088ba9d94079: rust-dirs-multiset: use `AsRef` instead of 
concrete types when possible (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7524?vs=18566=18582

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

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirs_multiset.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs 
b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -28,14 +28,14 @@
 ///
 /// If `skip_state` is provided, skips dirstate entries with equal state.
 pub fn from_dirstate(
-vec: ,
+dirstate: ,
 skip_state: Option,
 ) -> Self {
 let mut multiset = DirsMultiset {
 inner: FastHashMap::default(),
 };
 
-for (filename, DirstateEntry { state, .. }) in vec {
+for (filename, DirstateEntry { state, .. }) in dirstate {
 // This `if` is optimized out of the loop
 if let Some(skip) = skip_state {
 if skip != *state {
@@ -50,13 +50,13 @@
 }
 
 /// Initializes the multiset from a manifest.
-pub fn from_manifest(vec: ) -> Self {
+pub fn from_manifest(manifest: &[impl AsRef]) -> Self {
 let mut multiset = DirsMultiset {
 inner: FastHashMap::default(),
 };
 
-for filename in vec {
-multiset.add_path(filename);
+for filename in manifest {
+multiset.add_path(filename.as_ref());
 }
 
 multiset
@@ -65,8 +65,11 @@
 /// Increases the count of deepest directory contained in the path.
 ///
 /// If the directory is not yet in the map, adds its parents.
-pub fn add_path( self, path: ) -> Result<(), DirstateMapError> {
-for subpath in files::find_dirs(path) {
+pub fn add_path(
+ self,
+path: impl AsRef,
+) -> Result<(), DirstateMapError> {
+for subpath in files::find_dirs(path.as_ref()) {
 if subpath.as_bytes().last() == Some('/') {
 // TODO Remove this once PathAuditor is certified
 // as the only entrypoint for path data
@@ -88,9 +91,9 @@
 /// If the directory is not in the map, something horrible has happened.
 pub fn delete_path(
  self,
-path: ,
+path: impl AsRef,
 ) -> Result<(), DirstateMapError> {
-for subpath in files::find_dirs(path) {
+for subpath in files::find_dirs(path.as_ref()) {
 match self.inner.entry(subpath.to_owned()) {
 Entry::Occupied(mut entry) => {
 let val = entry.get().clone();
@@ -102,7 +105,7 @@
 }
 Entry::Vacant(_) => {
 return Err(DirstateMapError::PathNotFound(
-path.to_owned(),
+path.as_ref().to_owned(),
 ))
 }
 };
@@ -111,8 +114,8 @@
 Ok(())
 }
 
-pub fn contains(, key: ) -> bool {
-self.inner.contains_key(key)
+pub fn contains(, key: impl AsRef) -> bool {
+self.inner.contains_key(key.as_ref())
 }
 
 pub fn iter() -> DirsMultisetIter {
@@ -130,7 +133,8 @@
 
 #[test]
 fn test_delete_path_path_not_found() {
-let mut map = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let mut map = DirsMultiset::from_manifest();
 let path = HgPathBuf::from_bytes(b"doesnotexist/");
 assert_eq!(
 Err(DirstateMapError::PathNotFound(path.to_owned())),
@@ -186,7 +190,8 @@
 
 #[test]
 fn test_add_path_empty_path() {
-let mut map = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let mut map = DirsMultiset::from_manifest();
 let path = HgPath::new(b"");
 map.add_path(path);
 
@@ -195,7 +200,8 @@
 
 #[test]
 fn test_add_path_successful() {
-let mut map = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let mut map = DirsMultiset::from_manifest();
 
 map.add_path(HgPath::new(b"a/"));
 assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap());
@@ -240,7 +246,8 @@
 
 #[test]
 fn test_dirsmultiset_new_empty() {
-let new = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let new = DirsMultiset::from_manifest();
 let expected = DirsMultiset {
 inner: FastHashMap::default(),
 };
@@ -255,7 +262,7 @@
 
 #[test]
 fn test_dirsmultiset_new_no_skip() {
-let input_vec = ["a/", "b/", "a/c", "a/d/"]
+let input_vec: Vec = ["a/", "b/", "a/c", "a/d/"]
 .iter()
 

D7505: logcmdutil: call _exthook() in changesettemplater

2019-12-10 Thread dlax (Denis Laxalde)
Closed by commit rHG6331a6fc3304: logcmdutil: call _exthook() in 
changesettemplater (authored by dlax).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7505?vs=18312=18581

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

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

AFFECTED FILES
  mercurial/logcmdutil.py

CHANGE DETAILS

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -598,6 +598,7 @@
 # write changeset metadata, then patch if requested
 key = self._parts[self._tref]
 self.ui.write(self.t.render(key, props))
+self._exthook(ctx)
 self._showpatch(ctx, graphwidth)
 
 if self._parts[b'footer']:



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


D7513: phabricator: fix processing of tags/desc in getoldnodedrevmap()

2019-12-10 Thread dlax (Denis Laxalde)
Closed by commit rHG16b607e9f714: phabricator: fix processing of tags/desc in 
getoldnodedrevmap() (authored by dlax).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7513?vs=18339=18580

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

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -403,12 +403,15 @@
 m = _differentialrevisiontagre.match(tag)
 if m:
 toconfirm[node] = (0, set(precnodes), int(m.group(1)))
-continue
-
-# Check commit message
-m = _differentialrevisiondescre.search(ctx.description())
-if m:
-toconfirm[node] = (1, set(precnodes), int(m.group('id')))
+break
+else:
+continue  # move to next predecessor
+break  # found a tag, stop
+else:
+# Check commit message
+m = _differentialrevisiondescre.search(ctx.description())
+if m:
+toconfirm[node] = (1, set(precnodes), int(m.group('id')))
 
 # Double check if tags are genuine by collecting all old nodes from
 # Phabricator, and expect precursors overlap with it.



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


D7579: tests: add test for Rust formatting

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


  What are we depending on in the rustfmt settings that's nightly behavior?

REPOSITORY
  rHG Mercurial

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

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

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


D7506: phabricator: add a "phabstatus" show view

2019-12-10 Thread pulkit (Pulkit Goyal)
This revision now requires changes to proceed.
pulkit added a comment.
pulkit requested changes to this revision.


  `test-check-module-imports.t` says hi!

REPOSITORY
  rHG Mercurial

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

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

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


D7593: status: split morestatus data loading from display

2019-12-10 Thread pulkit (Pulkit Goyal)
pulkit added a comment.
pulkit added a subscriber: martinvonz.


  I pushed @martinvonz D7591 , so these 
need to be rebased. Thanks!

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7116: rust-performance: introduce FastHashMap type alias for HashMap

2019-12-10 Thread Raphaël Gomès
Closed by commit rHG5ac243a92e37: rust-performance: introduce FastHashMap type 
alias for HashMap (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7116?vs=18563=18577

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

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

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-core/Cargo.toml
  rust/hg-core/src/dirstate.rs
  rust/hg-core/src/dirstate/dirs_multiset.rs
  rust/hg-core/src/dirstate/dirstate_map.rs
  rust/hg-core/src/dirstate/parsers.rs
  rust/hg-core/src/discovery.rs
  rust/hg-core/src/filepatterns.rs
  rust/hg-core/src/lib.rs
  rust/hg-cpython/src/parsers.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/parsers.rs b/rust/hg-cpython/src/parsers.rs
--- a/rust/hg-cpython/src/parsers.rs
+++ b/rust/hg-cpython/src/parsers.rs
@@ -15,9 +15,9 @@
 };
 use hg::{
 pack_dirstate, parse_dirstate, utils::hg_path::HgPathBuf,
-DirstatePackError, DirstateParents, DirstateParseError, PARENT_SIZE,
+DirstatePackError, DirstateParents, DirstateParseError, FastHashMap,
+PARENT_SIZE,
 };
-use std::collections::HashMap;
 use std::convert::TryInto;
 
 use crate::dirstate::{extract_dirstate, make_dirstate_tuple};
@@ -29,8 +29,8 @@
 copymap: PyDict,
 st: PyBytes,
 ) -> PyResult {
-let mut dirstate_map = HashMap::new();
-let mut copies = HashMap::new();
+let mut dirstate_map = FastHashMap::default();
+let mut copies = FastHashMap::default();
 
 match parse_dirstate( dirstate_map,  copies, st.data(py)) {
 Ok(parents) => {
@@ -85,7 +85,7 @@
 
 let mut dirstate_map = extract_dirstate(py, )?;
 
-let copies: Result, PyErr> = copymap
+let copies: Result, PyErr> = copymap
 .items(py)
 .iter()
 .map(|(key, value)| {
diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs
+++ b/rust/hg-core/src/lib.rs
@@ -24,6 +24,8 @@
 pub use filepatterns::{
 build_single_regex, read_pattern_file, PatternSyntax, PatternTuple,
 };
+use std::collections::HashMap;
+use twox_hash::RandomXxHashBuilder64;
 
 /// Mercurial revision numbers
 ///
@@ -53,6 +55,11 @@
 
 pub type LineNumber = usize;
 
+/// Rust's default hasher is too slow because it tries to prevent collision
+/// attacks. We are not concerned about those: if an ill-minded person has
+/// write access to your repository, you have other issues.
+pub type FastHashMap = HashMap;
+
 #[derive(Clone, Debug, PartialEq)]
 pub enum GraphError {
 ParentOutOfRange(Revision),
diff --git a/rust/hg-core/src/filepatterns.rs b/rust/hg-core/src/filepatterns.rs
--- a/rust/hg-core/src/filepatterns.rs
+++ b/rust/hg-core/src/filepatterns.rs
@@ -7,10 +7,11 @@
 
 //! Handling of Mercurial-specific patterns.
 
-use crate::{utils::SliceExt, LineNumber, PatternError, PatternFileError};
+use crate::{
+utils::SliceExt, FastHashMap, LineNumber, PatternError, PatternFileError,
+};
 use lazy_static::lazy_static;
 use regex::bytes::{NoExpand, Regex};
-use std::collections::HashMap;
 use std::fs::File;
 use std::io::Read;
 use std::path::{Path, PathBuf};
@@ -214,8 +215,8 @@
 }
 
 lazy_static! {
-static ref SYNTAXES: HashMap<&'static [u8], &'static [u8]> = {
-let mut m = HashMap::new();
+static ref SYNTAXES: FastHashMap<&'static [u8], &'static [u8]> = {
+let mut m = FastHashMap::default();
 
 m.insert(b"re".as_ref(), b"relre:".as_ref());
 m.insert(b"regexp".as_ref(), b"relre:".as_ref());
diff --git a/rust/hg-core/src/discovery.rs b/rust/hg-core/src/discovery.rs
--- a/rust/hg-core/src/discovery.rs
+++ b/rust/hg-core/src/discovery.rs
@@ -11,12 +11,11 @@
 //! `mercurial.setdiscovery`
 
 use super::{Graph, GraphError, Revision, NULL_REVISION};
-use crate::ancestors::MissingAncestors;
-use crate::dagops;
+use crate::{ancestors::MissingAncestors, dagops, FastHashMap};
 use rand::seq::SliceRandom;
 use rand::{thread_rng, RngCore, SeedableRng};
 use std::cmp::{max, min};
-use std::collections::{HashMap, HashSet, VecDeque};
+use std::collections::{HashSet, VecDeque};
 
 type Rng = rand_pcg::Pcg32;
 
@@ -25,7 +24,7 @@
 graph: G, // plays the role of self._repo
 common: MissingAncestors,
 undecided: Option>,
-children_cache: Option>>,
+children_cache: Option>>,
 missing: HashSet,
 rng: Rng,
 respect_size: bool,
@@ -61,7 +60,7 @@
 where
 I: Iterator,
 {
-let mut distances: HashMap = HashMap::new();
+let mut distances: FastHashMap = FastHashMap::default();
 let mut visit: VecDeque = heads.into_iter().collect();
 let mut factor: u32 = 1;
 let mut seen: HashSet = HashSet::new();
@@ -328,7 +327,8 @@
 }
 self.ensure_undecided()?;
 
-let mut children: HashMap> = HashMap::new();
+let mut children: 

D7557: annotate: describe --skip as taking a revset

2019-12-10 Thread durin42 (Augie Fackler)
Closed by commit rHGa6483107a07a: annotate: describe --skip as taking a revset 
(authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7557?vs=18495=18575

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

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

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
@@ -362,7 +362,7 @@
 b'',
 b'skip',
 [],
-_(b'revision to not display (EXPERIMENTAL)'),
+_(b'revset to not display (EXPERIMENTAL)'),
 _(b'REV'),
 ),
 ]



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


D7578: rust: run rustfmt

2019-12-10 Thread indygreg (Gregory Szorc)
Closed by commit rHGce088b38f92b: rust: run rustfmt (authored by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7578?vs=18538=18569

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

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

AFFECTED FILES
  rust/chg/src/attachio.rs
  rust/chg/src/clientext.rs
  rust/chg/src/locator.rs
  rust/chg/src/main.rs
  rust/chg/src/message.rs
  rust/chg/src/procutil.rs
  rust/chg/src/runcommand.rs
  rust/chg/src/uihandler.rs
  rust/hg-core/src/dirstate/status.rs
  rust/hg-cpython/src/dirstate/status.rs
  rust/hg-cpython/src/filepatterns.rs
  rust/hg-cpython/src/parsers.rs
  rust/hgcli/build.rs
  rust/hgcli/src/main.rs

CHANGE DETAILS

diff --git a/rust/hgcli/src/main.rs b/rust/hgcli/src/main.rs
--- a/rust/hgcli/src/main.rs
+++ b/rust/hgcli/src/main.rs
@@ -5,18 +5,18 @@
 // This software may be used and distributed according to the terms of the
 // GNU General Public License version 2 or any later version.
 
+extern crate cpython;
 extern crate libc;
-extern crate cpython;
 extern crate python27_sys;
 
 use cpython::{NoArgs, ObjectProtocol, PyModule, PyResult, Python};
 use libc::{c_char, c_int};
 
 use std::env;
-use std::path::PathBuf;
 use std::ffi::{CString, OsStr};
 #[cfg(target_family = "unix")]
 use std::os::unix::ffi::{OsStrExt, OsStringExt};
+use std::path::PathBuf;
 
 #[derive(Debug)]
 struct Environment {
diff --git a/rust/hgcli/build.rs b/rust/hgcli/build.rs
--- a/rust/hgcli/build.rs
+++ b/rust/hgcli/build.rs
@@ -18,9 +18,8 @@
 fn get_python_config() -> PythonConfig {
 // The python27-sys crate exports a Cargo variable defining the full
 // path to the interpreter being used.
-let python = env::var("DEP_PYTHON27_PYTHON_INTERPRETER").expect(
-"Missing DEP_PYTHON27_PYTHON_INTERPRETER; bad python27-sys crate?",
-);
+let python = env::var("DEP_PYTHON27_PYTHON_INTERPRETER")
+.expect("Missing DEP_PYTHON27_PYTHON_INTERPRETER; bad python27-sys 
crate?");
 
 if !Path::new().exists() {
 panic!(
@@ -33,8 +32,8 @@
 let separator = "SEPARATOR STRING";
 
 let script = "import sysconfig; \
-c = sysconfig.get_config_vars(); \
-print('SEPARATOR STRING'.join('%s=%s' % i for i in c.items()))";
+  c = sysconfig.get_config_vars(); \
+  print('SEPARATOR STRING'.join('%s=%s' % i for i in 
c.items()))";
 
 let mut command = Command::new();
 command.arg("-c").arg(script);
diff --git a/rust/hg-cpython/src/parsers.rs b/rust/hg-cpython/src/parsers.rs
--- a/rust/hg-cpython/src/parsers.rs
+++ b/rust/hg-cpython/src/parsers.rs
@@ -9,7 +9,6 @@
 //! `hg-core` package.
 //!
 //! From Python, this will be seen as `mercurial.rustext.parsers`
-//!
 use cpython::{
 exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyResult, PyTuple, Python,
 PythonObject, ToPyObject,
diff --git a/rust/hg-cpython/src/filepatterns.rs 
b/rust/hg-cpython/src/filepatterns.rs
--- a/rust/hg-cpython/src/filepatterns.rs
+++ b/rust/hg-cpython/src/filepatterns.rs
@@ -10,7 +10,6 @@
 //! `hg-core` crate. From Python, this will be seen as `rustext.filepatterns`
 //! and can be used as replacement for the the pure `filepatterns` Python
 //! module.
-//!
 use crate::exceptions::{PatternError, PatternFileError};
 use cpython::{
 PyBytes, PyDict, PyModule, PyObject, PyResult, PyTuple, Python, ToPyObject,
diff --git a/rust/hg-cpython/src/dirstate/status.rs 
b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -8,7 +8,6 @@
 //! Bindings for the `hg::status` module provided by the
 //! `hg-core` crate. From Python, this will be seen as
 //! `rustext.dirstate.status`.
-//!
 
 use crate::dirstate::DirstateMap;
 use cpython::exc::ValueError;
diff --git a/rust/hg-core/src/dirstate/status.rs 
b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -170,8 +170,8 @@
 pub removed: Vec<&'a HgPath>,
 pub deleted: Vec<&'a HgPath>,
 pub clean: Vec<&'a HgPath>,
-// TODO ignored
-// TODO unknown
+/* TODO ignored
+ * TODO unknown */
 }
 
 fn build_response(
diff --git a/rust/chg/src/uihandler.rs b/rust/chg/src/uihandler.rs
--- a/rust/chg/src/uihandler.rs
+++ b/rust/chg/src/uihandler.rs
@@ -3,8 +3,8 @@
 // This software may be used and distributed according to the terms of the
 // GNU General Public License version 2 or any later version.
 
+use futures::future::IntoFuture;
 use futures::Future;
-use futures::future::IntoFuture;
 use std::io;
 use std::os::unix::io::AsRawFd;
 use std::os::unix::process::ExitStatusExt;
@@ -33,8 +33,7 @@
 }
 
 /// Default cHg implementation to process requests received from server.
-pub struct ChgUiHandler {
-}
+pub struct ChgUiHandler {}
 
 impl ChgUiHandler {
 pub fn new() -> ChgUiHandler 

D7596: tests: replace [[]] bashism with portable [] invocation

2019-12-10 Thread durin42 (Augie Fackler)
Closed by commit rHG36444dddaeb4: tests: replace [[]] bashism with portable [] 
invocation (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7596?vs=18568=18579

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

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

AFFECTED FILES
  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
@@ -493,7 +493,7 @@
   $ sleep 1
   $ echo delta >> foo
   $ sleep 3
-  $ if (hg diff -c . | grep 'delta' >/dev/null) || [[ -n "$(hg status)" ]]; 
then
+  $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
   >   echo "OK."
   > else
   >   echo "Bug detected. 'delta' is not part of the commit OR the wdir"



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


D7523: rust-hg-path: implement `Display` for `HgPath` and `HgPathBuf`

2019-12-10 Thread Raphaël Gomès
Closed by commit rHGc27e688fcdc3: rust-hg-path: implement `Display` for 
`HgPath` and `HgPathBuf` (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7523?vs=18421=18578

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

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

AFFECTED FILES
  rust/hg-core/src/utils/hg_path.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/utils/hg_path.rs 
b/rust/hg-core/src/utils/hg_path.rs
--- a/rust/hg-core/src/utils/hg_path.rs
+++ b/rust/hg-core/src/utils/hg_path.rs
@@ -7,6 +7,7 @@
 
 use std::borrow::Borrow;
 use std::ffi::{OsStr, OsString};
+use std::fmt;
 use std::ops::Deref;
 use std::path::{Path, PathBuf};
 
@@ -162,6 +163,12 @@
 }
 }
 
+impl fmt::Display for HgPath {
+fn fmt(, f:  fmt::Formatter<'_>) -> fmt::Result {
+write!(f, "{}", String::from_utf8_lossy())
+}
+}
+
 #[derive(Eq, Ord, Clone, PartialEq, PartialOrd, Debug, Hash)]
 pub struct HgPathBuf {
 inner: Vec,
@@ -185,6 +192,12 @@
 }
 }
 
+impl fmt::Display for HgPathBuf {
+fn fmt(, f:  fmt::Formatter<'_>) -> fmt::Result {
+write!(f, "{}", String::from_utf8_lossy())
+}
+}
+
 impl Deref for HgPathBuf {
 type Target = HgPath;
 



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


D7541: mail: use procutil.shellsplit instead of bytes.split to parse command

2019-12-10 Thread jcristau (Julien Cristau)
Closed by commit rHG8f26dd09aa78: mail: use procutil.shellsplit instead of 
bytes.split to parse command (authored by jcristau).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7541?vs=18419=18576

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

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

AFFECTED FILES
  mercurial/mail.py

CHANGE DETAILS

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -197,7 +197,7 @@
 raise error.Abort(
 b'%s %s'
 % (
-os.path.basename(program.split(None, 1)[0]),
+os.path.basename(procutil.shellsplit(program)[0]),
 procutil.explainexit(ret),
 )
 )



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


D7571: automation: use latest Windows AMI as base

2019-12-10 Thread indygreg (Gregory Szorc)
Closed by commit rHG3d53f9cc73ab: automation: use latest Windows AMI as base 
(authored by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7571?vs=18520=18574

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

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

AFFECTED FILES
  contrib/automation/hgautomation/aws.py

CHANGE DETAILS

diff --git a/contrib/automation/hgautomation/aws.py 
b/contrib/automation/hgautomation/aws.py
--- a/contrib/automation/hgautomation/aws.py
+++ b/contrib/automation/hgautomation/aws.py
@@ -59,7 +59,7 @@
 UBUNTU_ACCOUNT_ID = '099720109477'
 
 
-WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base-2019.07.12'
+WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base-2019.11.13'
 
 
 KEY_PAIRS = {



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


D7579: tests: add test for Rust formatting

2019-12-10 Thread indygreg (Gregory Szorc)
Closed by commit rHGe8a3bbffdc7d: tests: add test for Rust formatting (authored 
by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7579?vs=18539=18570

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

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

AFFECTED FILES
  tests/hghave.py
  tests/run-tests.py
  tests/test-check-rust-format.t

CHANGE DETAILS

diff --git a/tests/test-check-rust-format.t b/tests/test-check-rust-format.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-rust-format.t
@@ -0,0 +1,9 @@
+#require rustfmt test-repo
+
+  $ . "$TESTDIR/helpers-testrepo.sh"
+
+  $ cd "$TESTDIR"/..
+  $ RUSTFMT=$(rustup which --toolchain nightly rustfmt)
+  $ for f in `testrepohg files 'glob:**/*.rs'` ; do
+  >   $RUSTFMT --check --unstable-features --color=never $f
+  > done
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1363,6 +1363,20 @@
 if PYTHON3 and os.name == 'nt':
 env['PYTHONLEGACYWINDOWSSTDIO'] = '1'
 
+# Modified HOME in test environment can confuse Rust tools. So set
+# CARGO_HOME and RUSTUP_HOME automatically if a Rust toolchain is
+# present and these variables aren't already defined.
+cargo_home_path = os.path.expanduser('~/.cargo')
+rustup_home_path = os.path.expanduser('~/.rustup')
+
+if os.path.exists(cargo_home_path) and b'CARGO_HOME' not in osenvironb:
+env['CARGO_HOME'] = cargo_home_path
+if (
+os.path.exists(rustup_home_path)
+and b'RUSTUP_HOME' not in osenvironb
+):
+env['RUSTUP_HOME'] = rustup_home_path
+
 # Reset some environment variables to well-known values so that
 # the tests produce repeatable output.
 env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C'
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -1015,3 +1015,11 @@
 version = matchoutput(pytypecmd, b'[0-9a-b.]+')
 sv = distutils.version.StrictVersion
 return version and sv(_strpath(version.group(0))) >= sv('2019.10.17')
+
+
+@check("rustfmt", "rustfmt tool")
+def has_rustfmt():
+# We use Nightly's rustfmt due to current unstable config options.
+return matchoutput(
+'`rustup which --toolchain nightly rustfmt` --version', b'rustfmt'
+)



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


D7572: tests: stabilize test-extdiff.t on Windows

2019-12-10 Thread mharbison72 (Matt Harbison)
Closed by commit rHGfb03cd716f50: tests: stabilize test-extdiff.t on Windows 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7572?vs=18521=18573

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

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

AFFECTED FILES
  tests/test-extdiff.t

CHANGE DETAILS

diff --git a/tests/test-extdiff.t b/tests/test-extdiff.t
--- a/tests/test-extdiff.t
+++ b/tests/test-extdiff.t
@@ -525,17 +525,21 @@
   $ echo a > a
   $ hg add a
   $ hg falabala
-  diffing * */a (glob)
+  diffing nul "*\\a" (glob) (windows !)
+  diffing /dev/null */a (glob) (no-windows !)
   [1]
   $ hg ci -qm a
   $ hg falabala -c .
-  diffing * */a (glob)
+  diffing nul "*\\a" (glob) (windows !)
+  diffing /dev/null */a (glob) (no-windows !)
   [1]
   $ echo a >> a
   $ hg falabala
-  diffing */a */a (glob)
+  diffing "*\\a" "*\\a" (glob) (windows !)
+  diffing */a */a (glob) (no-windows !)
   [1]
   $ hg ci -qm 2a
   $ hg falabala -c .
-  diffing */a */a (glob)
+  diffing "*\\a" "*\\a" (glob) (windows !)
+  diffing */a */a (glob) (no-windows !)
   [1]



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


D7591: status: remove pointless filtering by alwaysmatcher in morestatus

2019-12-10 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG072b745936f1: status: remove pointless filtering by 
alwaysmatcher in morestatus (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7591?vs=18558=18571

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -783,13 +783,12 @@
 if not mergestate.active():
 return
 
-m = scmutil.match(repo[None])
-unresolvedlist = [f for f in mergestate.unresolved() if m(f)]
+unresolvedlist = sorted(mergestate.unresolved())
 if unresolvedlist:
 mergeliststr = b'\n'.join(
 [
 b'%s' % util.pathto(repo.root, encoding.getcwd(), path)
-for path in sorted(unresolvedlist)
+for path in unresolvedlist
 ]
 )
 msg = (



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


D7583: exchange: fix an attempt to format a list into bytes

2019-12-10 Thread mharbison72 (Matt Harbison)
Closed by commit rHGea97cd64c500: exchange: fix an attempt to format a list 
into bytes (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7583?vs=18548=18572

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

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

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2202,7 +2202,7 @@
 if invalid_includes:
 raise error.Abort(
 _(b"The following includes are not accessible for %s: %s")
-% (username, invalid_includes)
+% (username, stringutil.pprint(invalid_includes))
 )
 
 new_args = {}



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


D7596: tests: replace [[]] bashism with portable [] invocation

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

REVISION SUMMARY
  In this case nothing fancy is required.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  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
@@ -493,7 +493,7 @@
   $ sleep 1
   $ echo delta >> foo
   $ sleep 3
-  $ if (hg diff -c . | grep 'delta' >/dev/null) || [[ -n "$(hg status)" ]]; 
then
+  $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
   >   echo "OK."
   > else
   >   echo "Bug detected. 'delta' is not part of the commit OR the wdir"



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


D7530: rust-dirstate-status: update bridge for new rust version of `dirstate.status`

2019-12-10 Thread Raphaël Gomès
Alphare updated this revision to Diff 18567.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7530?vs=18406=18567

BRANCH
  default

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

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

AFFECTED FILES
  rust/hg-core/src/lib.rs
  rust/hg-cpython/src/dirstate.rs
  rust/hg-cpython/src/dirstate/status.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/status.rs 
b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -13,13 +13,17 @@
 use crate::dirstate::DirstateMap;
 use cpython::exc::ValueError;
 use cpython::{
-PyBytes, PyErr, PyList, PyObject, PyResult, Python, PythonObject,
-ToPyObject,
+ObjectProtocol, PyBytes, PyErr, PyList, PyObject, PyResult, PyTuple,
+Python, PythonObject, ToPyObject,
 };
-use hg::utils::files::get_path_from_bytes;
-
-use hg::status;
-use hg::utils::hg_path::HgPath;
+use hg::utils::hg_path::HgPathBuf;
+use hg::{
+matchers::{AlwaysMatcher, FileMatcher},
+status,
+utils::{files::get_path_from_bytes, hg_path::HgPath},
+StatusResult,
+};
+use std::borrow::Borrow;
 
 /// This will be useless once trait impls for collection are added to `PyBytes`
 /// upstream.
@@ -43,6 +47,7 @@
 pub fn status_wrapper(
 py: Python,
 dmap: DirstateMap,
+matcher: PyObject,
 root_dir: PyObject,
 list_clean: bool,
 last_normal_time: i64,
@@ -54,10 +59,64 @@
 let dmap: DirstateMap = dmap.to_py_object(py);
 let dmap = dmap.get_inner(py);
 
-let (lookup, status_res) =
-status(, _dir, list_clean, last_normal_time, check_exec)
+match matcher.get_type(py).name(py).borrow() {
+"alwaysmatcher" => {
+let matcher = AlwaysMatcher;
+let (lookup, status_res) = status(
+,
+,
+_dir,
+list_clean,
+last_normal_time,
+check_exec,
+)
 .map_err(|e| PyErr::new::(py, e.to_string()))?;
+build_response(lookup, status_res, py)
+}
+"exactmatcher" => {
+let files = matcher.call_method(
+py,
+"files",
+PyTuple::new(py, &[]),
+None,
+)?;
+let files: PyList = files.cast_into(py)?;
+let files: PyResult> = files
+.iter(py)
+.map(|f| {
+Ok(HgPathBuf::from_bytes(
+f.extract::(py)?.data(py),
+))
+})
+.collect();
 
+let files = files?;
+let matcher = FileMatcher::new();
+let (lookup, status_res) = status(
+,
+,
+_dir,
+list_clean,
+last_normal_time,
+check_exec,
+)
+.map_err(|e| PyErr::new::(py, e.to_string()))?;
+build_response(lookup, status_res, py)
+}
+e => {
+return Err(PyErr::new::(
+py,
+format!("Unsupported matcher {}", e),
+));
+}
+}
+}
+
+fn build_response(
+lookup: Vec<>,
+status_res: StatusResult,
+py: Python,
+) -> PyResult<(PyList, PyList, PyList, PyList, PyList, PyList, PyList)> {
 let modified = collect_pybytes_list(py, status_res.modified.as_ref());
 let added = collect_pybytes_list(py, status_res.added.as_ref());
 let removed = collect_pybytes_list(py, status_res.removed.as_ref());
diff --git a/rust/hg-cpython/src/dirstate.rs b/rust/hg-cpython/src/dirstate.rs
--- a/rust/hg-cpython/src/dirstate.rs
+++ b/rust/hg-cpython/src/dirstate.rs
@@ -116,6 +116,7 @@
 status_wrapper(
 dmap: DirstateMap,
 root_dir: PyObject,
+matcher: PyObject,
 list_clean: bool,
 last_normal_time: i64,
 check_exec: bool
diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs
+++ b/rust/hg-core/src/lib.rs
@@ -12,7 +12,7 @@
 dirs_multiset::{DirsMultiset, DirsMultisetIter},
 dirstate_map::DirstateMap,
 parsers::{pack_dirstate, parse_dirstate, PARENT_SIZE},
-status::status,
+status::{status, StatusResult},
 CopyMap, CopyMapIter, DirstateEntry, DirstateParents, EntryState,
 StateMap, StateMapIter,
 };



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


D7116: rust-performance: introduce FastHashMap type alias for HashMap

2019-12-10 Thread Raphaël Gomès
Alphare updated this revision to Diff 18563.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7116?vs=18039=18563

BRANCH
  default

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

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

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-core/Cargo.toml
  rust/hg-core/src/dirstate.rs
  rust/hg-core/src/dirstate/dirs_multiset.rs
  rust/hg-core/src/dirstate/dirstate_map.rs
  rust/hg-core/src/dirstate/parsers.rs
  rust/hg-core/src/discovery.rs
  rust/hg-core/src/filepatterns.rs
  rust/hg-core/src/lib.rs
  rust/hg-cpython/src/parsers.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/parsers.rs b/rust/hg-cpython/src/parsers.rs
--- a/rust/hg-cpython/src/parsers.rs
+++ b/rust/hg-cpython/src/parsers.rs
@@ -16,9 +16,9 @@
 };
 use hg::{
 pack_dirstate, parse_dirstate, utils::hg_path::HgPathBuf,
-DirstatePackError, DirstateParents, DirstateParseError, PARENT_SIZE,
+DirstatePackError, DirstateParents, DirstateParseError, FastHashMap,
+PARENT_SIZE,
 };
-use std::collections::HashMap;
 use std::convert::TryInto;
 
 use crate::dirstate::{extract_dirstate, make_dirstate_tuple};
@@ -30,8 +30,8 @@
 copymap: PyDict,
 st: PyBytes,
 ) -> PyResult {
-let mut dirstate_map = HashMap::new();
-let mut copies = HashMap::new();
+let mut dirstate_map = FastHashMap::default();
+let mut copies = FastHashMap::default();
 
 match parse_dirstate( dirstate_map,  copies, st.data(py)) {
 Ok(parents) => {
@@ -86,7 +86,7 @@
 
 let mut dirstate_map = extract_dirstate(py, )?;
 
-let copies: Result, PyErr> = copymap
+let copies: Result, PyErr> = copymap
 .items(py)
 .iter()
 .map(|(key, value)| {
diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs
+++ b/rust/hg-core/src/lib.rs
@@ -24,6 +24,8 @@
 pub use filepatterns::{
 build_single_regex, read_pattern_file, PatternSyntax, PatternTuple,
 };
+use std::collections::HashMap;
+use twox_hash::RandomXxHashBuilder64;
 
 /// Mercurial revision numbers
 ///
@@ -53,6 +55,11 @@
 
 pub type LineNumber = usize;
 
+/// Rust's default hasher is too slow because it tries to prevent collision
+/// attacks. We are not concerned about those: if an ill-minded person has
+/// write access to your repository, you have other issues.
+pub type FastHashMap = HashMap;
+
 #[derive(Clone, Debug, PartialEq)]
 pub enum GraphError {
 ParentOutOfRange(Revision),
diff --git a/rust/hg-core/src/filepatterns.rs b/rust/hg-core/src/filepatterns.rs
--- a/rust/hg-core/src/filepatterns.rs
+++ b/rust/hg-core/src/filepatterns.rs
@@ -7,10 +7,11 @@
 
 //! Handling of Mercurial-specific patterns.
 
-use crate::{utils::SliceExt, LineNumber, PatternError, PatternFileError};
+use crate::{
+utils::SliceExt, FastHashMap, LineNumber, PatternError, PatternFileError,
+};
 use lazy_static::lazy_static;
 use regex::bytes::{NoExpand, Regex};
-use std::collections::HashMap;
 use std::fs::File;
 use std::io::Read;
 use std::path::{Path, PathBuf};
@@ -214,8 +215,8 @@
 }
 
 lazy_static! {
-static ref SYNTAXES: HashMap<&'static [u8], &'static [u8]> = {
-let mut m = HashMap::new();
+static ref SYNTAXES: FastHashMap<&'static [u8], &'static [u8]> = {
+let mut m = FastHashMap::default();
 
 m.insert(b"re".as_ref(), b"relre:".as_ref());
 m.insert(b"regexp".as_ref(), b"relre:".as_ref());
diff --git a/rust/hg-core/src/discovery.rs b/rust/hg-core/src/discovery.rs
--- a/rust/hg-core/src/discovery.rs
+++ b/rust/hg-core/src/discovery.rs
@@ -11,12 +11,11 @@
 //! `mercurial.setdiscovery`
 
 use super::{Graph, GraphError, Revision, NULL_REVISION};
-use crate::ancestors::MissingAncestors;
-use crate::dagops;
+use crate::{ancestors::MissingAncestors, dagops, FastHashMap};
 use rand::seq::SliceRandom;
 use rand::{thread_rng, RngCore, SeedableRng};
 use std::cmp::{max, min};
-use std::collections::{HashMap, HashSet, VecDeque};
+use std::collections::{HashSet, VecDeque};
 
 type Rng = rand_pcg::Pcg32;
 
@@ -25,7 +24,7 @@
 graph: G, // plays the role of self._repo
 common: MissingAncestors,
 undecided: Option>,
-children_cache: Option>>,
+children_cache: Option>>,
 missing: HashSet,
 rng: Rng,
 respect_size: bool,
@@ -61,7 +60,7 @@
 where
 I: Iterator,
 {
-let mut distances: HashMap = HashMap::new();
+let mut distances: FastHashMap = FastHashMap::default();
 let mut visit: VecDeque = heads.into_iter().collect();
 let mut factor: u32 = 1;
 let mut seen: HashSet = HashSet::new();
@@ -328,7 +327,8 @@
 }
 self.ensure_undecided()?;
 
-let mut children: HashMap> = HashMap::new();
+let mut children: FastHashMap> =
+FastHashMap::default();
 for  in self.undecided.as_ref().unwrap() {
 for p in ParentsIterator::graph_parents(, rev)? {
 

D7524: rust-dirs-multiset: use `AsRef` instead of concrete types when possible

2019-12-10 Thread Raphaël Gomès
Alphare updated this revision to Diff 18566.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7524?vs=18400=18566

BRANCH
  default

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

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirs_multiset.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs 
b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -28,14 +28,14 @@
 ///
 /// If `skip_state` is provided, skips dirstate entries with equal state.
 pub fn from_dirstate(
-vec: ,
+dirstate: ,
 skip_state: Option,
 ) -> Self {
 let mut multiset = DirsMultiset {
 inner: FastHashMap::default(),
 };
 
-for (filename, DirstateEntry { state, .. }) in vec {
+for (filename, DirstateEntry { state, .. }) in dirstate {
 // This `if` is optimized out of the loop
 if let Some(skip) = skip_state {
 if skip != *state {
@@ -50,13 +50,13 @@
 }
 
 /// Initializes the multiset from a manifest.
-pub fn from_manifest(vec: ) -> Self {
+pub fn from_manifest(manifest: &[impl AsRef]) -> Self {
 let mut multiset = DirsMultiset {
 inner: FastHashMap::default(),
 };
 
-for filename in vec {
-multiset.add_path(filename);
+for filename in manifest {
+multiset.add_path(filename.as_ref());
 }
 
 multiset
@@ -65,8 +65,11 @@
 /// Increases the count of deepest directory contained in the path.
 ///
 /// If the directory is not yet in the map, adds its parents.
-pub fn add_path( self, path: ) -> Result<(), DirstateMapError> {
-for subpath in files::find_dirs(path) {
+pub fn add_path(
+ self,
+path: impl AsRef,
+) -> Result<(), DirstateMapError> {
+for subpath in files::find_dirs(path.as_ref()) {
 if subpath.as_bytes().last() == Some('/') {
 // TODO Remove this once PathAuditor is certified
 // as the only entrypoint for path data
@@ -88,9 +91,9 @@
 /// If the directory is not in the map, something horrible has happened.
 pub fn delete_path(
  self,
-path: ,
+path: impl AsRef,
 ) -> Result<(), DirstateMapError> {
-for subpath in files::find_dirs(path) {
+for subpath in files::find_dirs(path.as_ref()) {
 match self.inner.entry(subpath.to_owned()) {
 Entry::Occupied(mut entry) => {
 let val = entry.get().clone();
@@ -102,7 +105,7 @@
 }
 Entry::Vacant(_) => {
 return Err(DirstateMapError::PathNotFound(
-path.to_owned(),
+path.as_ref().to_owned(),
 ))
 }
 };
@@ -111,8 +114,8 @@
 Ok(())
 }
 
-pub fn contains(, key: ) -> bool {
-self.inner.contains_key(key)
+pub fn contains(, key: impl AsRef) -> bool {
+self.inner.contains_key(key.as_ref())
 }
 
 pub fn iter() -> DirsMultisetIter {
@@ -130,7 +133,8 @@
 
 #[test]
 fn test_delete_path_path_not_found() {
-let mut map = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let mut map = DirsMultiset::from_manifest();
 let path = HgPathBuf::from_bytes(b"doesnotexist/");
 assert_eq!(
 Err(DirstateMapError::PathNotFound(path.to_owned())),
@@ -186,7 +190,8 @@
 
 #[test]
 fn test_add_path_empty_path() {
-let mut map = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let mut map = DirsMultiset::from_manifest();
 let path = HgPath::new(b"");
 map.add_path(path);
 
@@ -195,7 +200,8 @@
 
 #[test]
 fn test_add_path_successful() {
-let mut map = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let mut map = DirsMultiset::from_manifest();
 
 map.add_path(HgPath::new(b"a/"));
 assert_eq!(1, *map.inner.get(HgPath::new(b"a")).unwrap());
@@ -240,7 +246,8 @@
 
 #[test]
 fn test_dirsmultiset_new_empty() {
-let new = DirsMultiset::from_manifest(![]);
+let manifest: Vec = vec![];
+let new = DirsMultiset::from_manifest();
 let expected = DirsMultiset {
 inner: FastHashMap::default(),
 };
@@ -255,7 +262,7 @@
 
 #[test]
 fn test_dirsmultiset_new_no_skip() {
-let input_vec = ["a/", "b/", "a/c", "a/d/"]
+let input_vec: Vec = ["a/", "b/", "a/c", "a/d/"]
 .iter()
 .map(|e| HgPathBuf::from_bytes(e.as_bytes()))
 .collect();



To: Alphare, #hg-reviewers, kevincox, pulkit
Cc: durin42, kevincox, 

D7119: rust-dirstatemap: remove additional lookup in dirstate.matches

2019-12-10 Thread Raphaël Gomès
Alphare updated this revision to Diff 18565.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7119?vs=18041=18565

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1245,6 +1245,9 @@
 return files in the dirstate (in whatever state) filtered by match
 '''
 dmap = self._map
+if rustmod is not None:
+dmap = self._map._rustmap
+
 if match.always():
 return dmap.keys()
 files = match.files()



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


D7118: rust-dirstatemap: remove additional lookups in traverse

2019-12-10 Thread Raphaël Gomès
Alphare updated this revision to Diff 18564.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7118?vs=18040=18564

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -910,6 +910,9 @@
 matchalways = match.always()
 matchtdir = match.traversedir
 dmap = self._map
+if rustmod is not None:
+dmap = self._map._rustmap
+
 listdir = util.listdir
 lstat = os.lstat
 dirkind = stat.S_IFDIR



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


D7524: rust-dirs-multiset: use `AsRef` instead of concrete types when possible

2019-12-10 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  This one fails to apply on default. Skipping pushing this and it's accepted 
children.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


Heptapod 0.7.0 released

2019-12-10 Thread Georges Racinet

We're glad to announce the release of Heptapod 0.7.0 on Docker Hub [1].

This is an abridged version, the full announcement can be read on the 
Heptapod website [2].


Deploying this version performs several significative data
migrations. Care must be applied to backup all data before upgrading.

It's been an exciting development cycle, laying the ground for the
major advances of the next one. We had notably:

- base software version updates for the first time (GitLab 10.3.9, 
Mercurial 5.2 / Evolve 9.2.1), and a systematic strategy to upgrade 
GitLab in the future

- more direct serving of Mercurial repositories
- better consistency in the exposition of Mercurial to the GitLab 
application layer (essential for CI)


and last but not least, we got the Continuous Integration officially 
supported, thanks to the launch of the Heptapod Runner project, derived 
from early experiments by the fine people at Logilab.


As usual, the full changelog can be read online alongside the
Dockerfile [2] and in the full description of the images in Docker Hub.

The remainder of this announcement can be read online [3], with more 
details on Bitbucket, the stable branch for the 0.7 series, and the 
ongoing developments for the upcoming Heptapod 0.8.0


Regards,

[1] https://hub.docker.com/r/octobus/heptapod

[2] https://heptapod.net/heptapod-070-released.html#heptapod-070-released

[3] 
https://dev.heptapod.net/heptapod/heptapod-docker/blob/branch/heptapod-0-7/heptapod/CHANGES.md



--
Georges Racinet
https://octobus.net, https://hetpapod.net
GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics

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


D7595: status: outputting structured unfinished-operation information

2019-12-10 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.
pulkit added subscribers: yuja, pulkit.

INLINE COMMENTS

> configitems.py:247
>  coreconfigitem(
> +b'commands', b'status.morestatus-item', default=False,
> +)

IMO the whole morestatus functionality is already behind a config option, so 
lets not have a config option just for that.

But I am not sure whether this change is a BC or not. I believe @yuja might 
have thoughts here.

REPOSITORY
  rHG Mercurial

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

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

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


mercurial@43817: 11 new changesets

2019-12-10 Thread Mercurial Commits
11 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/c78f8f0720cc
changeset:   43807:c78f8f0720cc
user:Augie Fackler 
date:Fri Dec 06 15:30:29 2019 -0500
summary: fuzz: fix an unused result on getcwd() in pyutil

https://www.mercurial-scm.org/repo/hg/rev/54a6846ba96f
changeset:   43808:54a6846ba96f
user:Augie Fackler 
date:Fri Dec 06 15:06:10 2019 -0500
summary: fuzz: remove debug prints from revlog_corpus.py

https://www.mercurial-scm.org/repo/hg/rev/51a99e09c54b
changeset:   43809:51a99e09c54b
user:Augie Fackler 
date:Fri Dec 06 15:05:34 2019 -0500
summary: fuzz: always define LLVMFuzzerInitialize() even if we don't need it

https://www.mercurial-scm.org/repo/hg/rev/53f582bee3d1
changeset:   43810:53f582bee3d1
user:Augie Fackler 
date:Fri Dec 06 15:12:00 2019 -0500
summary: fuzz: follow modern guidelines and use LIB_FUZZING_ENGINE

https://www.mercurial-scm.org/repo/hg/rev/d1587fadff06
changeset:   43811:d1587fadff06
user:Augie Fackler 
date:Fri Dec 06 15:13:25 2019 -0500
summary: fuzz: suppress deprecated-register warnings in our compile

https://www.mercurial-scm.org/repo/hg/rev/bf0453866c80
changeset:   43812:bf0453866c80
user:Augie Fackler 
date:Fri Dec 06 15:15:05 2019 -0500
summary: fuzz: use a variable to allow specifying python-config to use

https://www.mercurial-scm.org/repo/hg/rev/5a9e2ae9899b
changeset:   43813:5a9e2ae9899b
user:Augie Fackler 
date:Fri Dec 06 15:19:47 2019 -0500
summary: fuzz: use a more standard approach to allow local builds of fuzzers

https://www.mercurial-scm.org/repo/hg/rev/e137338e926b
changeset:   43814:e137338e926b
user:Augie Fackler 
date:Fri Dec 06 15:07:06 2019 -0500
summary: fuzz: make standalone_fuzz_target_runner call LLVMFuzzerInitialize

https://www.mercurial-scm.org/repo/hg/rev/19da643dc10c
changeset:   43815:19da643dc10c
user:Augie Fackler 
date:Fri Dec 06 15:08:37 2019 -0500
summary: tests: finally fix up test-fuzz-targets.t

https://www.mercurial-scm.org/repo/hg/rev/d37658efbec2
changeset:   43816:d37658efbec2
user:Augie Fackler 
date:Fri Dec 06 15:21:45 2019 -0500
summary: fuzz: remove legacy setup for running fuzzers outside oss-fuzz

https://www.mercurial-scm.org/repo/hg/rev/d9f85f61f0ed
changeset:   43817:d9f85f61f0ed
bookmark:@
tag: tip
user:Augie Fackler 
date:Fri Dec 06 16:09:03 2019 -0500
summary: fuzz: clean up some repetition on building parsers.so fuzzers

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