Commit Graph

32586 Commits

Author SHA1 Message Date
Matt Harbison
5c7fd6ce49 test-dirstate-race: stabilize for Windows
Without quoting, the output after "custom merge tool" in the next test is an
abort trying to open "C:UsersMattAppData..."
2017-06-14 23:56:58 -04:00
Yuya Nishihara
a0674d4810 formatter: document lookuptemplate() 2017-05-06 16:24:21 +09:00
Yuya Nishihara
c4a72a1290 cmdutil: rename gettemplate() to _lookuplogtemplate()
This function is only useful when processing log options.
2017-04-22 15:30:27 +09:00
Yuya Nishihara
a958cf025b formatter: inline gettemplater()
Since it's highly use-case dependent how template should be looked up,
gettemplater() function isn't useful. Keeping it would introduce another
bug I've made and fixed earlier in this series.
2017-04-22 15:11:53 +09:00
Yuya Nishihara
cb89cb49a0 formatter: factor out function to create templater from literal or map file
(tmpl, mapfile) will be packed into a named tuple later.
2017-04-22 15:06:06 +09:00
Yuya Nishihara
8712d0ee3b graphlog: do not look up graphnodetemplate in template paths (BC)
ui.graphnodetemplate config should be a literal template as ui.logtemplate is.
The use of formatter.gettemplater() is valid only for a template string
given by -T/--template option.
2017-04-22 14:53:05 +09:00
Yuya Nishihara
849d320dfa formatter: open raw template file in posix semantics
This should have no effect, but seems good for code consistency.
2017-05-06 14:48:47 +09:00
Yuya Nishihara
fbd006547a formatter: open raw template file in binary mode (BC)
I believe it was a mistake to open file in text mode. Now '\r' is preserved
on Windows, but it should be okay to print '\r\n' as long as users live in
such platform.
2017-05-06 14:47:31 +09:00
Yuya Nishihara
3853d4b59a formatter: close raw template file explicitly 2017-05-06 14:40:22 +09:00
Augie Fackler
e6a918f63a patchbomb: make getaddrs function easier to work with
Prior to this the return value was potentially None, a string, or a
list of strings. It now always returns a list of strings where each
string is always only one email address
2017-06-13 17:43:33 -04:00
Augie Fackler
1250a2693f patchbomb: look for non-empty publicurl, not a non-None one
Otherwise it's impossible to turn this feature back off, which is
making writing of tests awkward.
2017-06-13 16:30:50 -04:00
Augie Fackler
88445b135f patchbomb: make variable name for publicurl always be publicurl 2017-06-13 16:30:11 -04:00
Brandon McCaig
35911e9407 bisect: simpler approach for option validation message
Yuya Nishihara gave this suggestion on the mailing list after the
previous patch was queued, and honestly this seems much simpler and
looks more efficient.
2017-06-14 01:43:47 -04:00
Martin von Zweigbergk
46713842b3 pushkey: use False/True for return values from push functions
It was particularly unclear in phases.pushphase() whether the 0/1
returned were the 0/1 for public/draft phase or for False/True
2017-06-12 16:35:57 -07:00
Yuya Nishihara
5db97a9276 smartset: micro optimize spanset.slice() to narrow range accordingly
-1ms isn't significant, but seems not bad.

  revset #0: limit(0:9999, 100, 9000)
  6) 0.001145
  7) 0.000214
  revset #3: last(0:9999, 100)
  6) 0.000197
  7) 0.000171
2015-04-10 00:14:16 +09:00
Yuya Nishihara
bd5f2e1677 smartset: micro optimize baseset.slice() to use slice of list
-1ms isn't significant, but seems not bad.

  revset #1: limit(0::9999, 100, 9000)
  5) 0.001681
  6) 0.000790
2015-04-09 23:56:06 +09:00
Yuya Nishihara
8dc3831c0a smartset: extract method to slice abstractsmartset
Sub classes can provide optimized implementations.
2015-03-24 00:14:53 +09:00
Yuya Nishihara
94f3c93476 smartset: extract spanset factory to make it constructed without a repo
This renames the spanset class to _spanset, and moves its __init__ to new
spanset() function. spanset() is now a factory function.

This allows us to construct a spanset without keeping a repo instance.
2015-05-24 11:07:14 +09:00
Yuya Nishihara
00575a85de smartset: change repr of spanset to show revisions as half-open range
Before, an empty spanset was displayed as '<spanset+ 0:-1>', which seemed
confusing.
2017-06-11 00:21:38 +09:00
Siddharth Agarwal
d3ed1149d0 fsmonitor: don't write out state if identity has changed (issue5581)
Inspired by the dirstate fix in 39954a8760cd, this should fix any race
conditions with the fsmonitor state changing from underneath.

