D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. OK, I've fixed the latest nits in this diff, as well as changing the circle characters as discussed to: U+25CB○ <- changeset U+25CC◌ <- obsolete (as before) U+25CD◍ <- active REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. I experimented some more in Linux and got some surprisingly different outcomes. Fallback rules definitely vary! Anyway, I think these glyphs are going to work the best across the widest variety of fonts. They are in the same character group so they should all be roughly the same size and shape, and in most monospace fonts they are large enough to be visually distinct. U+25CB○ <- changeset U+25CC◌ <- obsolete U+25CD◍ <- active I hope these look good on Windows! :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3671: advanceboundary: add dryrun parameter
khanchi97 added inline comments. INLINE COMMENTS > pulkit wrote in phases.py:369 > why are we maintaining this rejected list? rejected list will contain those csets which will be rejected during advancing boundary and then return this list so that we can report for rejected csets during dry_run of phase command. > pulkit wrote in phases.py:370 > can you explain what this changes list means? yeah, this list is for storing sets of changed csets, ordered from minimum phase to maximum phase. For example, changes[0] is a set of those csets whose phase will be changed from --public to --targetphase. Similarly, changes[1] for --draft csets. Do we need to add some comments to explain this thing? Or do you want any change here? > pulkit wrote in phases.py:371 > This conditional looks unnecessary unless I am mistaken. Can you explain why > we need this? I thought we would calculate `rejected` only when we are in dryrun mode. > pulkit wrote in phases.py:392 > We can prevent this else by returning the values early. yeah, I will make this change. > pulkit wrote in phases.py:496 > We should add documentation about the new dryrun argument and the new return > values. okay, I will do this in other patches too. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3671 To: khanchi97, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. I'm finding that on OS X, the following two glyphs get good results in almost every font, and great results in Menlo and DejaVu Sans Mono. I wish they popped a little more in Ubuntu Mono but they are still better than the current choices. I'll switch over to Linux now to verify there. U+235F⍟ U+25CB○ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. In https://phab.mercurial-scm.org/D3665#57735, @indygreg wrote: > I think this is a cool idea! I could nitpick some of the glyph choices (e.g. U+233E ⌾ is really small and harder to read than `@` and U+25CC ◌ looks like a circle and therefore the standard node type). But overall I like it! > > We //could// roll this functionality into core pretty easily and put it behind an e.g. `ui.graph-unicode` config setting. Or we could find some way to templatize the graph characters so people could modify them more easily. Having all the edge and node characters hard-coded feels a bit awkward. But I think this is scope bloat and shouldn't block this feature from landing. Others may have different opinions... The glyphs can vary pretty significantly depending on your OS and font of choice. Here's an album of how things render in OS X Terminal: https://imgur.com/a/xFkj4zv I generally use Menlo so it looked great for me during testing, but some of the results are underwhelming for sure. Also, I'm not actually convinced my terminal is rendering Roboto Mono properly as the box characters don't even come close to full height. That being said, having done this test, I would totally be open to replacing ⌾ and ◯ . I don't like how large the hollow circle can get relative to the double-circle. Please pop this list into your text editor of choice and experiment with various monospace fonts to see what works well on your system. I will experiment as well. A few circle choices: U+25EF◯ <- today's o U+233E⌾ <- today's @ U+25CC◌ <- today's x U+235F⍟ U+26AC⚬ U+25CB○ U+274D❍ U+2689⚉ U+23E3⏣ U+25CF● U+29BB⦻ U+2A37⨷ U+FFEE○ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] unionrepo: fill in uncompressed length of revlog entry
On Fri, May 25, 2018 at 7:49 PM, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1527301911 -32400 > # Sat May 26 11:31:51 2018 +0900 > # Node ID 31143eaaf90624060f7bd894421daafa5226605c > # Parent 2ce1e9bdc7157948fa799888009cc4c20c113d8c > unionrepo: fill in uncompressed length of revlog entry > Queued, thanks. > > It can be either -1 or a valid length, but shouldn't be None. IIUC, we can > simply trust the length retrieved from the revlog to be overlaid. I don't > bother thinking whether the compressed length can be copied as well. We'll > need to fix it later. > > diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py > --- a/mercurial/unionrepo.py > +++ b/mercurial/unionrepo.py > @@ -49,7 +49,7 @@ class unionrevlog(revlog.revlog): > for rev2 in self.revlog2: > rev = self.revlog2.index[rev2] > # rev numbers - in revlog2, very different from self.rev > -_start, _csize, _rsize, base, linkrev, p1rev, p2rev, node = > rev > +_start, _csize, rsize, base, linkrev, p1rev, p2rev, node = rev > flags = _start & 0x > > if linkmapper is None: # link is to same revlog > @@ -69,7 +69,9 @@ class unionrevlog(revlog.revlog): > p1node = self.revlog2.node(p1rev) > p2node = self.revlog2.node(p2rev) > > -e = (flags, None, None, base, > +# TODO: it's probably wrong to set compressed length to None, > but > +# I have no idea if csize is valid in the base revlog context. > +e = (flags, None, rsize, base, > link, self.rev(p1node), self.rev(p2node), node) > self.index.insert(-1, e) > self.nodemap[node] = n > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
indygreg added a comment. I think this is a cool idea! I could nitpick some of the glyph choices (e.g. U+233E ⌾ is really small and harder to read than `@` and U+25CC ◌ looks like a circle and therefore the standard node type). But overall I like it! We //could// roll this functionality into core pretty easily and put it behind an e.g. `ui.graph-unicode` config setting. Or we could find some way to templatize the graph characters so people could modify them more easily. Having all the edge and node characters hard-coded feels a bit awkward. But I think this is scope bloat and shouldn't block this feature from landing. Others may have different opinions... INLINE COMMENTS > beautifygraph.py:36 > + > +def convertedges(line): > +def prettyedge(before, edge, after): These don't need to be nested functions / closures. Please move to the module level. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
indygreg added a comment. I'm -0.25 on this. But I don't think we should add an argument to `hg heads` or `hg branch` because I don't like a) overloading commands to have multiple meanings b) making commands read-write and read-only. I think commands should do one thing and do them well. There should also be a set of //safe// commands that can be executed without meaningful side-effects. Following that logic, a dedicated command is justified. But I just don't feel like closing heads that aren't checked out is a frequent enough operation to justify a dedicated command. As a potential compromise, how about `hg commit --close-branch-rev ` that does the branch closing without needing a working directory? But this seemingly violates the expectation of `hg commit`, which is that it operates on the working directory. Gah - now I think I talked myself into a dedicated command. Good UI design is hard. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 To: joerg.sonnenberger, #hg-reviewers Cc: indygreg, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3674: tests: update fuzzer tests to include both fuzzers
This revision was automatically updated to reflect the committed changes. Closed by commit rHG24cc2969abae: tests: update fuzzer tests to include both fuzzers (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3674?vs=8931&id=8935 REVISION DETAIL https://phab.mercurial-scm.org/D3674 AFFECTED FILES tests/test-fuzz-targets.t CHANGE DETAILS diff --git a/tests/test-fuzz-targets.t b/tests/test-fuzz-targets.t --- a/tests/test-fuzz-targets.t +++ b/tests/test-fuzz-targets.t @@ -1,5 +1,6 @@ #require clang-libfuzzer test-repo $ cd $TESTDIR/../contrib/fuzz $ make -Just run the fuzzer for five seconds to verify it works at all. +Just run the fuzzers for five seconds each to verify it works at all. $ ./bdiff -max_total_time 5 + $ ./xdiff -max_total_time 5 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
D3677: fuzz: add clean target
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfbe239064064: fuzz: add clean target (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3677?vs=8934&id=8938 REVISION DETAIL https://phab.mercurial-scm.org/D3677 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 @@ -46,6 +46,11 @@ all: bdiff xdiff +clean: + rm *.o *_fuzzer \ + bdiff \ + xdiff + oss-fuzz: bdiff_fuzzer xdiff_fuzzer -.PHONY: all oss-fuzz +.PHONY: all clean oss-fuzz 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
D3676: fuzzutil: make it possible to use absl when C++17 isn't supported
This revision was automatically updated to reflect the committed changes. Closed by commit rHG36d55f90e2a3: fuzzutil: make it possible to use absl when C++17 isn't supported (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3676?vs=8933&id=8937 REVISION DETAIL https://phab.mercurial-scm.org/D3676 AFFECTED FILES contrib/fuzz/Makefile contrib/fuzz/fuzzutil.cc contrib/fuzz/fuzzutil.h CHANGE DETAILS diff --git a/contrib/fuzz/fuzzutil.h b/contrib/fuzz/fuzzutil.h --- a/contrib/fuzz/fuzzutil.h +++ b/contrib/fuzz/fuzzutil.h @@ -2,8 +2,31 @@ #define CONTRIB_FUZZ_FUZZUTIL_H #include #include +#include + +/* Try and use std::optional, but failing that assume we'll have a + * workable https://abseil.io/ install on the include path to get + * their backport of std::optional. */ +#ifdef __has_include +#if __has_include() && __cplusplus >= 201703L #include -#include +#define CONTRIB_FUZZ_HAVE_STD_OPTIONAL +#endif +#endif +#ifdef CONTRIB_FUZZ_HAVE_STD_OPTIONAL +namespace contrib +{ +using std::nullopt; +using std::optional; +} /* namespace contrib */ +#else +#include "third_party/absl/types/optional.h" +namespace contrib +{ +using absl::nullopt; +using absl::optional; +} /* namespace contrib */ +#endif /* set DEBUG to 1 for a few debugging prints, or 2 for a lot */ #define DEBUG 0 @@ -19,6 +42,6 @@ }; /* Split a non-zero-length input into two inputs. */ -std::optional SplitInputs(const uint8_t *Data, size_t Size); +contrib::optional SplitInputs(const uint8_t *Data, size_t Size); #endif /* CONTRIB_FUZZ_FUZZUTIL_H */ diff --git a/contrib/fuzz/fuzzutil.cc b/contrib/fuzz/fuzzutil.cc --- a/contrib/fuzz/fuzzutil.cc +++ b/contrib/fuzz/fuzzutil.cc @@ -2,10 +2,10 @@ #include -std::optional SplitInputs(const uint8_t *Data, size_t Size) +contrib::optional SplitInputs(const uint8_t *Data, size_t Size) { if (!Size) { - return std::nullopt; + return contrib::nullopt; } // figure out a random point in [0, Size] to split our input. size_t left_size = (Data[0] / 255.0) * (Size - 1); diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile --- a/contrib/fuzz/Makefile +++ b/contrib/fuzz/Makefile @@ -3,6 +3,10 @@ -std=c++17 \ -I../../mercurial -c -o fuzzutil.o fuzzutil.cc +fuzzutil-oss-fuzz.o: fuzzutil.cc fuzzutil.h + $$CXX $$CXXFLAGS -std=c++17 \ + -I../../mercurial -c -o fuzzutil-oss-fuzz.o fuzzutil.cc + bdiff.o: ../../mercurial/bdiff.c $$CC $$CFLAGS -fsanitize=fuzzer-no-link,address -c -o bdiff.o \ ../../mercurial/bdiff.c @@ -15,9 +19,10 @@ bdiff-oss-fuzz.o: ../../mercurial/bdiff.c $$CC $$CFLAGS -c -o bdiff-oss-fuzz.o ../../mercurial/bdiff.c -bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o fuzzutil.o +bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o fuzzutil-oss-fuzz.o $$CXX $$CXXFLAGS -std=c++17 -I../../mercurial bdiff.cc \ - bdiff-oss-fuzz.o fuzzutil.o -lFuzzingEngine -o $$OUT/bdiff_fuzzer + bdiff-oss-fuzz.o fuzzutil-oss-fuzz.o -lFuzzingEngine -o \ + $$OUT/bdiff_fuzzer x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h $$CC -g -O1 -fsanitize=fuzzer-no-link,address -c \ @@ -34,9 +39,9 @@ -o $@ \ $< -xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil.o +xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o $$CXX $$CXXFLAGS -std=c++17 -I../../mercurial xdiff.cc \ - fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil.o \ + fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o \ -lFuzzingEngine -o $$OUT/xdiff_fuzzer all: bdiff xdiff To: durin42, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3675: fuzz: extract some common utilities and use modern C++ idioms
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfa0ddd5e8fff: fuzz: extract some common utilities and use modern C++ idioms (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3675?vs=8932&id=8936 REVISION DETAIL https://phab.mercurial-scm.org/D3675 AFFECTED FILES contrib/fuzz/Makefile contrib/fuzz/bdiff.cc contrib/fuzz/fuzzutil.cc contrib/fuzz/fuzzutil.h contrib/fuzz/xdiff.cc CHANGE DETAILS diff --git a/contrib/fuzz/xdiff.cc b/contrib/fuzz/xdiff.cc --- a/contrib/fuzz/xdiff.cc +++ b/contrib/fuzz/xdiff.cc @@ -10,6 +10,8 @@ #include #include +#include "fuzzutil.h" + extern "C" { int hunk_consumer(long a1, long a2, long b1, long b2, void *priv) @@ -20,21 +22,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - if (!Size) { + auto maybe_inputs = SplitInputs(Data, Size); + if (!maybe_inputs) { return 0; } - // figure out a random point in [0, Size] to split our input. - size_t split = Data[0] / 255.0 * Size; - + auto inputs = std::move(maybe_inputs.value()); mmfile_t a, b; - // `a` input to diff is data[1:split] - a.ptr = (char *)Data + 1; - // which has len split-1 - a.size = split - 1; - // `b` starts at the next byte after `a` ends - b.ptr = a.ptr + a.size; - b.size = Size - split; + a.ptr = inputs.left.get(); + a.size = inputs.left_size; + b.ptr = inputs.right.get(); + b.size = inputs.right_size; xpparam_t xpp = { XDF_INDENT_HEURISTIC, /* flags */ }; diff --git a/contrib/fuzz/fuzzutil.h b/contrib/fuzz/fuzzutil.h new file mode 100644 --- /dev/null +++ b/contrib/fuzz/fuzzutil.h @@ -0,0 +1,24 @@ +#ifndef CONTRIB_FUZZ_FUZZUTIL_H +#define CONTRIB_FUZZ_FUZZUTIL_H +#include +#include +#include +#include + +/* set DEBUG to 1 for a few debugging prints, or 2 for a lot */ +#define DEBUG 0 +#define LOG(level) \ + if (level <= DEBUG)\ + std::cout + +struct two_inputs { + std::unique_ptr right; + size_t right_size; + std::unique_ptr left; + size_t left_size; +}; + +/* Split a non-zero-length input into two inputs. */ +std::optional SplitInputs(const uint8_t *Data, size_t Size); + +#endif /* CONTRIB_FUZZ_FUZZUTIL_H */ diff --git a/contrib/fuzz/fuzzutil.cc b/contrib/fuzz/fuzzutil.cc new file mode 100644 --- /dev/null +++ b/contrib/fuzz/fuzzutil.cc @@ -0,0 +1,26 @@ +#include "fuzzutil.h" + +#include + +std::optional SplitInputs(const uint8_t *Data, size_t Size) +{ + if (!Size) { + return std::nullopt; + } + // figure out a random point in [0, Size] to split our input. + size_t left_size = (Data[0] / 255.0) * (Size - 1); + + // Copy inputs to new allocations so if bdiff over-reads + // AddressSanitizer can detect it. + std::unique_ptr left(new char[left_size]); + memcpy(left.get(), Data + 1, left_size); + // right starts at the next byte after left ends + size_t right_size = Size - (left_size + 1); + std::unique_ptr right(new char[right_size]); + memcpy(right.get(), Data + 1 + left_size, right_size); + LOG(2) << "inputs are " << left_size << " and " << right_size + << " bytes" << std::endl; + two_inputs result = {std::move(right), right_size, std::move(left), +left_size}; + return result; +} diff --git a/contrib/fuzz/bdiff.cc b/contrib/fuzz/bdiff.cc --- a/contrib/fuzz/bdiff.cc +++ b/contrib/fuzz/bdiff.cc @@ -6,30 +6,25 @@ * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. */ +#include #include +#include "fuzzutil.h" + extern "C" { #include "bdiff.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - if (!Size) { + auto maybe_inputs = SplitInputs(Data, Size); + if (!maybe_inputs) { return 0; } - // figure out a random point in [0, Size] to split our input. - size_t split = Data[0] / 255.0 * Size; - - // left input to diff is data[1:split] - const uint8_t *left = Data + 1; - // which has len split-1 - size_t left_size = split - 1; - // right starts at the next byte after left ends - const uint8_t *right = left + left_size; - size_t right_size = Size - split; + auto inputs = std::move(maybe_inputs.value()); struct bdiff_line *a, *b; - int an = bdiff_splitlines((const char *)left, split - 1, &a); - int bn = bdiff_splitlines((const char *)right, right_size, &b); + int an = bdiff_splitlines(inputs.left.get(), inputs.left_size, &a); + int bn = bdiff_splitlines
D3676: fuzzutil: make it possible to use absl when C++17 isn't supported
durin42 added a comment. In https://phab.mercurial-scm.org/D3676#57722, @indygreg wrote: > I'm assuming https://abseil.io/ is part of the standard environment in oss-fuzz. Otherwise, we may want to vendor it or provide a script to download it or something. Actually, it's not needed on oss-fuzz because we have a C++17 compiler there. This just leaves the hooks in place so that it's easy-ish to build the fuzzers when you don't have a C++17 compiler (which I don't when building out of Piper, which gives me some insane options for running the fuzzer.) I can live without this patch, but I'd rather we have it in place so that it's easy to drop a copy of abseil on a machine if needed when doing fuzzer work. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3676 To: durin42, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3676: fuzzutil: make it possible to use absl when C++17 isn't supported
indygreg added a comment. I'm assuming https://abseil.io/ is part of the standard environment in oss-fuzz. Otherwise, we may want to vendor it or provide a script to download it or something. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3676 To: durin42, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@38099: 59 new changesets
59 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/242eb5132203 changeset: 38041:242eb5132203 parent: 38031:37ef6ee87488 user:hindlemail date:Wed May 16 14:11:41 2018 -0600 summary: filemerge: support specifying a python function to custom merge-tools https://www.mercurial-scm.org/repo/hg/rev/5a7cf42ba6ef changeset: 38042:5a7cf42ba6ef user:Matt Harbison date:Wed May 16 22:44:27 2018 -0400 summary: phabricator: register config settings https://www.mercurial-scm.org/repo/hg/rev/5989261a8356 changeset: 38043:5989261a8356 user:Gregory Szorc date:Thu May 17 12:23:38 2018 -0700 summary: hgweb: extract code for emitting multiple changelist records https://www.mercurial-scm.org/repo/hg/rev/8f37b5fc5abf changeset: 38044:8f37b5fc5abf user:Martin von Zweigbergk date:Thu May 17 15:12:48 2018 -0700 summary: narrow: filter merge actions in core https://www.mercurial-scm.org/repo/hg/rev/18e6ea9ba81d changeset: 38045:18e6ea9ba81d user:Martin von Zweigbergk date:Thu May 17 15:25:52 2018 -0700 summary: narrow: filter set of files to check for case-folding to core https://www.mercurial-scm.org/repo/hg/rev/ee7b6fa52d9d changeset: 38046:ee7b6fa52d9d user:Martin von Zweigbergk date:Thu May 17 15:33:28 2018 -0700 summary: narrow: filter copies in core https://www.mercurial-scm.org/repo/hg/rev/dabc2237963c changeset: 38047:dabc2237963c user:Kyle Lippincott date:Thu May 17 23:11:24 2018 -0700 summary: crecord: fallback to text mode if diffs are too big for curses mode https://www.mercurial-scm.org/repo/hg/rev/b403e87df069 changeset: 38048:b403e87df069 user:Pulkit Goyal <7895pul...@gmail.com> date:Sat May 19 00:19:56 2018 +0530 summary: py3: use .startswith() instead of bytes[0] https://www.mercurial-scm.org/repo/hg/rev/88c2d0e639b1 changeset: 38049:88c2d0e639b1 user:Pulkit Goyal <7895pul...@gmail.com> date:Sat May 19 00:21:59 2018 +0530 summary: py3: fix kwargs handling in qgurad in hgext/mq.py https://www.mercurial-scm.org/repo/hg/rev/558e5504a4f8 changeset: 38050:558e5504a4f8 user:Pulkit Goyal <7895pul...@gmail.com> date:Sat May 19 00:23:36 2018 +0530 summary: py3: use stringutil.pprint() to format a list to print https://www.mercurial-scm.org/repo/hg/rev/cab398cb9b49 changeset: 38051:cab398cb9b49 user:Augie Fackler date:Fri May 18 19:52:35 2018 -0400 summary: py3: whitelist two more passing tests observed by buildbot https://www.mercurial-scm.org/repo/hg/rev/468797392cc6 changeset: 38052:468797392cc6 user:Augie Fackler date:Fri May 18 19:54:50 2018 -0400 summary: patch: fix import-time syntax error in test-check-module-imports.t https://www.mercurial-scm.org/repo/hg/rev/c0f8fa74d8c2 changeset: 38053:c0f8fa74d8c2 user:Augie Fackler date:Fri May 18 20:11:24 2018 -0400 summary: context: fix %-formatting on Python 3 https://www.mercurial-scm.org/repo/hg/rev/92ac9cf78dba changeset: 38054:92ac9cf78dba user:Augie Fackler date:Fri May 18 20:42:04 2018 -0400 summary: pathencode: fix importing hashlib on Python 3 https://www.mercurial-scm.org/repo/hg/rev/4fccc73ce2f6 changeset: 38055:4fccc73ce2f6 user:Augie Fackler date:Fri May 18 20:42:31 2018 -0400 summary: pathencode: hashlib.sha1() takes bytes not str on Python 3 https://www.mercurial-scm.org/repo/hg/rev/9aaa74f9eb87 changeset: 38056:9aaa74f9eb87 user:Augie Fackler date:Fri May 18 20:43:01 2018 -0400 summary: pathencode: improve error messages slightly https://www.mercurial-scm.org/repo/hg/rev/f0ee627162f4 changeset: 38057:f0ee627162f4 user:Yuya Nishihara date:Wed Apr 04 00:19:37 2018 +0900 summary: hgweb: wrap {diffstat} with mappedgenerator https://www.mercurial-scm.org/repo/hg/rev/6369e21e97ac changeset: 38058:6369e21e97ac user:Yuya Nishihara date:Wed Apr 04 00:20:47 2018 +0900 summary: hgweb: use template context to render {diffstat} https://www.mercurial-scm.org/repo/hg/rev/4c3ab15f3532 changeset: 38059:4c3ab15f3532 user:Yuya Nishihara date:Wed Apr 04 00:21:52 2018 +0900 summary: hgweb: drop unused argument 'tmpl' from webutil.diffstat() https://www.mercurial-scm.org/repo/hg/rev/aeccb08af311 changeset: 38060:aeccb08af311 user:Yuya Nishihara date:Wed Apr 04 00:24:09 2018 +0900 summary: hgweb: wrap {lines} of filerevision with mappinggenerator https://www.mercurial-scm.org/repo/hg/rev/d3b4c4769b5c changeset: 38061:d3b4c4769b5c user:Yuya Nishihara date:Wed Apr 04 20:11:20 2018 +0900 summary: hgweb: wrap {entries}* of changelog with mappinglist https://www.mercurial-scm.org/repo/hg/rev/17f7b44367bb changeset: 38062:17f7b44367bb user:Yuya Nishihara dat
D3671: advanceboundary: add dryrun parameter
pulkit requested changes to this revision. pulkit added a comment. This revision now requires changes to proceed. Thanks for breaking this up. I have some put comments which are mostly doubts, can you explain by replying to them why you did so? INLINE COMMENTS > phases.py:369 > > +rejected = list() > +changes = [set(), set(), set()] why are we maintaining this rejected list? > phases.py:370 > +rejected = list() > +changes = [set(), set(), set()] > +if dryrun: can you explain what this changes list means? > phases.py:371 > +changes = [set(), set(), set()] > +if dryrun: > +getphase = repo._phasecache.phase This conditional looks unnecessary unless I am mistaken. Can you explain why we need this? > phases.py:392 > +changes[phase].update(faffected) > +else: > +for r in affected: We can prevent this else by returning the values early. > phases.py:496 > > -def advanceboundary(repo, tr, targetphase, nodes): > +def advanceboundary(repo, tr, targetphase, nodes, dryrun=None): > """Add nodes to a phase changing other nodes phases if necessary. We should add documentation about the new dryrun argument and the new return values. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3671 To: khanchi97, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3674: tests: update fuzzer tests to include both fuzzers
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3674 AFFECTED FILES tests/test-fuzz-targets.t CHANGE DETAILS diff --git a/tests/test-fuzz-targets.t b/tests/test-fuzz-targets.t --- a/tests/test-fuzz-targets.t +++ b/tests/test-fuzz-targets.t @@ -1,5 +1,6 @@ #require clang-libfuzzer test-repo $ cd $TESTDIR/../contrib/fuzz $ make -Just run the fuzzer for five seconds to verify it works at all. +Just run the fuzzers for five seconds each to verify it works at all. $ ./bdiff -max_total_time 5 + $ ./xdiff -max_total_time 5 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
D3675: fuzz: extract some common utilities and use modern C++ idioms
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Alex Gaynor suggested we should probably copy the left and right sides of diffs to new blocks so we can detect over-reads in the diffing code, and I agree. Once I got into that, I realized we should do things with C++17 idioms rather than keep using malloc() and free(). This change is the result. I tried to split it more than this and failed. Everything still compiles and works in the oss-fuzz container, so I think we can count on C++17 being available! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3675 AFFECTED FILES contrib/fuzz/Makefile contrib/fuzz/bdiff.cc contrib/fuzz/fuzzutil.cc contrib/fuzz/fuzzutil.h contrib/fuzz/xdiff.cc CHANGE DETAILS diff --git a/contrib/fuzz/xdiff.cc b/contrib/fuzz/xdiff.cc --- a/contrib/fuzz/xdiff.cc +++ b/contrib/fuzz/xdiff.cc @@ -10,6 +10,8 @@ #include #include +#include "fuzzutil.h" + extern "C" { int hunk_consumer(long a1, long a2, long b1, long b2, void *priv) @@ -20,21 +22,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - if (!Size) { + auto maybe_inputs = SplitInputs(Data, Size); + if (!maybe_inputs) { return 0; } - // figure out a random point in [0, Size] to split our input. - size_t split = Data[0] / 255.0 * Size; - + auto inputs = std::move(maybe_inputs.value()); mmfile_t a, b; - // `a` input to diff is data[1:split] - a.ptr = (char *)Data + 1; - // which has len split-1 - a.size = split - 1; - // `b` starts at the next byte after `a` ends - b.ptr = a.ptr + a.size; - b.size = Size - split; + a.ptr = inputs.left.get(); + a.size = inputs.left_size; + b.ptr = inputs.right.get(); + b.size = inputs.right_size; xpparam_t xpp = { XDF_INDENT_HEURISTIC, /* flags */ }; diff --git a/contrib/fuzz/fuzzutil.h b/contrib/fuzz/fuzzutil.h new file mode 100644 --- /dev/null +++ b/contrib/fuzz/fuzzutil.h @@ -0,0 +1,24 @@ +#ifndef CONTRIB_FUZZ_FUZZUTIL_H +#define CONTRIB_FUZZ_FUZZUTIL_H +#include +#include +#include +#include + +/* set DEBUG to 1 for a few debugging prints, or 2 for a lot */ +#define DEBUG 0 +#define LOG(level) \ + if (level <= DEBUG)\ + std::cout + +struct two_inputs { + std::unique_ptr right; + size_t right_size; + std::unique_ptr left; + size_t left_size; +}; + +/* Split a non-zero-length input into two inputs. */ +std::optional SplitInputs(const uint8_t *Data, size_t Size); + +#endif /* CONTRIB_FUZZ_FUZZUTIL_H */ diff --git a/contrib/fuzz/fuzzutil.cc b/contrib/fuzz/fuzzutil.cc new file mode 100644 --- /dev/null +++ b/contrib/fuzz/fuzzutil.cc @@ -0,0 +1,26 @@ +#include "fuzzutil.h" + +#include + +std::optional SplitInputs(const uint8_t *Data, size_t Size) +{ + if (!Size) { + return std::nullopt; + } + // figure out a random point in [0, Size] to split our input. + size_t left_size = (Data[0] / 255.0) * (Size - 1); + + // Copy inputs to new allocations so if bdiff over-reads + // AddressSanitizer can detect it. + std::unique_ptr left(new char[left_size]); + memcpy(left.get(), Data + 1, left_size); + // right starts at the next byte after left ends + size_t right_size = Size - (left_size + 1); + std::unique_ptr right(new char[right_size]); + memcpy(right.get(), Data + 1 + left_size, right_size); + LOG(2) << "inputs are " << left_size << " and " << right_size + << " bytes" << std::endl; + two_inputs result = {std::move(right), right_size, std::move(left), +left_size}; + return result; +} diff --git a/contrib/fuzz/bdiff.cc b/contrib/fuzz/bdiff.cc --- a/contrib/fuzz/bdiff.cc +++ b/contrib/fuzz/bdiff.cc @@ -6,30 +6,25 @@ * This software may be used and distributed according to the terms of * the GNU General Public License, incorporated herein by reference. */ +#include #include +#include "fuzzutil.h" + extern "C" { #include "bdiff.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { - if (!Size) { + auto maybe_inputs = SplitInputs(Data, Size); + if (!maybe_inputs) { return 0; } - // figure out a random point in [0, Size] to split our input. - size_t split = Data[0] / 255.0 * Size; - - // left input to diff is data[1:split] - const uint8_t *left = Data + 1; - // which has len split-1 - size_t left_size = split - 1; - // right starts at the next byte after left ends - const uint8_t *right = left + left_size; - size_t right_size = Size - split; + auto inputs = st
D3676: fuzzutil: make it possible to use absl when C++17 isn't supported
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3676 AFFECTED FILES contrib/fuzz/Makefile contrib/fuzz/fuzzutil.cc contrib/fuzz/fuzzutil.h CHANGE DETAILS diff --git a/contrib/fuzz/fuzzutil.h b/contrib/fuzz/fuzzutil.h --- a/contrib/fuzz/fuzzutil.h +++ b/contrib/fuzz/fuzzutil.h @@ -2,8 +2,31 @@ #define CONTRIB_FUZZ_FUZZUTIL_H #include #include +#include + +/* Try and use std::optional, but failing that assume we'll have a + * workable https://abseil.io/ install on the include path to get + * their backport of std::optional. */ +#ifdef __has_include +#if __has_include() && __cplusplus >= 201703L #include -#include +#define CONTRIB_FUZZ_HAVE_STD_OPTIONAL +#endif +#endif +#ifdef CONTRIB_FUZZ_HAVE_STD_OPTIONAL +namespace contrib +{ +using std::nullopt; +using std::optional; +} /* namespace contrib */ +#else +#include "third_party/absl/types/optional.h" +namespace contrib +{ +using absl::nullopt; +using absl::optional; +} /* namespace contrib */ +#endif /* set DEBUG to 1 for a few debugging prints, or 2 for a lot */ #define DEBUG 0 @@ -19,6 +42,6 @@ }; /* Split a non-zero-length input into two inputs. */ -std::optional SplitInputs(const uint8_t *Data, size_t Size); +contrib::optional SplitInputs(const uint8_t *Data, size_t Size); #endif /* CONTRIB_FUZZ_FUZZUTIL_H */ diff --git a/contrib/fuzz/fuzzutil.cc b/contrib/fuzz/fuzzutil.cc --- a/contrib/fuzz/fuzzutil.cc +++ b/contrib/fuzz/fuzzutil.cc @@ -2,10 +2,10 @@ #include -std::optional SplitInputs(const uint8_t *Data, size_t Size) +contrib::optional SplitInputs(const uint8_t *Data, size_t Size) { if (!Size) { - return std::nullopt; + return contrib::nullopt; } // figure out a random point in [0, Size] to split our input. size_t left_size = (Data[0] / 255.0) * (Size - 1); diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile --- a/contrib/fuzz/Makefile +++ b/contrib/fuzz/Makefile @@ -3,6 +3,10 @@ -std=c++17 \ -I../../mercurial -c -o fuzzutil.o fuzzutil.cc +fuzzutil-oss-fuzz.o: fuzzutil.cc fuzzutil.h + $$CXX $$CXXFLAGS -std=c++17 \ + -I../../mercurial -c -o fuzzutil-oss-fuzz.o fuzzutil.cc + bdiff.o: ../../mercurial/bdiff.c $$CC $$CFLAGS -fsanitize=fuzzer-no-link,address -c -o bdiff.o \ ../../mercurial/bdiff.c @@ -15,9 +19,10 @@ bdiff-oss-fuzz.o: ../../mercurial/bdiff.c $$CC $$CFLAGS -c -o bdiff-oss-fuzz.o ../../mercurial/bdiff.c -bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o fuzzutil.o +bdiff_fuzzer: bdiff.cc bdiff-oss-fuzz.o fuzzutil-oss-fuzz.o $$CXX $$CXXFLAGS -std=c++17 -I../../mercurial bdiff.cc \ - bdiff-oss-fuzz.o fuzzutil.o -lFuzzingEngine -o $$OUT/bdiff_fuzzer + bdiff-oss-fuzz.o fuzzutil-oss-fuzz.o -lFuzzingEngine -o \ + $$OUT/bdiff_fuzzer x%.o: ../../mercurial/thirdparty/xdiff/x%.c ../../mercurial/thirdparty/xdiff/*.h $$CC -g -O1 -fsanitize=fuzzer-no-link,address -c \ @@ -34,9 +39,9 @@ -o $@ \ $< -xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil.o +xdiff_fuzzer: xdiff.cc fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o $$CXX $$CXXFLAGS -std=c++17 -I../../mercurial xdiff.cc \ - fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil.o \ + fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o \ -lFuzzingEngine -o $$OUT/xdiff_fuzzer all: bdiff xdiff 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
D3677: fuzz: add clean target
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3677 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 @@ -46,6 +46,11 @@ all: bdiff xdiff +clean: + rm *.o *_fuzzer \ + bdiff \ + xdiff + oss-fuzz: bdiff_fuzzer xdiff_fuzzer -.PHONY: all oss-fuzz +.PHONY: all clean oss-fuzz 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
D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. In https://phab.mercurial-scm.org/D3665#57678, @indygreg wrote: > I installed Dejavu Sans Mono from https://dejavu-fonts.github.io/ and it works great! That's great to hear! How do you like it? It's a pretty simple extension but it definitely scratches an itch for me. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
indygreg added a comment. I installed Dejavu Sans Mono from https://dejavu-fonts.github.io/ and it works great! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. In https://phab.mercurial-scm.org/D3665#57675, @indygreg wrote: > FWIW, this isn't rendering nicely with PuTTY on Windows 10. The U+25EF ◯ glyph is being truncated on the right side. I'm also seeing empty squares for U+233E ⌾ and other code points. Using Courier New as the terminal font. `LANG=en_US.UTF-8` and `TERM=xterm-256color`, so Mercurial detects the encoding as UTF-8. > > Not a show stopper. But a bit disappointing. I can probably safely blame PuTTY/Windows here. I haven't tested in Windows, unfortunately! I've run the extension in OS X Terminal and on Linux in xfce4-terminal and it's been fine, but Windows text rendering is obviously going to be different :( Have you experimented with different fonts? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
indygreg added a comment. FWIW, this isn't rendering nicely with PuTTY on Windows 10. The U+25EF ◯ glyph is being truncated on the right side. I'm also seeing empty squares for U+233E ⌾ and other code points. Using Courier New as the terminal font. `LANG=en_US.UTF-8` and `TERM=xterm-256color`, so Mercurial detects the encoding as UTF-8. Not a show stopper. But a bit disappointing. I can probably safely blame PuTTY/Windows here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: indygreg, smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5903] New: allow to ignore binary files that don't have a file extension
https://bz.mercurial-scm.org/show_bug.cgi?id=5903 Bug ID: 5903 Summary: allow to ignore binary files that don't have a file extension Product: Mercurial Version: 3.7.3 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: kobi2...@gmail.com CC: mercurial-devel@mercurial-scm.org I would like to have hg ignore the generated executables of the project, and in linux, executables normally don't have a file extension. it seems I can't specify such a pattern for hgignore to understand. Can you include something similar to the 'file' utility, where a number of bytes are read to see if the file is a text/ascii/utf file? it would be fine if the user can enable this feature with a configuration line. (always ignore binary files) Thank you -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3673: grep: enables passing wdir as a revision in grep
sangeet259 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY When you pass wdir() to the -r flag, it catches the WdirUnsupported error and fall back to and alternate path REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3673 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -250,8 +250,11 @@ $ hg stat M port2 $ hg grep -r 'wdir()' port - abort: working directory revision cannot be specified - [255] + port2:export + port2:vaportight + port2:import/export + port2:deport + port2:wport $ cd .. $ hg init t2 @@ -368,3 +371,14 @@ binfile.bin:0:+: Binary file matches $ cd .. + +Fix_Wdir(): test that passing wdir() t -r flag does greps on the +files modified in the working directory + + $ cd a + $ echo "abracadara" >> a + $ hg add a + $ hg grep -r "wdir()" "abra" + a:abracadara + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2513,19 +2513,27 @@ @util.cachefunc def binary(): flog = getfile(fn) -return stringutil.binary(flog.read(ctx.filenode(fn))) +try: +content = flog.read(ctx.filenode(fn)) +except error.WdirUnsupported: +content = ctx[fn].data() +return stringutil.binary(content) fieldnamemap = {'filename': 'file', 'linenumber': 'line_number'} if opts.get('all'): iter = difflinestates(pstates, states) else: iter = [('', l) for l in states] for change, l in iter: fm.startitem() -fm.data(node=fm.hexfunc(ctx.node())) +fm.data(node=fm.hexfunc(scmutil.binnode(ctx))) +if ctx._rev is None : +showrev = False +else : +showrev = True cols = [ ('filename', fn, True), -('rev', rev, True), +('rev', rev, showrev), ('linenumber', l.linenum, opts.get('line_number')), ] if opts.get('all'): @@ -2588,8 +2596,10 @@ fnode = ctx.filenode(fn) except error.LookupError: continue - -copied = flog.renamed(fnode) +try: +copied = flog.renamed(fnode) +except error.WdirUnsupported : +copied = False copy = follow and copied and copied[0] if copy: copies.setdefault(rev, {})[fn] = copy @@ -2600,7 +2610,11 @@ files.append(fn) if fn not in matches[rev]: -grepbody(fn, rev, flog.read(fnode)) +try: +content = flog.read(fnode) +except error.WdirUnsupported: +content = ctx[fn].data() +grepbody(fn, rev, content) pfn = copy or fn if pfn not in matches[parent]: To: sangeet259, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
yuja added a comment. > A proper warning is now issued when the encoding is not UTF-8, or when East-Asian ambiguous characters will be rendered as wide characters. > The tests have been updated to check these warnings. > Yuya, I believe this should address everything we discussed. Let me know if you see a need for any further changes. Yeah, the changes look good to me, thanks. Sean and others, can you review and queue this if it seems good to go into the core extension? I'm 0 on this feature. A couple more nits: --- tests/test-check-commit.t +++ tests/test-check-commit.t.err @@ -25,3 +25,14 @@ > fi > done > fi + Revision 2c4617bda693 does not comply with rules + -- + 167: adds double empty line + + + 235: adds double empty line + + + 1209: adds double empty line + + + 1403: adds double empty line + + + ERROR: test-check-commit.t output changed !... --- tests/test-check-pylint.t +++ tests/test-check-pylint.t.err @@ -19,3 +19,22 @@ (?) Your code has been rated at 10.00/10 (?) (?) + Using config file $TESTTMP/fakerc + * Module hgext.beautifygraph + C: 38,29: More than one statement on a single line (multiple-statements) + C: 39,29: More than one statement on a single line (multiple-statements) + C: 40,29: More than one statement on a single line (multiple-statements) + C: 41,29: More than one statement on a single line (multiple-statements) + C: 42,29: More than one statement on a single line (multiple-statements) + C: 43,29: More than one statement on a single line (multiple-statements) + C: 44,29: More than one statement on a single line (multiple-statements) + C: 60,24: More than one statement on a single line (multiple-statements) + C: 61,24: More than one statement on a single line (multiple-statements) + C: 62,24: More than one statement on a single line (multiple-statements) + C: 63,24: More than one statement on a single line (multiple-statements) + C: 64,24: More than one statement on a single line (multiple-statements) > 1. beautifygraph.py - improve graph output by using Unicode characters Can you add a copyright line and GPL placeholder? > A terminal with UTF-8 support and a monospace Unicode font are required. Strictly speaking, the font doesn't matter. It's up to terminal emulator how to lay out each character. > from mercurial import encoding > from mercurial import extensions > from mercurial import templatekw > from mercurial import graphmod We prefer `from mercurial import ( foo, bar, baz, )`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3665: graph: improve graph output by using Unicode characters
> A proper warning is now issued when the encoding is not UTF-8, or when > East-Asian ambiguous characters will be rendered as wide characters. > The tests have been updated to check these warnings. > Yuya, I believe this should address everything we discussed. Let me know if > you see a need for any further changes. Yeah, the changes look good to me, thanks. Sean and others, can you review and queue this if it seems good to go into the core extension? I'm 0 on this feature. A couple more nits: ``` --- tests/test-check-commit.t +++ tests/test-check-commit.t.err @@ -25,3 +25,14 @@ > fi > done > fi + Revision 2c4617bda693 does not comply with rules + -- + 167: adds double empty line + + + 235: adds double empty line + + + 1209: adds double empty line + + + 1403: adds double empty line + + + ERROR: test-check-commit.t output changed !... --- tests/test-check-pylint.t +++ tests/test-check-pylint.t.err @@ -19,3 +19,22 @@ (?) Your code has been rated at 10.00/10 (?) (?) + Using config file $TESTTMP/fakerc + * Module hgext.beautifygraph + C: 38,29: More than one statement on a single line (multiple-statements) + C: 39,29: More than one statement on a single line (multiple-statements) + C: 40,29: More than one statement on a single line (multiple-statements) + C: 41,29: More than one statement on a single line (multiple-statements) + C: 42,29: More than one statement on a single line (multiple-statements) + C: 43,29: More than one statement on a single line (multiple-statements) + C: 44,29: More than one statement on a single line (multiple-statements) + C: 60,24: More than one statement on a single line (multiple-statements) + C: 61,24: More than one statement on a single line (multiple-statements) + C: 62,24: More than one statement on a single line (multiple-statements) + C: 63,24: More than one statement on a single line (multiple-statements) + C: 64,24: More than one statement on a single line (multiple-statements) ``` > # beautifygraph.py - improve graph output by using Unicode characters Can you add a copyright line and GPL placeholder? > A terminal with UTF-8 support and a monospace Unicode font are required. Strictly speaking, the font doesn't matter. It's up to terminal emulator how to lay out each character. > from mercurial import encoding > from mercurial import extensions > from mercurial import templatekw > from mercurial import graphmod We prefer `from mercurial import ( foo, bar, baz, )`. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] transaction-summary: show phase changes statistics in pull/unbundle
On Thu, 24 May 2018 15:48:01 +0200, Denis Laxalde wrote: > # HG changeset patch > # User Denis Laxalde > # Date 1527157190 -7200 > # Thu May 24 12:19:50 2018 +0200 > # Node ID 48bc12fc4aee84bffa539f9ced452e6c686a53e4 > # Parent 37ef6ee87488ac0095f8dedf75284f64d1d54455 > # Available At http://hg.logilab.org/users/dlaxalde/hg > # hg pull http://hg.logilab.org/users/dlaxalde/hg -r 48bc12fc4aee > # EXP-Topic pull-info-transaction > transaction-summary: show phase changes statistics in pull/unbundle Queued, thanks. The summarycallback is getting larger. Maybe it's time to split to new module and think about proper data structure? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] outgoing: pay attention to `default:pushurl` for bookmarks and subrepos
On Tue, 29 May 2018 20:35:42 +0900, Yuya Nishihara wrote: > On Tue, 29 May 2018 00:42:23 -0400, Matt Harbison wrote: > > # HG changeset patch > > # User Matt Harbison > > # Date 1527485794 14400 > > # Mon May 28 01:36:34 2018 -0400 > > # Node ID 8544cdf89153aa7c0ce5be9c4dfdc052b2bf5d60 > > # Parent cc9aa88792fe8daf041521710f52be59c69b79eb > > outgoing: pay attention to `default:pushurl` for bookmarks and subrepos > > if opts.get('bookmarks'): > > -dest = ui.expandpath(dest or 'default-push', dest or 'default') > > +dest = path.pushloc or path.loc > > dest, branches = hg.parseurl(dest, opts.get('branch')) > > It isn't your fault, but maybe we shouldn't overwrite 'dest' here? Never mind. I didn't know --bookmarks disables the normal path. Queued this, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3672: retractboundary: add dryrun parameter
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Added the logic to find those csets whose phase will be changed without dry-run while retracting boundary and return those csets. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3672 AFFECTED FILES mercurial/phases.py CHANGE DETAILS diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -392,32 +392,44 @@ self._retractboundary(repo, tr, targetphase, delroots) repo.invalidatevolatilesets() -def retractboundary(self, repo, tr, targetphase, nodes): +def retractboundary(self, repo, tr, targetphase, nodes, dryrun=None): oldroots = self.phaseroots[:targetphase + 1] if tr is None: phasetracking = None else: phasetracking = tr.changes.get('phases') repo = repo.unfiltered() -if (self._retractboundary(repo, tr, targetphase, nodes) -and phasetracking is not None): - -# find the affected revisions -new = self.phaseroots[targetphase] -old = oldroots[targetphase] -affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) +changes = [set(), set(), set()] +if dryrun: +getphase = repo._phasecache.phase +nds = [n for n in nodes + if getphase(repo, repo[n].rev()) < targetphase] +targetphroots = oldroots[-1] +affected = set(repo.revs('(%ln::) - (%ln::)', nds, targetphroots)) +for rev in affected: +revphase = getphase(repo, rev) +changes[revphase].update((rev,)) +else: +if (self._retractboundary(repo, tr, targetphase, nodes) +and phasetracking is not None): -# find the phase of the affected revision -for phase in xrange(targetphase, -1, -1): -if phase: -roots = oldroots[phase] -revs = set(repo.revs('%ln::%ld', roots, affected)) -affected -= revs -else: # public phase -revs = affected -for r in revs: -_trackphasechange(phasetracking, r, phase, targetphase) -repo.invalidatevolatilesets() +# find the affected revisions +new = self.phaseroots[targetphase] +old = oldroots[targetphase] +affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) + +# find the phase of the affected revision +for phase in xrange(targetphase, -1, -1): +if phase: +roots = oldroots[phase] +revs = set(repo.revs('%ln::%ld', roots, affected)) +affected -= revs +else: # public phase +revs = affected +for r in revs: +_trackphasechange(phasetracking, r, phase, targetphase) +repo.invalidatevolatilesets() +return changes def _retractboundary(self, repo, tr, targetphase, nodes): # Be careful to preserve shallow-copied values: do not update @@ -489,17 +501,20 @@ phcache.advanceboundary(repo, tr, targetphase, nodes) repo._phasecache.replace(phcache) -def retractboundary(repo, tr, targetphase, nodes): +def retractboundary(repo, tr, targetphase, nodes, dryrun=None): """Set nodes back to a phase changing other nodes phases if necessary. This function move boundary *backward* this means that all nodes are set in the target phase or kept in a *higher* phase. Simplify boundary to contains phase roots only.""" phcache = repo._phasecache.copy() -phcache.retractboundary(repo, tr, targetphase, nodes) -repo._phasecache.replace(phcache) +changes = phcache.retractboundary(repo, tr, targetphase, nodes, + dryrun=dryrun) +if not dryrun: +repo._phasecache.replace(phcache) +return changes def registernew(repo, tr, targetphase, nodes): """register a new revision and its phase To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3671: advanceboundary: add dryrun parameter
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Added logic to find those csets whose phase will be changed (when running without --dryrun) while advancing boundary. And make it return rejected and changed csets. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3671 AFFECTED FILES mercurial/phases.py CHANGE DETAILS diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -352,7 +352,7 @@ _trackphasechange(phasetracking, rev, None, revphase) repo.invalidatevolatilesets() -def advanceboundary(self, repo, tr, targetphase, nodes): +def advanceboundary(self, repo, tr, targetphase, nodes, dryrun=None): """Set all 'nodes' to phase 'targetphase' Nodes with a phase lower than 'targetphase' are not affected. @@ -366,6 +366,13 @@ repo = repo.unfiltered() +rejected = list() +changes = [set(), set(), set()] +if dryrun: +getphase = repo._phasecache.phase +rejected = [repo[n].rev() for n in nodes +if getphase(repo, repo[n].rev()) < targetphase] + delroots = [] # set of root deleted by this path for phase in xrange(targetphase + 1, len(allphases)): # filter nodes that are not in a compatible phase already @@ -377,20 +384,28 @@ olds = self.phaseroots[phase] affected = repo.revs('%ln::%ln', olds, nodes) -for r in affected: -_trackphasechange(phasetracking, r, self.phase(repo, r), - targetphase) +if dryrun: +faffected = filter(lambda x: getphase(repo, + repo[x].rev()) == phase, + affected) +changes[phase].update(faffected) +else: +for r in affected: +_trackphasechange(phasetracking, r, self.phase(repo, r), + targetphase) -roots = set(ctx.node() for ctx in repo.set( -'roots((%ln::) - %ld)', olds, affected)) -if olds != roots: -self._updateroots(phase, roots, tr) -# some roots may need to be declared for lower phases -delroots.extend(olds - roots) -# declare deleted root in the target phase -if targetphase != 0: -self._retractboundary(repo, tr, targetphase, delroots) -repo.invalidatevolatilesets() +roots = set(ctx.node() for ctx in repo.set( +'roots((%ln::) - %ld)', olds, affected)) +if olds != roots: +self._updateroots(phase, roots, tr) +# some roots may need to be declared for lower phases +delroots.extend(olds - roots) +if not dryrun: +# declare deleted root in the target phase +if targetphase != 0: +self._retractboundary(repo, tr, targetphase, delroots) +repo.invalidatevolatilesets() +return rejected, changes def retractboundary(self, repo, tr, targetphase, nodes): oldroots = self.phaseroots[:targetphase + 1] @@ -478,16 +493,19 @@ # (see branchmap one) self.invalidate() -def advanceboundary(repo, tr, targetphase, nodes): +def advanceboundary(repo, tr, targetphase, nodes, dryrun=None): """Add nodes to a phase changing other nodes phases if necessary. This function move boundary *forward* this means that all nodes are set in the target phase or kept in a *lower* phase. Simplify boundary to contains phase roots only.""" phcache = repo._phasecache.copy() -phcache.advanceboundary(repo, tr, targetphase, nodes) -repo._phasecache.replace(phcache) +rejected, changes = phcache.advanceboundary(repo, tr, targetphase, nodes, +dryrun=dryrun) +if not dryrun: +repo._phasecache.replace(phcache) +return rejected, changes def retractboundary(repo, tr, targetphase, nodes): """Set nodes back to a phase changing other nodes phases if To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3665: graph: improve graph output by using Unicode characters
johnstiles added a comment. A proper warning is now issued when the encoding is not UTF-8, or when East-Asian ambiguous characters will be rendered as wide characters. The tests have been updated to check these warnings. Yuya, I believe this should address everything we discussed. Let me know if you see a need for any further changes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3665 To: johnstiles, #hg-reviewers Cc: smf, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel