shortest: make {shortest("
fffffffff")} work again
{shortest("
fffffffff")} should shorten it to the shortest unambiguous
prefix for the working directory. It used to do that until I broke it
in
7b2955624777 (scmutil: make shortesthexnodeidprefix() take a full
binary nodeid, 2018-04-14), when we started returning the full hex
nodeid for any working directory prefix shorter than 40 hex
digits. This patch fixes it by catching WdirUnsupported
specifically.
Differential Revision: https://phab.mercurial-scm.org/D3455
revlog: use radix tree also for matching keys shorter than 4 hex digits
I don't know what the reason for the 4-digit limit was, and I can't
think of any real disadvantages of using the radix tree also when the
requested minimum length is short. This speeds up `hg log -T
'{shortest(node,1)}\n'` from 2m16s to 4.5s by making that not fall
back to pure code.
Differential Revision: https://phab.mercurial-scm.org/D3453
context: convert to hex for error message only for 20-byte changeid
Now that 20-byte strings unambiguously mean binary (or a bug), we can
specialize the conversion to hex for that case.
Differential Revision: https://phab.mercurial-scm.org/D3452
context: clarify that only one attempt is made to interpret changeid
We can now tell what type of revision specifier we have just by
looking at it (we no longer attempt to interpret it in one way after
the other -- that's now in scmutil.revsymbol()). Let's clarify this in
the code by swithing to if/elif.
Differential Revision: https://phab.mercurial-scm.org/D3451
context: only bother looking for broken dirstate for 20-byte changeid
If we fail to look up a changeid in changectx.__init__, we check if it
exactly matches any of the dirstate parents, and if it does, we print
a more specific message ("working directory has unknown parent '...'!"
instead of "unknown revision '...'"). The dirstate parents are always
20 bytes, so there's no need to check for a match when the given
changeid is not 20 bytes. (And now that all the other allowed forms of
changeid have been moved out of the constructor, there's no risk that
a changeid that did match a dirstate parent was actually a valid
bookmark.)
Differential Revision: https://phab.mercurial-scm.org/D3450
revset: pass in lookup function to matchany() (
issue5879)
Silly mistake in
f83cb91b052e.
test-hgweb: add test for foo-bar name lookup
This is broken since
f83cb91b052e "revset: pass in lookup function instead
of repo (API)."
context: drop support for looking up context by ambiguous changeid (API)
This removes support for using the changectx constructor (and thereby
repo[x]) for looking up contexts by a stringified int, a namespace key
(e.g. a bookmark), or a partial hex nodeid. This means that
e.g. repo[<hex nodeid>] will now fail even if a bookmark with the same
name exists (which is a good thing IMO). It also means that doing
repo[<non-existent node>] no longer ends up loading namespaces (which
was a surprising side-effect of creating of failing to create a
context object that I recently ran into while debugging something
unrelated to this series).
Differential Revision: https://phab.mercurial-scm.org/D3449