Since we now grab the wlock for any non-invalidate writes, the only situation
this appears to happen in is with a concurrent invalidation. Test that.
2017-06-12 15:34:31 -07:00
Siddharth Agarwal
0015087fea fsmonitor: write state with wlock held and dirstate unchanged (issue5581)
This means that the state will not be written if:

(1) either the wlock can't be obtained
(2) something else came along and changed the dirstate while we were in the
middle of a status run.
2017-06-12 15:34:31 -07:00
Siddharth Agarwal
f23bf55820 workingctx: add a way for extensions to run code at status fixup time
Some extensions like fsmonitor need to run code after dirstate.status is
called, but while the wlock is held. The extensions could grab the wlock again,
but that has its own peculiar race issues. For example, fsmonitor would not
like its state to be written out if the dirstate has changed underneath (see
issue5581 for what can go wrong in that sort of case).

To protect against these sorts of issues, allow extensions to declare that they
would like to run some code to run at fixup time.

fsmonitor will switch to using this in the next patch in the series.
2017-06-12 13:56:50 -07:00
Siddharth Agarwal
a6ba4f248d workingctx: also pass status tuple into poststatusfixup
fsmonitor is going to need this to compute its set of notable files to persist.
2017-06-12 13:56:43 -07:00
Siddharth Agarwal
05506e53ba workingctx: factor out post-status dirstate fixup
We want to allow extensions to be able to add code to run inside the wlock.
2017-06-12 13:54:59 -07:00
Augie Fackler
f42196a5a4 merge with stable 2017-06-13 10:02:34 -04:00
Martin von Zweigbergk
87c2856ec2 help: correct description of "glob:foo/*" matching
Unlike what the description says, it does not match recursively. Also
add an example of "glob:foo/**" (which does match recursively).
2017-06-12 11:24:21 -07:00
Pierre-Yves David
d38cc2c694 profile: properly propagate exception from the sub-context manager
Context manager has a mechanism to control extension propagation. It is not
used by profiling right now, but making the code correct will help prevent bug
in the future.
2017-06-12 17:24:10 +02:00
Pierre-Yves David
0235063e7c profile: close 'fp' in all cases
There are no way for this to happen today, but better be safe than sorry, no
one know how the code will evolve. We now make sure the file pointer is closed
even is profiler is None.
2017-06-12 17:25:37 +02:00
Pierre-Yves David
cbbef9a3be profile: close 'fp' on error within '__enter__'
Previously, error when initialying the profiler would forgot to explicitly
close the file. Thank goes to Yuya Nishihara for spotting this.
2017-06-12 17:21:41 +02:00
Pierre-Yves David
f122fd3d17 profile: indent part of '__enter__'
We are about to introduce a try except. We start with adding the indent to make
the next patch clearer.
2017-06-12 17:20:48 +02:00
Pierre-Yves David
5cc8016d8b profile: remove now useless indent
We no longer rely on the value of '_output' so we can remove this conditional.
2017-06-12 17:15:43 +02:00
Pierre-Yves David
8e927eb83d profile: use explicit logic to control file closing
We make the decision to close 'fp' more explicit instead of relying on the
implication of other variable. This makes the overall logic more robust.
2017-06-12 17:14:56 +02:00
Pierre-Yves David
cb625340da profiling: move 'fp' closing logic into its own function
We are about to make the logic more robust and reuse it in more place, we start
by isolating what we have.
2017-06-12 17:13:35 +02:00
Pulkit Goyal
a3ad6c7f7e py3: use python3 hg in test-py3-commands.t at places where py2 hg was used
This patch fixes my mistakes where I added test in test-py3-commands.t as
`hg ...` where I forgot hg here refers to Python 2 mercurial.
2017-06-13 01:23:54 +05:30
Siddharth Agarwal
0741933c16 test-dirstate-race: back out changeset 7f1ac0997ccd
This is non-deterministic. In any case, I switched to using
debugrebuilddirstate in my WIP patches, which makes this moot.
2017-06-12 13:10:09 -07:00
Yuya Nishihara
2fb700c277 revset: fix order of first/last members in compound expression (BC)
Suppose len(subset) >> len(ls) in common cases, 'subset & ls' should be
avoided whenever possible.
2017-06-10 19:48:48 +09:00
Yuya Nishihara
afe324b8ba revset: filter first/last members by __and__ operation
This replaces 'if y in subset' with '& subset'. first(null) and last(wdir())
are fixed thanks to fullreposet.__and__.

