Durham Goode <durham@fb.com> [Tue, 26 Sep 2017 03:56:20 -0700] rev 34334
dirstate: move filefoldmap to dirstatemap
As part of moving the dirstate storage logic to a separate class, lets move the
filfoldmap computation to that class. This will allow extensions to replace the
dirstate storage with something that persists the filefoldmap.
Differential Revision: https://phab.mercurial-scm.org/D754
Durham Goode <durham@fb.com> [Tue, 26 Sep 2017 03:56:20 -0700] rev 34333
dirstate: move nonnormalentries to dirstatemap
As part of moving dirstate storage to its own class, let's move the
nonnormalentries logic onto the dirstatemap class. This will let extensions
replace the nonnormalentries logic with a persisted cache.
Differential Revision: https://phab.mercurial-scm.org/D753
Durham Goode <durham@fb.com> [Tue, 26 Sep 2017 03:56:20 -0700] rev 34332
dirstate: create new dirstatemap class
This is part of a larger refactor to move the dirstate storage logic to a
separate class, so it's easier to rewrite the dirstate storage layer without
having to rewrite all the algorithms as well.
Step one it to create the class, and replace dirstate._map with it. The
abstraction bleeds through in a few places where the main dirstate class has to
access self._map._map, but those will be cleaned up in future patches.
Differential Revision: https://phab.mercurial-scm.org/D752
Alex Gaynor <agaynor@mozilla.com> [Fri, 29 Sep 2017 15:49:43 +0000] rev 34331
style: always use `x is not None` instead of `not x is None`
Differential Revision: https://phab.mercurial-scm.org/D842
Yuya Nishihara <yuya@tcha.org> [Sun, 24 Apr 2016 18:41:23 +0900] rev 34330
templatekw: add new-style template expansion to {manifest}
The goal is to allow us to easily access to nested data. The dot operator
will be introduced later so we can write '{p1.files}' instead of
'{revset("p1()") % "{files}"}' for example.
In the example above, 'p1' needs to carry a mapping dict along with its
string representation. If it were a list or a dict, it could be wrapped
semi-transparently with the _hybrid class, but for non-list/dict types,
it would be difficult to proxy all necessary functions to underlying value
type because several core operations may conflict with the ones of the
underlying value:
- hash(value) should be different from hash(wrapped(value)), which means
dict[wrapped(value)] would be invalid
- 'value == wrapped(value)' would be false, breaks 'ifcontains'
- len(wrapped(value)) may be either len(value) or len(iter(wrapped(value)))
So the wrapper has no proxy functions and its scope designed to be minimal.
It's unwrapped at eval*() functions so we don't have to care for a wrapped
object unless it's really needed:
# most template functions just call evalfuncarg()
unwrapped_value = evalfuncarg(context, mapping, args[n])
# if wrapped value is needed, use evalrawexp()
maybe_wrapped_value = evalrawexp(context, mapping, args[n])
Another idea was to wrap every template variable with a tagging class, but
which seemed uneasy without a static type checker.
This patch updates {manifest} to a mappable as an example.
Yuya Nishihara <yuya@tcha.org> [Mon, 24 Apr 2017 21:37:11 +0900] rev 34329
templater: adjust binding strength of '%' and '|' operators (BC)
This makes 'foo|bar%baz' parsed as '(foo|bar)%baz', not 'foo|(bar%baz)'.
Perhaps it was a mistake that '%' preceded '|'. Both '|' and '%' can be
considered a kind of function application, and '|' is more like a '.' operator
seen in OO languages. So IMHO '|' should have the same (or higher) binding as
'%'.
The BC breakage should be minimal since both '|' and '%' operators have
strict requirements for their operands and 'foo|bar%baz' was invalid:
- right-hand side of '|' must be a symbol
- left-hand side of '%' must be a dict or list
- right-hand side of '%' must be a string or symbol
Yuya Nishihara <yuya@tcha.org> [Sun, 24 Sep 2017 15:22:46 +0900] rev 34328
templatekw: just pass underlying value (or key) to joinfmt() function
Before, iter(hybrid) was proxied to hybrid.gen, which generated formatted
strings. That's why we had to apply joinfmt() to the dicts generated by
hybrid.itermaps(). Since this weird API was fixed at
a0f2d83f8083, we can
get rid of the makemap() calls from join().
Yuya Nishihara <yuya@tcha.org> [Sun, 24 Sep 2017 12:43:57 +0900] rev 34327
scmutil: extract helper functions that returns human-readable change id
We do "'%d:%s' % (ctx...)" at several places, so let's formalize it. A low-
level function, formatrevnode(ui, rev, node), is extracted so we can pass
a manifest rev/node pair.
Note that hex() for manifest output can be replaced with hexfunc() because
it is printed only when debugflag is set.
i18n/de.po is updated so test-log.t passes with no error.