This also revealed that first() and last() don't follow the order of the
input set. 'ls & subset' is valid only if the ordering requirement is 'define'
or 'any'.

No performance regression observed:

  revset #0: limit(0:9999, 100, 9000)
  0) 0.001164
  1) 0.001135
  revset #2: 9000 & limit(0:9999, 100, 9000)
  0) 0.001224
  1) 0.001181
  revset #3: last(0:9999, 100)
  0) 0.000237
  1) 0.000199
2017-06-10 19:41:42 +09:00
Yuya Nishihara
1912966e67 revset: reject negative number to select first/last n members
Negative 'lim' doesn't make sense here, and it makes things complicated
when using list[:lim].
2017-06-10 18:35:11 +09:00
Yuya Nishihara
352ebafde5 revset: fix order of last() n members where n > 1 (BC)
last() is implemented using a reversed iterator, so the result should be
reversed again.

I've marked this as BC since it's quite old bug seen in 3.0. The first bad
revision is 1ef0875a62f8 "revset: changed last implementation to use lazy
classes."
2017-06-10 18:04:56 +09:00
Yuya Nishihara
2fce781b0d debugrevspec: add option to suppress list of computed revisions
Test will be added later.
2017-06-10 20:14:23 +09:00
Yuya Nishihara
3299c032dd debugrevspec: add option to print representation of smartset object
It's possible by -v, but -v also prints a parsed tree. Test will be added
later.
2017-06-10 20:03:35 +09:00
Pierre-Yves David
aa94a21603 bookmarks: make sure we close the bookmark file after reading
We previously lacked an explicit close of the bookmark file.
2017-06-10 01:59:22 +01:00
Pierre-Yves David
ea7c976173 bookmarks: rephrase a comment to be shorted and clearer
The initial motivation is that I need an initial level of indent in the next
changeset o:-) It turn out I like the new version better.
2017-06-10 01:55:01 +01:00
Pierre-Yves David
2f46ffacac checkheads: use a "lazyancestors" object for allfuturecommon
Instead of walking all ancestors to compute the full set we now check membership
lazily. This massively speed.

On a million-ish revision repository, this remove 14 seconds from the push logic,
making the checkheads function disappear from profile.
2017-06-05 13:44:15 +01:00
Pierre-Yves David
8eeebc599c checkheads: use "revnum" in the "allfuturecommon" set
The obsolete post-processing needs to know the extend of the pushed set. The
way it is implemented is... suboptimal. It build a full set of all nodes in the
pushset and it does so using changectx. We have much better API for this now.
The simplest is to use the existing lazy ancestors computation. That logic uses
revnum and not node (for good reason) so we start with updating the
post-processing code to handle a "allfuturecommon" set containing revision
numbers.
2017-06-05 13:37:04 +01:00
Pierre-Yves David
12f527e6f1 checkheads: use 'nodemap.get' to convert nodes to revs
We are about to call 'torev' on node that might be locally missing. In this
case, 'nodemap.revs' will return None (something valid in our usecase) while
'changelog.rev' would raise an exception.

We make this change in a distinct changeset to show it does not impact the
tests.
2017-06-05 15:20:20 +01:00
Pierre-Yves David
a0b8c4a72d checkheads: pass "ispushed" function to the obsmarkers logic
We are about to make "allfuturecommon" a set of revs instead of a set of nodes.
The function updated in this patch do not needs to know about these details so
we just pass it a 'ispushed(node)' function. This will simplify the next
changeset.
2017-06-05 15:17:47 +01:00
Pierre-Yves David
2fdfd87513 profile: drop maybeprofile
It seems sufficiently simple to use "profile(enabled=X)" to not justify having
a dedicated context manager just to read the config.

(I do not have a too strong opinion about this).
2017-06-09 12:29:29 +01:00
Pierre-Yves David
81c8d3b7b6 profile: support --profile in alias and abbreviated version (--prof)
We now process the "--profile" a second time after alias has been processed and
the command argument fully parsed. If appropriate we enable profiling at that
time.

In these situation, the --profile will cover less than if the full --profile
flag was passed on the command line. This is better than the previous behavior
(flag ignored) and still fullfil multiple valid usecases.
2017-06-09 12:36:07 +01:00
Pierre-Yves David
4dacb46437 profile: make the contextmanager object available to the callers
This will allow calling methods on the object in the code using the context
manager.
2017-06-09 11:42:45 +01:00