Commit Graph

11034 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
4d5d9b1517 revset: avoid loop for "match.files()" having always one element for efficiency
This patch avoids the loop for "match.files()" having always one
element in revset predicate "filelog()" for efficiency: "match" object
"m" is constructed with "[pat]" as "patterns" argument.
2014-01-17 23:42:12 +09:00
FUJIWARA Katsunori
7e4fbdb87b revset: make default kind of pattern for "contains()" rooted at cwd
Before this patch, default kind of pattern for revset predicate
"contains()" is treated as the exact file path rooted at the root of
the repository. This decreases usability, because:

  - all other predicates taking pattern argument (also "filelog()")
    treat such pattern as the path rooted at the current working
    directory

  - "contains()" doesn't describe this difference in its help

  - this difference may confuse users

    for example, this prevents revset aliases from sharing same
    argument between "contains()" and other predicates


This patch makes default kind of pattern for revset predicate
"contains()" be rooted at the current working directory.

This patch uses "pathutil.canonpath()" instead of creating "match"
object for efficiency.
2014-01-17 23:42:12 +09:00
FUJIWARA Katsunori
43338be810 revset: narrow scope of the variable referred only in specific code path
This patch narrows scope of the variable "m" in the function for
revset predicate "contains()", because it is referred only in "else"
code path of "if not matchmod.patkind(pat)" examination.
2014-01-17 23:42:12 +09:00
Sean Farley
673b0dd879 commands: use bookmarks.validdest instead of duplicating logic
Now that bookmarks.py has grown a validdest method that even handles successor
changesets, we use that instead of duplicating the logic in commands.py
2014-01-15 17:55:13 -06:00
Sean Farley
8973f827ab update: consider successor changesets when moving active bookmark
Previously, when an obsolete changeset was bookmarked, successor changesets were not considered
when moving the bookmark forward. Now that a bare update will move to the tip most of the
successor changesets, we also update the bookmark logic to allow the bookmark to move with this
update.

Tests have been updated and keep issue4015 covered as well.
2014-01-15 17:48:48 -06:00
Sean Farley
eb5399916a merge: consider successor changesets for a bare update
Previously, a bare update would ignore any successor changesets thus
potentially leaving you on an obsolete head. This happens commonly when there
is an old bookmark that hasn't been moved forward which is the motivating
reason for this patch series.

Now, we will check for successor changesets if two conditions hold: 1) we are
doing a bare update 2) *and* we are currently on an obsolete head.

If we are in this situation, then we calculate the branchtip of the successor
set and update to that changeset.

Tests coverage has been added.
2014-01-15 16:41:18 -06:00
Sean Farley
17f6cfcd6f merge: refactor initialization of variables in update
There is no code change here but this helps prepare for future commits that
will fix a bare update with obsolete markers.
2013-11-06 17:02:07 -06:00
Sean Farley
26332808a6 merge: update comment for future devs 2013-11-06 10:26:25 -06:00
Sean Farley
ef93a468a7 obsolete: clarify documentation for succcessorssets 2014-01-15 18:14:12 -06:00
Pierre-Yves David
605b367f84 backout: add a message after backout that need manual commit
In some case Backout silently succeeded to back out but left all the change
uncommitted. This may be confusing for user so this changeset  add a note
reminding to commit. Other backout case already actively informs the user about
created commit.
2014-01-08 17:23:26 -08:00
Pierre-Yves David
75c6a1c8fa backout: avoid update on simple case.
Before the changeset the backout process was:
1) go to <target>
2) revert to <target> parent
3) update back to changeset we came from

The two update steps can takes a very long time to move back and forth unrelated
file change between <target> and current working directory.

The new process is just merging current working directory with the parent of
<target> using <target> as ancestor. This give the very same result but skip
the two updates. On big repo with a lot of files and changes that save a lots of
time (x20 for one week window).

The "merge" version (hg backout --merge) is still done with upgrades. We could
imagine using in memory commit to speed it up but this is another fish.
2014-01-08 14:53:46 -08:00
FUJIWARA Katsunori
1629d4ee7f ui: add "extractchoices()" to share the logic to extract choices from prompt 2013-12-02 00:50:29 +09:00
Pierre-Yves David
f0e0234ea1 branchmap: use set for update code
We are doing membership test and substraction. new code is marginally faster.
2014-01-06 15:19:31 -08:00
Pierre-Yves David
fc97641ca7 branchmap: simplify update code
We drop iterrevs which are not needed anymore. The know head are never a
descendant of the updated set. It was possible with the old strip code. This
simplification make the code easier to read an update.
2014-01-06 14:26:49 -08:00
Pierre-Yves David
7641136888 branchmap: stop useless rev -> node -> rev round trip
We never use the node of new revisions unless in the very specific case of
closed heads. So we can just use the revision number.

So give another handfull of percent speedup.
2014-01-03 16:44:23 -08:00
Pierre-Yves David
4a3c0bd301 branchmap: stop membership test in update logic
Now that no user try to update the cache on a truncated repo we can drop the
extra lookup. Give an handfull percent speedup on big branchmap update.
2013-01-15 20:04:12 +01:00
Pierre-Yves David
f4aa184d64 branchmap: remove silly line break
The line fit in 80 character limit without it. It is even shorter without it.
2014-01-03 17:06:07 -08:00
Takumi IINO
22fc622e5e hgweb: infinite scroll support for coal style 2014-01-08 00:47:45 +09:00
Takumi IINO
95ecbefdae hgweb: infinite scroll support for monoblue style 2014-01-08 00:47:44 +09:00
Takumi IINO
e51fef56f2 hgweb: infinite scroll support for gitweb style 2014-01-08 00:47:43 +09:00
Takumi IINO
db72b3b5e8 hgweb: avoid invalid infinity scroll request when overwritten web.style
Infinity scroll is broken when you override the web.style in the following ways:

    $ hg --config='web.style=gitweb' serve
    $ open http://localhost:8080/shortlog?style=paper

ajaxScrollInit should use http://localhost:8080/shortlog/%next%?style=paper.
however, http://localhost:8080/shortlog/%next% is used actually.
It is missing style parameter.

This patch add style parameter to request url.
2014-01-08 00:35:03 +09:00
Takumi IINO
96e1c44734 hgweb: fix regexp for other styles like monoblue
Some styles have indentation.
2014-01-08 00:26:55 +09:00
Mads Kiilerich
1428b73c06 help: branch names primarily denote the tipmost unclosed branch head
Was the behavior correct and the description wrong so it should be updated as
in this patch? Or should the code work as the documentation says?

Both ways could make some sense ... but none of them are obvious in all cases.

One place where it currently cause problems is when the current revision has
another branch head that is closer to tip but closed. 'hg rebase' refuses to
rebase to that as it only see the tip-most unclosed branch head which is the
current revision.

/me kind of likes named branches, but no so much how branch closing works ...
2013-11-21 15:17:18 -05:00
Mads Kiilerich
771c21f193 util: introduce util.debugstacktrace for showing a stack trace without crashing
This is often very handy when hacking/debugging.

Calling util.debugstacktrace('hey') from a place in hg will give something like:
  hey at:
   ./hg:38                                     in <module>
   /home/user/hgsrc/mercurial/dispatch.py:28   in run
   /home/user/hgsrc/mercurial/dispatch.py:65   in dispatch
   /home/user/hgsrc/mercurial/dispatch.py:88   in _runcatch
   /home/user/hgsrc/mercurial/dispatch.py:740  in _dispatch
   /home/user/hgsrc/mercurial/dispatch.py:514  in runcommand
   /home/user/hgsrc/mercurial/dispatch.py:830  in _runcommand
   /home/user/hgsrc/mercurial/dispatch.py:801  in checkargs
   /home/user/hgsrc/mercurial/dispatch.py:737  in <lambda>
   /home/user/hgsrc/mercurial/util.py:472      in check
...
2014-01-12 23:28:21 +01:00
Mads Kiilerich
9f5571e9f8 bisect: --command without --noupdate should flag the parent rev it tested
b33db384a66e not only introduced the 'bisect(current)' revset predicate, it
also changed how the 'current' revision is used in combination with --command.
The new behaviour might be ok for --noupdate where the working directory and
its revision shouldn't be used, but it also did that when --command is used to
run a command on the currently checked out revision then it could register the
test result on the wrong revision.

An example:

Before, bisect with --command could use the wrong revision when recording the
test result:

  $ hg up -qr 0
  $ hg bisect --command "python \"$TESTTMP/script.py\" and some parameters"
  changeset 31:58c80a7c8a40: bad
  abort: inconsistent state, 31:58c80a7c8a40 is good and bad

Now it works as before and as expected and uses the working directory revision
for the --command result:

  $ hg up -qr 0
  $ hg bisect --command "python \"$TESTTMP/script.py\" and some parameters"
  changeset 0:b99c7b9c8e11: bad
  ...
2013-11-16 15:46:29 -05:00
Mads Kiilerich
48b69add79 context: drop caching 'copies' method
The 'copies' method has no test coverage and calls copies.pathcopies with an
incorrect number of parameters and is thus (fortunately) not used. Kill it.
2013-11-16 15:46:29 -05:00
Siddharth Agarwal
c88be819e2 commands.bookmarks: move hexfn to inside list block
This isn't used outside this block, nor is it expected to be.
2013-11-19 12:43:29 -08:00
Siddharth Agarwal
cc6a9ec3f3 commands.bookmarks: move cur initialization to inside wlock
This is more correct because we now fetch '.' while nothing else can interfere
with it.
2013-11-19 12:42:17 -08:00
Siddharth Agarwal
6504db9dff commands.bookmarks: pass cur in explicitly to checkconflict
cur will be moved inside the wlock in a future patch, so we need to pass it
into checkconflict explicitly.
2013-11-21 17:11:04 -08:00
Siddharth Agarwal
ee30e748c9 commands.bookmarks: hold wlock for write operations
Any invocations of bookmarks other than a plain 'hg bookmarks' will likely
cause a write to the bookmark store. These should be guarded by the wlock.

The repo._bookmarks read should be similarly guarded by the wlock if we're
going to be subsequently writing to it.
2013-11-19 12:33:14 -08:00
Siddharth Agarwal
e1850e1d79 commands.bookmarks: separate out 'no bookmarks set' status messages
Upcoming patches will acquire the wlock for write operations, such as make
inactive, but not read-only ones, such as list bookmarks. Separate out the
status messages so that the code paths can be separated.
2013-11-19 11:47:30 -08:00
Kevin Bullock
6a83843bd3 doc: bump copyright year 2014-01-10 16:26:11 -06:00
Matt Mackall
dd9ef40be6 localrepo: drop unused variable 2014-01-10 17:29:16 -06:00
Pierre-Yves David
df72d3d98f discovery: stop using nodemap for membership testing
Nodemap is not aware of filtering so we need to ask the changelog itself if a
node is known. This is probably a bit slower but such check does not dominated
discovery time. This is necessary if we want to run discovery on filtered repo.
2013-11-15 23:28:43 -05:00
Pierre-Yves David
5cf610755f discovery: enforce filtering into revlogbaseddag._internalizeall
One more step toward discovery running on filtered repo.
2013-11-15 23:27:39 -05:00
Pierre-Yves David
6ebc9feba5 discovery: make revlogdag work on filtered repo
The revlogdag class is a core part of discovery. We need its initialisation to
exclude revision filtered out.
2013-11-15 23:27:15 -05:00
Pierre-Yves David
a296fcdefb pull: run findcommon incoming on unfiltered repo
The discovery is not yet ready for filtered repo. Pull was using filtered for
its discovery which is wrong. It worked by dumb luck because discovery mainly
use funtion that does not respect the filtering.

Trying to makes discovery work on filtered repo revealed this bug.
2013-11-16 11:53:44 -05:00
Pierre-Yves David
a9f4140d91 push: more robust check for bundle fast path
When all changesets in the local repo are either being pushed or remotly known,
we can take a fast path when bundling changeset because we are certain all local
deltas are computed againts base known remotely.

So we have a check to detect this situation, when we did a bare push and nothing
was excluded.

In a coming refactoring, the discovery will run on filtered view and the content
of `outgoing.excluded` will just include unserved (secret) changeset not filtered by the
repoview used to call push (usually "visible"). So we need to check if there is
both no excluded changeset and nothing filtered by the current repoview.
2013-11-05 18:37:44 +01:00
Pierre-Yves David
5567affae0 pull: fix post-pull common computation
Before that changes, pulled revision that happend to be already known locally
(so, not actually added) was not taken into account when computing the new
common set between local and remote.

It appears that we already know the heads of the pulled set. It is in the
`rheads` variable, so we are just using it and everything is works fine.

We are dropping the, now useless, computation of `added` set in the process.
2013-11-16 15:36:50 -05:00
Andrew Shadura
88eaae271b templatekw: allow tagtypes other than global in getlatesttags
hg-git uses tagtype 'git', for example, so it's better
to check for tagtype != 'local', not strictly for 'global'
2013-12-23 14:14:31 +01:00
Durham Goode
b147e53e3f revlog: move file writing to a separate function
Moves the code that actually writes to a file to a separate function in
revlog.py. This allows extensions to intercept and use the data being written to
disk. For example, an extension might want to replicate these writes elsewhere.

When cloning the Mercurial repo on /dev/shm with --pull, I see about a 0.3% perf change.
It goes from 28.2 to 28.3 seconds.
2013-11-26 12:58:27 -08:00
Kevin Bullock
23ff9c2ce1 discovery: prefer loop to double-for list comprehension in changegroupsubset
The double-for form of list comprehensions gets particularly unreadable
when you throw in an 'if' condition. This expands the only remaining
instance of the double-for syntax in our codebase into a loop.
2013-11-24 17:33:39 -06:00
Augie Fackler
acff2f02d0 merge with stable 2014-01-01 18:28:40 -05:00
Pierre-Yves David
bab0fe5a64 obsolete: order of magnitude speedup in _computebumpedset
Reminder: a changeset is said "bumped" if it tries to obsolete a immutable
          changeset.


The previous algorithm for computing bumped changeset was:

    1) Get all public changesets
    2) Find all they successors
    3) Search for stuff that are eligible for being "bumped"
       (mutable and non obsolete)

The entry size of this algorithm is `O(len(public))` which is mostly the same as
`O(len(repo))`. Even this this approach mean fewer obsolescence marker are
traveled, this is not very scalable.

The new algorithm is:

    1) For each potential bumped changesets (non obsolete mutable)
    2) iterate over precursors
    3) if a precursors is public. changeset is bumped

We travel more obsolescence marker, but the entry size is much smaller since
the amount of potential bumped should remains mostly stable with time `O(1)`.

On some confidential gigantic repo this move bumped computation from 15.19s to
0.46s (×33 speedup…). On "smaller" repo (mercurial, cubicweb's review) no
significant gain were seen. The additional traversal of obsolescence marker is
probably probably counter balance the advantage of it.

Other optimisation could be done in the future (eg: sharing precursors cache
for divergence detection)
2013-12-23 15:29:51 -08:00
Pierre-Yves David
777603b25a obsolete: add an allprecursors method mirroring allsuccessors one.
Detection of bumped changeset should use `allprecursors(<mutable>)` instead or
`allsuccessors(<immutable>)` so we need the all precursors function to exists.
2013-12-23 13:36:13 -08:00
Pierre-Yves David
04de18abd8 obsolete: improve allsuccessors doc string
The fact original nodes are also yield is not obvious. We update the docstring
to highlight it.
2013-12-23 13:33:21 -08:00
Pierre-Yves David
9cb9a199aa obsolete: fix bad comment
We cannot afford such extra "with" they are far too pricy.
2013-12-23 13:32:03 -08:00
Christian Ebert
a9aa17b61c util: remove unused realpath (issue4063)
util.realpath was in use for only 5 days from 17bc9a6bb165
until it was backed out in e60acde24a62 because it caused
issue3077 and issue3071.
2013-12-29 13:54:04 +00:00
Pierre-Yves David
de4bc2f6f8 filter: add a comment so that people do not forget to update subsettable
Changeset aad678a92970 moved `subsettable` from `mercurial/repoview.py` to
`mercurial/branchmap.py`. This mean that `filtertable` and `subsettable` are no
longer next to each other. So we add a comment to remind people to update both.
2013-12-24 17:44:23 -05:00
Yuya Nishihara
cb7a1dd14c fileset, revset: do not use global parser object for thread safety
parse() cannot be called at the same time because a parser object keeps its
states.  This is no problem for command-line hg client, but it would cause
strange errors in multi-threaded hgweb.

Creating parser object is not too expensive.

original:
% python -m timeit -s 'from mercurial import revset' 'revset.parse("0::tip")'
100000 loops, best of 3: 11.3 usec per loop

thread-safe:
% python -m timeit -s 'from mercurial import revset' 'revset.parse("0::tip")'
100000 loops, best of 3: 13.1 usec per loop
2013-12-21 12:44:19 +09:00
Matt Mackall
03adb7cbe4 hgweb: avoid initialization race (issue3953) 2013-12-04 13:42:28 -06:00
Matt Mackall
c4f5764d33 mpatch: rewrite pointer overflow checks 2013-12-11 18:33:42 -06:00
Santiago Pay=C3=A0 i Miralta
42d271f1db help: fix backwards bisect help example 2013-11-27 22:32:01 +01:00
Martin Geisler
6907950b0d glossary: don't mention obsolete graphlog extension 2013-11-22 19:13:07 +01:00
Martin Geisler
8b1b36c645 bisect: don't mention obsolete graphlog extension in help 2013-11-22 19:12:44 +01:00
Matt Mackall
ed6ec26983 help: use progress instead of mq as in 'hg help config' example 2013-11-22 17:12:43 +01:00
Chris Jerdonek
e02a62783a parse_index2: fix crash on bad argument type (issue4110)
Passing a non-string to parsers.parse_index2() causes Mercurial to crash
instead of raising a TypeError (found on Mac OS X 10.8.5, Python 2.7.6):

    import mercurial.parsers as parsers
    parsers.parse_index2(0, 0)

    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0 parsers.so  0x000000010e071c59 _index_clearcaches + 73 (parsers.c:644)
    1 parsers.so  0x000000010e06f2d5 index_dealloc + 21 (parsers.c:1767)
    2 parsers.so  0x000000010e074e3b parse_index2 + 347 (parsers.c:1891)
    3 org.python.python 0x000000010dda8b17 PyEval_EvalFrameEx + 9911

This happens because when arguments of the wrong type are passed to
parsers.parse_index2(), indexType's initialization function index_init() in
parsers.c leaves the indexObject instance in a state that indexType's
destructor function index_dealloc() cannot handle.

This patch moves enough of the indexObject initialization code inside
index_init() from after the argument validation code to before it.
This way, when bad arguments are passed to index_init(), the destructor
doesn't crash and the existing code to raise a TypeError works.  This
patch also adds a test to check that a TypeError is raised.
2013-11-26 16:14:22 -08:00
Sean Farley
a66d57e510 bookmarks: consider successor changesets when moving bookmark (issue4015)
Previously, this required -f because we didn't consider obsolete changesets
(and their children ... or successors of those children, etc.). We now use
obsolete.foreground to calculate acceptable changesets when advancing the
bookmark.

Test coverage has been added.
2013-11-06 19:01:14 -06:00
Simon Heimberg
2143905ef7 util: url keeps backslash in paths
Backslashes (\) in paths were encoded to %C5 when converting from url to
string. This does not look nice for windows paths. And it introduces many
problems when running tests on windows.
2013-11-20 22:03:15 +01:00
Matt Mackall
82c7f5838c subrepo: sanitize non-hg subrepos 2013-11-25 13:50:36 -06:00
Mads Kiilerich
7014dca534 bisect: report "both good and bad" as such, not as "not directly related" 2013-11-10 18:51:21 +01:00
Martin Geisler
934da465b0 phase: better error message when --force is needed
When trying to turn a draft changeset into a secret changeset, I was
told:

  % hg phase -s .
  cannot move 1 changesets to a more permissive phase, use --force
  no phases changed

That message struck me as being backwards -- the secret phase feels
less permissive to me since it restricts the changesets from being
pushed.

We don't use the word "permissive" elsewhere, 'hg help phase' talks
about "lower phases" and "higher phases". I therefore reformulated the
error message to be

  cannot move 1 changesets to a higher phase, use --force

That is not perfect either, but more in line with the help text. An
alternative could be

  cannot move phase backwards for 1 changesets, use --force

which fits better with the help text for --force.
2013-11-08 11:49:13 +01:00
Isaac Jurado
b5e7be1139 hgweb: ignore non numeric "revcount" parameter values (issue4091) 2013-11-08 09:48:01 +01:00
Matt Mackall
fb22d26dbd templater: makes branches work correctly with stringify (issue4108) 2013-11-21 11:30:52 -06:00
Matt Mackall
52dafe7a2a templater: only recursively evaluate string literals as templates (issue4103) 2013-11-18 15:37:09 -05:00
Matt Mackall
c9a233d77e templater: fix escaping in nested string literals (issue4102)
Before the templater got extended for nested expressions, it made
sense to decode string escapes across the whole string. Now we do it
on a piece by piece basis.
2013-11-18 14:02:26 -05:00
Pierre-Yves David
f1f6dad830 obsolete: stop doing membership test on list
According to the Surgeon General, computer should not use list for membership
testing because of the risk of being slow.
2013-11-16 20:34:58 -05:00
Wagner Bruna
b966a63297 hgweb, i18n: do not translate search mode description
The search mode description can't be translated by itself, since
it's displayed as part of a template phrase (the "Assuming ..."
/ "Use ... instead" bits). Just drop the translation markers for
now, since the templates themselves currently do not support
translations.
2013-11-13 16:46:46 -02:00
Mads Kiilerich
32fefa2839 util: warn when adding paths ending with \
Paths ending with \ will fail the verification introduced in 0bc0c17d663e when
checking out on Windows ... and if it didn't fail it would probably not do what
the user expected.
2013-11-08 12:35:50 +01:00
Simon Heimberg
25ae76fc48 documentation: add an extra newline after note directive
Like this no docutils version interprets any line in the following text as
argument of note.
2013-11-05 08:59:55 +01:00
Simon Heimberg
386dcc916f minirst: do not add a 2nd empty paragraph
This does not add a separating block after a separated note directive.

.. note::

    text

is formatted to

Note:
    text
2013-11-04 10:23:06 +01:00
Simon Heimberg
664e8c41fe minirst: find admonitions before pruning comments and adding margins
Lines with only a directive are not deleted anymore because they are detected
before comments are deleted by prunecomments().
addmargins() will be adapted later.
2013-11-04 10:23:06 +01:00
Simon Heimberg
c5557c2259 minirst: do not fail on an empty admonition block 2013-11-04 10:23:06 +01:00
Simon Heimberg
0e05d277a4 minirst: do not interpret a directive as a literal block
When a directive was on its own line, it was interpreted as a literal block.

Example of problematic input:

.. note::

    a note text
2013-11-04 10:23:06 +01:00
Siddharth Agarwal
5fa78a0d83 merge: move forgets to the beginning of the action list
Forgets need to be in the beginning of the action list, same as removes. This
lets us avoid clashes in the dirstate where a directory is forgotten and a
file with the same name is added, or vice versa.
2013-11-06 10:20:18 -08:00
Durham Goode
64d690fd9a rebase: fix rebase aborts when 'tip-1' is public (issue4082)
When aborting a rebase where tip-1 is public, rebase would fail to undo the merge
state. This caused unexpected dirstate parents and also caused unshelve to
become unabortable (since it uses rebase under the hood).

The problem was that rebase uses -2 as a marker rev, and when it checked for
immutableness during the abort, -2 got resolved to the second to last entry in
the phase cache.

Adds a test for the fix. Add exception to phase code to prevent this in the
future.
2013-11-04 19:59:00 -08:00
Johan Bjork
6055bcdec2 patch: ensure valid git diffs if source/destination file is missing (issue4046)
This is arguably a workaround, a better fix may be in the repo to
ensure that it won't list a file 'modified' unless there is a file
context for the previous version.
2013-10-13 08:38:30 -04:00
Pavlos Touboulidis
7e1d441f10 doc: fix internal date sample (issue4072) 2013-10-29 21:54:49 +02:00
Matt Mackall
a40dbdbbc6 bdiff: avoid a memory error on malloc failure 2013-10-30 16:03:42 -05:00
FUJIWARA Katsunori
2151b431ba doc: put text into header of 1st column in table to generate page correctly
>From the table without header text of 1st column, docutils generates
the table with fully empty header row.
2013-10-25 01:14:18 +09:00
FUJIWARA Katsunori
23f95aaedb doc: use double quotation mark to quote arguments in examples for Windows users
On Windows, only double quotation mark can quote command line
arguments.

So, this patch uses double quotation mark to quote command line
arguments in all examples of online help document.
2013-10-25 01:14:18 +09:00
FUJIWARA Katsunori
19e586921c doc: end line preceding command line example with double colon 2013-10-25 01:14:18 +09:00
Takumi IINO
56ac953b3c hgweb: add missing semicolon 2013-10-24 21:37:13 +09:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Yuya Nishihara
4a2a9b7d3a cmdutil: fix makefileobj not to clobber default modemap dict
Problem occurs if "hg cat -o" is invoked more than once in the same process.
The output of "hg cat" will be appended because of modemap[fn] = 'ab'.
2013-10-22 23:38:58 +09:00
Matt Mackall
6ddd78602b help: minor tweak to push help 2013-10-21 10:26:38 -07:00
FUJIWARA Katsunori
9246c0599a discovery: revise hint message introduced by changeset 49ed20ea8da0
This patch revises hint message from "for detail about" introduced by
changeset 49ed20ea8da0 to "for details about", to unify it with the
hint message introduced by proceeding patch.
2013-10-03 23:16:07 +09:00
FUJIWARA Katsunori
ad1b5de6ff push: add more detailed explanation about "--force" to online help document
This patch adds more detailed explanation about "--force" to online
help document of "hg push" to prevent novice users to execute "push
--force" easily without understanding about problems of multiple
branch heads in the repository.
2013-10-03 23:16:06 +09:00
FUJIWARA Katsunori
3198fa3830 push: hide description about "-f" in the hint to prevent from using it easily
"use push -f to force" in the hint at abortion of "hg push" may cause
novice users to execute "push -f" easily without understanding about
problems of multiple branch heads in the repository.

This patch hides description about "-f" in the hint, and leads into
seeing "hg help push" for details about pushing new heads.
2013-10-03 23:16:06 +09:00
FUJIWARA Katsunori
d01f604fec demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.

For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.

Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.

This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.

This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.

    - invocation of "_import()" when root module imports sub-module by
      absolute path without "fromlist"

      for example, "import a.b" in "a.__init__.py".

      extensions are loaded with "hgext_" prefix, and this causes
      execution of another (= fixed by this patch) code path.

    - invocation of "_origimport()" when "level != -1" with "fromlist"

      for example, importing after "from __future__ import
      absolute_import" (level == 0), or "from . import b" or "from .a
      import b" (0 < level),

      for portability between python versions and environments,
      extensions shouldn't cause "level != -1".
2013-10-05 01:02:22 +09:00
FUJIWARA Katsunori
24ac3edef8 demandimport: support "absolute_import" for external libraries (issue4029)
Before this patch, demandimport of Mercurial may fail to load external
libraries using "from __future__ import absolute_import": for example,
importing "foo" in "bar.baz" module will load "bar.foo" if it exists,
even though "absolute_import" is enabled in "bar.baz" module.

So, extensions for Mercurial can't use such external libraries.

This patch saves "level" of import request for on-demand module
loading in the future: default value of level is -1, and level is 0
when "absolute_import" is enabled.

"level" value is passed to built-in import function in
"_demandmod._load()" and it should load target module correctly.

This patch changes only one "_demandmod" construction case other than
cases below:

    - construction in "_demandmod._load()"

      this code path should be used only in relative sub-module
      loading case

    - constructions other than patched one in"_demandimport()"

      these code paths shouldn't be used in "level != -1" case
2013-10-05 01:02:22 +09:00
Siddharth Agarwal
69eb5c00b0 merge: exit early during a no-op update (BC)
hg update . (or equivalents) are effectively no-ops in just about all
circumstances.  These sorts of updates can be especially common in a
bookmark-oriented workflow. This saves us a status check and a manifest
decompression, which means that on a repo with over 210,000 files, this brings
hg update . down from 2.5 seconds to 0.15.

There is one change in behavior: a file that was added, not committed, and then
deleted but not removed used to be removed from the dirstate. With this patch
it isn't. This is what causes the change in test-mq-qpush-exact.t. This seems
like it's enough of an edge case to not be worth handling.

The output of test-empty.t changes because those files are not yet created.
2013-10-01 17:43:54 -07:00
FUJIWARA Katsunori
fb1d8fd59b localrepo: invoke only feature setup functions for enabled extensions
Before this patch, each feature setup functions for localrepository
class should examine whether corresponding extension is enabled or not
by themselves.

This patch invokes only feature setup functions defined in module of
enabled extensions, and it makes implementation of feature setup
functions easier and simpler.
2013-10-17 21:45:17 +09:00
Yuya Nishihara
a87a5e29b1 lock: handle race in trylock/testlock on Windows
readlock may raise IOError if the system does not support symlink.
2013-10-02 21:16:40 +09:00
Mads Kiilerich
a971393dbd commands: refactor 'serve', extract the http service class 2013-10-10 04:32:36 +02:00
Brodie Rao
c42d4c5508 localrepo: remove unused repo.branchtags()/_branchtip() methods 2013-09-16 01:08:29 -07:00
Brodie Rao
7dec608ff1 hgweb: simplify branches with repo.branchmap().iterbranches() 2013-09-16 01:08:29 -07:00
Brodie Rao
adc7ea02cb hgweb: simplify summary with repo.branchmap().iterbranches() 2013-09-16 01:08:29 -07:00
Brodie Rao
899e66fafb branches: simplify with repo.branchmap().iterbranches()
Running hg branches on the PyPy repo (with 996) over a busy NFS server,
before this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        1069            0      1.2955      1.2955   <open>
        1063            0      0.5576      0.5576   <method 'close' of 'file' objects>
        4122            0      0.1993      0.0449   mercurial.repoview:161(changelog)
        8240            0      0.0771      0.0299       mercurial.changelog:133(tip)
        4122            0      0.0422      0.0204       mercurial.localrepo:26(__get__)
        8240            0      0.0252      0.0131       <len>
        4122            0      0.0060      0.0037       mercurial.repoview:112(filterrevs)
        8240            0      0.0028      0.0028       <hash>
        3029            0      0.2139      0.0390   mercurial.context:202(__init__)
        3029            0      0.1402      0.0339       mercurial.repoview:161(changelog)
        3029            0      0.0240      0.0087       mercurial.changelog:183(rev)
        9087            0      0.0067      0.0067       <isinstance>
        1096            0      0.0025      0.0025       <binascii.unhexlify>
        4125            0      0.0015      0.0015       <len>
        4229            0      0.0344      0.0344   mercurial.revlog:296(rev)
        1061            0      0.0343      0.0343   <method 'seek' of 'file' objects>
        1063            0      0.0339      0.0339   <method 'read' of 'file' objects>
       40476        16488      0.0479      0.0311   <len>
       16488            0      0.0216      0.0168       mercurial.revlog:262(__len__)
        8240            0      0.0771      0.0299   mercurial.changelog:133(tip)
        8240            0      0.0281      0.0203       mercurial.changelog:190(node)
        8240            0      0.0191      0.0095       <len>
        1342            0      0.0278      0.0278   <zlib.decompress>
        1074            0      2.2143      0.0266   mercurial.changelog:270(read)
        1074            0      2.1328      0.0230       mercurial.revlog:907(revision)
        1073            0      0.0208      0.0108       mercurial.changelog:28(decodeextra)
        2148            0      0.0072      0.0072       <method 'split' of 'str' objects>
        2148            0      0.0211      0.0038       mercurial.encoding:61(tolocal)
        1074            0      0.0028      0.0028       <method 'index' of 'str' objects>
        1061            0      1.9811      0.0237   mercurial.revlog:817(_loadchunk)

real    0m2.742s
user    0m0.811s
sys     0m0.188s

After this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        2092            0      0.1444      0.0292   mercurial.context:202(__init__)
        2092            0      0.0908      0.0216       mercurial.repoview:161(changelog)
        2092            0      0.0164      0.0057       mercurial.changelog:183(rev)
        6276            0      0.0045      0.0045       <isinstance>
        1096            0      0.0024      0.0024       <binascii.unhexlify>
        3188            0      0.0013      0.0013       <len>
        2218            0      0.0230      0.0230   mercurial.revlog:296(rev)
        2111            0      0.1028      0.0218   mercurial.repoview:161(changelog)
        4218            0      0.0387      0.0146       mercurial.changelog:133(tip)
        2111            0      0.0238      0.0104       mercurial.localrepo:26(__get__)
        4218            0      0.0122      0.0062       <len>
        2111            0      0.0038      0.0021       mercurial.repoview:112(filterrevs)
        4218            0      0.0014      0.0014       <hash>
       20240         8444      0.0233      0.0149   <len>
        8444            0      0.0110      0.0084       mercurial.revlog:262(__len__)
        4218            0      0.0387      0.0146   mercurial.changelog:133(tip)
        4218            0      0.0144      0.0103       mercurial.changelog:190(node)
        4218            0      0.0097      0.0048       <len>
        2398            1      0.0271      0.0115   mercurial.localrepo:26(__get__)
        2398            1      0.0146      0.0046       mercurial.scmutil:939(__get__)
        2124            0      0.0009      0.0009       mercurial.localrepo:330(unfiltered)
         274            0      0.0002      0.0002       mercurial.repoview:192(unfiltered)
           4            0      0.1409      0.0112   mercurial.branchmap:19(read)
        1096            0      0.1113      0.0028       mercurial.localrepo:407(__contains__)
        1098            0      0.0020      0.0020       <method 'split' of 'str' objects>
        1097            0      0.0019      0.0019       <binascii.unhexlify>
        1096            0      0.0093      0.0018       mercurial.encoding:61(tolocal)
        1096            0      0.0010      0.0010       <method 'append' of 'list' objects>
        4349            0      0.0150      0.0105   mercurial.changelog:190(node)
        4349            0      0.0045      0.0045       mercurial.revlog:317(node)

real    0m0.362s
user    0m0.329s
sys     0m0.024s
2013-09-16 01:08:29 -07:00
Brodie Rao
38cd6d3329 debuglabelcomplete: simplify with repo.branchmap().iterbranches() 2013-09-16 01:08:29 -07:00
Brodie Rao
34af0d72ea branchmap: introduce iterbranches() method 2013-09-16 01:08:29 -07:00
Brodie Rao
af45025c76 localrepo: refactor repo.branchheads() to use repo.branchmap().branchheads() 2013-09-16 01:08:29 -07:00
Brodie Rao
f0a5d60210 branchmap: introduce branchheads() method 2013-09-16 01:08:29 -07:00
Brodie Rao
b351ef136e localrepo: refactor repo.branchtip() to use repo.branchmap().branchtip() 2013-09-16 01:08:29 -07:00
Brodie Rao
b2b08444eb branchmap: introduce branchtip() method 2013-09-16 01:08:29 -07:00
Brodie Rao
a446720e09 branchmap: cache open/closed branch head information
This lets us determine the open/closed state of a branch without
reading from the changelog (which can be costly over NFS and/or with
many branches).
2013-09-16 01:08:29 -07:00
Stephen Lee
7b97b6250a bookmarks: allow push -B to create a new remote head (issue2372)
Push is currently allowed to create a new head if there is a remote
bookmark that will be updated to point to the new head. If the
bookmark is not known remotely then push aborts, even if a -B argument
is about to push the bookmark. This change allows push to continue in
this case. This does not require a wireproto force.
2013-11-11 21:16:54 +11:00
Matthew Turk
c0982bbb31 template: modify showextras to return a hybrid
This modifies slightly the behavior introduced in fcc482469a3c to allow
showextras to return a hybrid, rather than showlist.  The example in the
template help file now executes and returns meaningful results.
2013-11-21 15:46:49 -05:00
Brodie Rao
56709077ed branches: avoid unnecessary changectx.branch() calls
This requires reading from the changelog, which can be costly over NFS.

Note that this does not totally remove reading from the changelog; we
still do that when calling changectx.closesbranch(). That call will be
removed in a later patch.

Running hg branches on the PyPy repo (with 996) over a busy NFS server,
before this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        2042            0      2.2827      2.2827   <open>
        2036            0      0.9840      0.9840   <method 'close' of 'file' objects>
        2036            0      0.0464      0.0464   <method 'read' of 'file' objects>
        5233            0      0.1985      0.0453   mercurial.repoview:161(changelog)
       10462            0      0.0791      0.0314       mercurial.changelog:133(tip)
        5233            0      0.0388      0.0176       mercurial.localrepo:26(__get__)
       10462            0      0.0250      0.0126       <len>
        5233            0      0.0059      0.0039       mercurial.repoview:112(filterrevs)
       10462            0      0.0029      0.0029       <hash>
        2034            0      0.0444      0.0444   <method 'seek' of 'file' objects>
        5340            0      0.0390      0.0390   mercurial.revlog:296(rev)
        2582            0      0.0371      0.0371   <zlib.decompress>
        3155            0      0.1963      0.0366   mercurial.context:202(__init__)
        3155            0      0.1238      0.0306       mercurial.repoview:161(changelog)
        3155            0      0.0261      0.0080       mercurial.changelog:183(rev)
        9465            0      0.0061      0.0061       <isinstance>
        1096            0      0.0023      0.0023       <binascii.unhexlify>
        4251            0      0.0014      0.0014       <len>
        2059            0      3.7341      0.0332   mercurial.changelog:270(read)
        2059            0      3.6304      0.0307       mercurial.revlog:907(revision)
        2057            0      0.0262      0.0137       mercurial.changelog:28(decodeextra)
        4118            0      0.0094      0.0094       <method 'split' of 'str' objects>
        4118            0      0.0270      0.0048       mercurial.encoding:61(tolocal)
        2059            0      0.0040      0.0040       <method 'index' of 'str' objects>
       10462            0      0.0791      0.0314   mercurial.changelog:133(tip)
       10462            0      0.0289      0.0207       mercurial.changelog:190(node)
       10462            0      0.0188      0.0091       <len>
       52433        20932      0.0478      0.0310   <len>
       20932            0      0.0221      0.0168       mercurial.revlog:262(__len__)
        2059            0      3.6304      0.0307   mercurial.revlog:907(revision)

real    0m4.361s
user    0m0.986s
sys     0m0.237s

After this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        1069            0      1.1098      1.1098   <open>
        1063            0      0.4865      0.4865   <method 'close' of 'file' objects>
        4122            0      0.1811      0.0404   mercurial.repoview:161(changelog)
        8240            0      0.0712      0.0272       mercurial.changelog:133(tip)
        4122            0      0.0378      0.0177       mercurial.localrepo:26(__get__)
        8240            0      0.0221      0.0115       <len>
        4122            0      0.0057      0.0033       mercurial.repoview:112(filterrevs)
        8240            0      0.0025      0.0025       <hash>
        3029            0      0.1979      0.0371   mercurial.context:202(__init__)
        3029            0      0.1278      0.0310       mercurial.repoview:161(changelog)
        3029            0      0.0230      0.0081       mercurial.changelog:183(rev)
        9087            0      0.0061      0.0061       <isinstance>
        1096            0      0.0026      0.0026       <binascii.unhexlify>
        4125            0      0.0014      0.0014       <len>
        4229            0      0.0337      0.0337   mercurial.revlog:296(rev)
        1061            0      0.0296      0.0296   <method 'seek' of 'file' objects>
        1063            0      0.0292      0.0292   <method 'read' of 'file' objects>
        8240            0      0.0712      0.0272   mercurial.changelog:133(tip)
        8240            0      0.0271      0.0196       mercurial.changelog:190(node)
        8240            0      0.0169      0.0083       <len>
       40476        16488      0.0422      0.0271   <len>
       16488            0      0.0193      0.0152       mercurial.revlog:262(__len__)
        1342            0      0.0241      0.0241   <zlib.decompress>
        9445            0      0.0336      0.0224   mercurial.changelog:190(node)
        9445            0      0.0112      0.0112       mercurial.revlog:317(node)
        1074            0      1.9102      0.0224   mercurial.changelog:270(read)
        1074            0      1.8397      0.0202       mercurial.revlog:907(revision)
        1073            0      0.0187      0.0099       mercurial.changelog:28(decodeextra)
        2148            0      0.0061      0.0061       <method 'split' of 'str' objects>
        2148            0      0.0184      0.0034       mercurial.encoding:61(tolocal)

real    0m2.402s
user    0m0.735s
sys     0m0.177s
2013-11-15 23:18:08 -05:00
Brodie Rao
b8ea796521 branchmap: add documentation on the branchcache on-disk format 2013-11-15 23:18:08 -05:00
Brodie Rao
43ab01245b revlog: allow tuning of the chunk cache size (via format.chunkcachesize)
Running perfmoonwalk on the Mercurial repo (with almost 20,000 changesets) on
Mac OS X with an SSD, before this change:

$ hg --config format.chunkcachesize=1024 perfmoonwalk
! wall 2.022021 comb 2.030000 user 1.970000 sys 0.060000 (best of 5)

(16,154 cache hits, 3,840 misses.)

$ hg --config format.chunkcachesize=4096 perfmoonwalk
! wall 1.901006 comb 1.900000 user 1.880000 sys 0.020000 (best of 6)

(19,003 hits, 991 misses.)

$ hg --config format.chunkcachesize=16384 perfmoonwalk
! wall 1.802775 comb 1.800000 user 1.800000 sys 0.000000 (best of 6)

(19,746 hits, 248 misses.)

$ hg --config format.chunkcachesize=32768 perfmoonwalk
! wall 1.818545 comb 1.810000 user 1.810000 sys 0.000000 (best of 6)

(19,870 hits, 124 misses.)

$ hg --config format.chunkcachesize=65536 perfmoonwalk
! wall 1.801350 comb 1.810000 user 1.800000 sys 0.010000 (best of 6)

(19,932 hits, 62 misses.)

$ hg --config format.chunkcachesize=131072 perfmoonwalk
! wall 1.805879 comb 1.820000 user 1.810000 sys 0.010000 (best of 6)

(19,963 hits, 31 misses.)

We may want to change the default size in the future based on testing and
user feedback.
2013-11-17 18:04:29 -05:00
Brodie Rao
976b336ba8 revlog: read/cache chunks in fixed windows of 64 KB
When reading a revlog chunk, instead of reading up to 64 KB ahead of the
request offset and caching that, this change caches a fixed window before
and after the requested data that falls on 64 KB boundaries. This increases
cache hits when reading revlogs backwards.

Running perfmoonwalk on the Mercurial repo (with almost 20,000 changesets) on
Mac OS X with an SSD, before this change:

$ hg perfmoonwalk
! wall 2.307994 comb 2.310000 user 2.120000 sys 0.190000 (best of 5)

(Each run has 10,668 cache hits and 9,304 misses.)

After this change:

$ hg perfmoonwalk
! wall 1.814117 comb 1.810000 user 1.810000 sys 0.000000 (best of 6)

(19,931 cache hits, 62 misses.)

On a busy NFS share, before this change:

$ hg perfmoonwalk
! wall 17.000034 comb 4.100000 user 3.270000 sys 0.830000 (best of 3)

After:

$ hg perfmoonwalk
! wall 1.746115 comb 1.670000 user 1.660000 sys 0.010000 (best of 5)
2013-11-17 18:04:28 -05:00
FUJIWARA Katsunori
bcc53deece subrepo: check phase of state in each subrepositories before committing
Before this patch, phase of newly created commit is determined by
"phases.new-commit" configuration regardless of phase of state in each
subrepositories.

For example, this may cause the "public" revision in the parent
repository referring the "secret" one in subrepository.

This patch checks phase of state in each subrepositories before
committing in the parent, and aborts or changes phase of newly created
commit if subrepositories have more restricted phase than the parent.

This patch uses "follow" as default value of "phases.checksubrepos"
configuration, because it can keep consistency between phases of the
parent and subrepositories without breaking existing tool chains.
2013-11-13 15:55:30 +09:00
Matt Mackall
684b14efd3 merge with crew 2013-12-16 12:59:32 -06:00
Augie Fackler
d5ef0d1bf2 http: backout df58533adb15, which breaks on Python 2.4 2013-12-14 12:48:12 -05:00
Matt Mackall
b73357aaab merge with stable 2013-12-13 17:23:02 -06:00
Matt Mackall
30d6dbb217 parsers: backout version mismatch detection from 5f712fe8433d
This introduced mandatory recompilations and breaks pure mode in tests
2013-12-01 20:46:36 -06:00
Matt Mackall
4223982ebe merge with stable 2013-12-01 14:10:53 -06:00
Chris Jerdonek
030ca96e57 parsers: fail fast if Python has wrong minor version (issue4110)
This change causes an informative ImportError to be raised when importing
the extension module parsers if the minor version of the currently-running
Python interpreter doesn't match that of the Python that was used when
compiling the extension module.  Here is an example of what the new error
looks like:

  Traceback (most recent call last):
    File "test.py", line 1, in <module>
      import mercurial.parsers
  ImportError: Python minor version mismatch: The Mercurial extension
  modules were compiled with Python 2.7.6, but Mercurial is currently using
  Python with sys.hexversion=33883888: Python 2.5.6
  (r256:88840, Nov 18 2012, 05:37:10)
  [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))]
   at: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Resources/
    Python.app/Contents/MacOS/Python

The reason for raising an error in this scenario is that Python's C API
is known not to be compatible from minor version to minor version, even
if sys.api_version is the same.  See for example this Python bug report
about incompatibilities between 2.5 and 2.6+:

  http://bugs.python.org/issue8118

These incompatibilities can cause Mercurial to break in mysterious,
unforeseen ways.  For example, when Mercurial compiled with Python 2.7 was
run with 2.5, the following crash occurred when running "hg status":

  http://bz.selenic.com/show_bug.cgi?id=4110

After this crash was fixed, running with Python 2.5 no longer crashes, but
the following puzzling behavior still occurs:

    $ hg status
      ...
      File ".../mercurial/changelog.py", line 123, in __init__
        revlog.revlog.__init__(self, opener, "00changelog.i")
      File ".../mercurial/revlog.py", line 251, in __init__
        d = self._io.parseindex(i, self._inline)
      File ".../mercurial/revlog.py", line 158, in parseindex
        index, cache = parsers.parse_index2(data, inline)
    TypeError: data is not a string

which can be reproduced more simply with:

    import mercurial.parsers as parsers
    parsers.parse_index2("", True)

Both the crash and the TypeError occurred because the Python C API's
PyString_Check returns the wrong value when the C header files from
Python 2.7 are run with Python 2.5.  This is an example of an
incompatibility of the sort mentioned in the Python bug report above.

Failing fast with an informative error message will result in a better
user experience in cases like the above.  The information in the ImportError
will also simplify troubleshooting for those on Mercurial mailing lists,
the bug tracker, etc.

This patch only adds the version check to parsers.c, which is sufficient
to affect command-line commands like "hg status" and "hg summary".
An idea for a future improvement is to move the version-checking C code
to a more central location, and have it run when importing all
Mercurial extension modules and not just parsers.c.
2013-11-29 12:36:28 -08:00
Nicolas Vigier
a9bf6787d2 patch: add support for git delta hunks
When creating patches modifying binary files using "git format-patch",
git creates 'literal' and 'delta' hunks. Mercurial currently supports
'literal' hunks only, which makes it impossible to import patches with
'delta' hunks.

This changeset adds support for 'delta' hunks. It is a reimplementation
of patch-delta.c from git :
http://git.kernel.org/cgit/git/git.git/tree/patch-delta.c
2013-11-27 18:39:00 +01:00
Sean Farley
5f6b3d5623 pathcomplete: remove ambiguous entries for sole completion on a directory
Previously, directories were added with the trailing slash and, if there was
only one completion, then another ambiguous entry was created using '.', as
follows:

$ hg rm mer<TAB>
mercurial/./  mercurial//

This was added in bc559aff745c (though, some logic existed before that) to work
around bash completion adding a space after the sole entry because we treated
directories and files the same. We no longer do that now so we remove this
unneeded code.

Tests have been updated to match this new behavior.
2013-11-25 12:12:42 -05:00
Stéphane Klein
f4f9ffdc0e http: reuse authentication info after the first failed request (issue3567)
Context: mercurial access to repository server with http access, and this
server is protected by basic auth.

Before patch:

* mercurial try an anonymous access to server, server return 401 response and
  mercurial resend request with login / password information

After patch:

* mercurial try an anonymous access to server, server return 401
  response. For all subsequent requests, mercurial keep in memory this
  information (this server need basic auth information).

This patch reduce the number of http access against mercurial server.

Example, before patch :

10.10.168.170 - - [25/Oct/2013:15:44:51 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:44:52 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:00 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:01 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:03 +0200] "GET /hg/testagt?cmd=batch
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:04 +0200] "GET /hg/testagt?cmd=batch
HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:06 +0200] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:07 +0200] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:09 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:10 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 - "-" "mercurial/proto-1.0"

Example after patch :

10.10.168.170 - - [28/Oct/2013:11:49:14 +0100] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:15 +0100] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:17 +0100] "GET /hg/testagt?cmd=batch
HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:19 +0100] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:22 +0100] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:24 +0100] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 - "-" "mercurial/proto-1.0"

In this last example, you can see only one 401 response.
2013-11-25 17:18:12 +01:00
Steve Hoelzer
3de6d4f403 help: fix formatting of template example 2013-12-11 11:33:58 -06:00
Sean Farley
96ae01bd26 dispatch: turn off custom debugger for HGPLAIN mode
Some debuggers, such as ipdb, load escape codes and color codes even when later
turned off. This will affect scripts that do simple parsing and can't handle
escape codes. Therefore, we only load a custom debugger if ui.plain() is false.
2013-11-25 12:20:39 -05:00
Martin Geisler
865c68aba2 hg: remove outdated comment
The graphlog functionality has been in core since Mercurial 2.3.
2013-11-22 19:13:26 +01:00
Bryan O'Sullivan
0fb3ccb7e6 Merge 2013-11-26 21:55:21 -08:00
Abhay Kadam
fbe291d0cf mercurial/parsers.c: fix compiler warning
When try to compile on x64 OS X, I get this warning:

mercurial/parsers.c:931:27: warning: implicit conversion loses integer precision
: 'long' to 'int' [-Wshorten-64-to-32]
                        ? 4 : self->raw_length / 2;

The patch verifies if value of self->raw_length falls bellow INT_MAX; if not,
it raises the ValueError exception.

If value of self->raw_length is greater than 4, it's casted to int type, to
eliminate the warning.
2013-11-19 23:49:11 +05:30
Matt Mackall
05fd1f2542 merge with stable 2013-11-25 16:15:44 -06:00
Siddharth Agarwal
9b0eab9940 bookmarks: make setcurrent with None an error 2013-11-15 18:41:40 -08:00
Siddharth Agarwal
e7e0c5ad48 bmstore.write: use unsetcurrent instead of setcurrent with None 2013-11-15 18:28:57 -08:00
Siddharth Agarwal
ac345dd993 commands.bookmark: use unsetcurrent instead of setcurrent with None
There are currently two different ways we can have no active bookmark:
.hg/bookmarks.current being missing and it being an empty file. This patch and
upcoming ones make an empty file the only way to represent no active bookmarks.
This is the right choice because it matches the state that a new repository
without bookmarks will be in.
2013-11-15 18:06:01 -08:00
Matt Mackall
40d3e4ba4e merge with stable 2013-11-22 17:26:58 -06:00
FUJIWARA Katsunori
cf37230008 lock: take both vfs and lock file path relative to vfs to access via vfs
This patch makes "lock.lock.__init__()" take both vfs and lock file
path relative to vfs, instead of absolute path to lock file.

This allows lock file to be accessed via vfs.
2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
f2d55c7c7d vfs: add "makelock()" and "readlock()" 2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
2b101a0a9d hg: rewrite "copystore()" with vfs
This patch rewrites "copystore()" with vfs, because succeeding patch
requires "lock.lock()" invocation with vfs.

This patch uses 'dstbase + "/lock"' instead of "join()" with both
elements even on Windows environment but it should be reasonable,
because target files given from "store.copyfiles()" already uses "/"
as path separator.

"util.copyfiles()" between two vfs-s may have to be rewritten in the
future.
2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
461da17148 localrepo: import "lock" module as "lockmod" for readability
Before this patch, "localrepo.py" has many methods defining local
variable "lock", even though it imports "lock" module as "lock". This
ambiguity decreases readability.
2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
ed122f7175 transaction: take journal file path relative to vfs to use file API via vfs 2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
f39330457a vfs: add "chmod()" 2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
d6fa8a9bfa vfs: add "isfile()" 2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
cf2ceb0ac9 transaction: unlink target file via vfs
Before this patch, unlink target file is once opened before unlinking,
because "opener" before vfs migration doesn't have "unlink()"
function.

This patch uses "vfs.unlink()" instead of "open()" and "fp.name".
2013-11-12 16:23:52 +09:00
Simon Heimberg
cbac9e9e39 localrepo: prevent to copy repo local config, copy baseui instead
Copying a repos local configuration to another repo is a bad idea because the
2nd repo gets the configuration of the first. Prevent this by really calling
repo.baseui.copy when repo.ui.copy is called.
This requires some changes in commandserver which needs to clone repo.ui for
rejecting temporary changes.

This patch has its roots back in the topic "repo isolation" around 68ae3063a47d
and was suggested by mpm.
2013-11-11 22:59:26 +01:00
Matt Mackall
df890e8b8a merge with stable 2013-11-21 15:08:30 -06:00
Matt Mackall
1b2df1cd91 help: drop help for branches template keyword
The {branches} keyword dates to pre-1.0 Mercurial's tag-like branch
scheme which allowed changesets to be on multiple branches. This is
the last visible vestige of that scheme, users should instead be using
{branch}, possibly with if().
2013-11-21 11:49:31 -06:00
Durham Goode
01ed192faf manifest: increase lrucache from 3 to 4
During a commit amend there are 4 manifests being handled:

- original commit
- temporary commit
- amended commit
- merge base

This causes a manifest cache miss which hurts perf on large repos. On a large
repo, this fix causes amend to go from 6 seconds to 5.5 seconds.
2013-11-11 16:35:12 -08:00
Durham Goode
d8c96277e4 strip: add faster revlog strip computation
The previous revlog strip computation would walk every rev in the revlog, from
the bottom to the top.  Since we're usually stripping only the top few revs of
the revlog, this was needlessly expensive on large repos.

The new algorithm walks the exact number of revs that will be stripped, thus
making the operation not dependent on the number of revs in the repo.

This makes amend on a large repo go from 8.7 seconds to 6 seconds.
2013-11-11 16:42:49 -08:00
Durham Goode
9840379432 revlog: return lazy set from findcommonmissing
When computing the commonmissing, it greedily computes the entire set
immediately. On a large repo where the majority of history is irrelevant, this
causes a significant slow down.

Replacing it with a lazy set makes amend go from 11 seconds to 8.7 seconds.
2013-11-11 16:40:02 -08:00
Matt Mackall
74cf3d4bf4 merge with stable 2013-11-19 11:29:56 -05:00
Siddharth Agarwal
a70310c09e statichttprepo.httprangeheader: implement readlines
bookmarks.readcurrent() requires readlines() on file objects returned from
repo.vfs. It isn't used right now but will be in upcoming patches.
2013-11-17 13:31:18 -08:00
Siddharth Agarwal
b1f5a2bec5 statichttprepo: pass in True to splitlines, not 1
splitlines actually takes a boolean.
2013-11-17 13:28:11 -08:00
Mads Kiilerich
2dfba4c2b0 bisect: avoid confusing use of variables with same names in nested local scopes 2013-11-16 15:46:29 -05:00
Mads Kiilerich
a4925d4784 discovery: make note messages for new heads more readable 2013-11-16 15:46:29 -05:00
Mads Kiilerich
d93d477327 discovery: tweak error message for multiple branch heads 2013-11-16 15:46:29 -05:00
Siddharth Agarwal
25418f3155 scmutil.filecache: support watching over multiple files 2013-11-16 13:29:39 -08:00
Siddharth Agarwal
fceaf0623e scmutil: introduce a filecacheentry that can watch multiple paths 2013-11-16 13:24:26 -08:00
Siddharth Agarwal
3585a23345 scmutil: rename filecacheentry to filecachesubentry
Upcoming patches will allow the file cache to watch over multiple files, and
call the decorated function again if any of the files change.

The particular use case for this is the bookmark store, which needs to be
invalidated if either .hg/bookmarks or .hg/bookmarks.current changes. (This
doesn't currently happen, which is a bug. This bug will also be fixed in
upcoming patches.)
2013-11-16 13:19:06 -08:00
Siddharth Agarwal
cb19f2bbbe scmutil.filecacheentry: make stat argument to constructor mandatory
There's no real upside to making stat optional -- this constructor has just two
callers.
2013-11-16 13:33:33 -08:00
Augie Fackler
fb91efd733 makememctx: move from patch to context to break import cycle 2013-11-06 22:09:15 -05:00
Augie Fackler
9f876f6c89 cleanup: move stdlib imports to their own import statement
There are a few warnings still produced by my import checker, but
those are false positives produced by modules that share a name with
stdlib modules.
2013-11-06 16:48:06 -05:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00
Augie Fackler
2859ed15ec subsettable: move from repoview to branchmap, the only place it's used
This is a step towards breaking an import cycle between revset and
repoview. Import cycles happened to work in Python 2 with implicit
relative imports, but breaks on Python 3 when we start using explicit
relative imports via 2to3 rewrite rules.
2013-11-06 14:38:34 -05:00
Augie Fackler
2f26b47577 obsolete: add __eq__ and __hash__ to marker to make set() deduplication work 2013-11-16 20:12:02 -05:00
Pierre-Yves David
1a1b1b5ce2 obsolete: do not accept duplicated marker during exchange
Before this patch, duplicated obsolescence markers could slip into an
obstore if the bookmark was unknown locally and duplicated in the
incoming obsolescence stream.

Existing duplicate markers will not be automatically removed but
they'll stop propagating. Having a few duplicated markers is harmless
and people have been warned evolution is <blink>experimental</blink>
anyway.
2013-11-16 20:31:58 -05:00
Augie Fackler
3e5e7a33ad Merge with stable. 2013-11-17 13:42:24 -05:00
FUJIWARA Katsunori
f4da0cbf73 bookmarks: rewrite pushing bookmarks in "localrepository.push()" by "compare()"
This patch adds "updateremote()", which uses "compare()" to compare
bookmarks between the local and the remote repositories, to replace
pushing local bookmarks in "localrepository.push()".
2013-11-08 12:45:52 +09:00
FUJIWARA Katsunori
22784f4191 bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
This patch adds "pushtoremote()", which uses "compare()" to compare
bookmarks between the local and the remote repositories, to replace
pushing local bookmarks in "commands.push()".
2013-11-08 12:45:52 +09:00
FUJIWARA Katsunori
31a7d77dc6 bookmarks: rewrite "updatefromremote()" by "compare()"
To update entries in bmstore "localmarks", this patch uses
"bin(changesetid)" instead of "repo[changesetid].node()" used in
original "updatefromremote()" implementation, because the former is
cheaper than the latter.
2013-11-08 12:45:52 +09:00
FUJIWARA Katsunori
6a643dd87d bookmarks: add function to centralize the logic to compare bookmarks
This patch adds "compare()" function to centralize the logic to
compare bookmarks between two repositories.
2013-11-08 12:45:52 +09:00
Alexander Plavin
91879c1d15 hgweb: use semantically suitable filelog.revs in filelog
The functions are equivalent in behaviour, so no behavior change.
2013-11-10 18:23:29 +04:00
Alexander Plavin
1fa7978d6b hgweb: always compute all entries and latestentry in filelog
This is the same thing which was done for changelog earlier, and it doesn't
affect performance at all. This change will make it possible to get the first
entry of the next page easily without computing the list twice.
2013-11-10 18:07:56 +04:00
Alexander Plavin
6a6391cdb6 hgweb: remove unused argument of entries function in filelog
This doesn't change the behavior as the argument wasn't used anyway.
2013-11-10 18:05:53 +04:00
Matthew Turk
5493f40b2a template: change extras to use showlist rather than manual templ call.
This enables start_extras and end_extras in template maps.
2013-11-15 18:08:50 -05:00
Matthew Turk
38bd75be54 help: adding example 'extras' printing to 'hg help templates' 2013-11-15 18:09:02 -05:00
Matthew Turk
3fa07ee864 help: document about {extras} template keyword
This adds text about the "extras" template keyword, similar to that proposed by
Yuya Nishihara previously.
2013-11-15 16:53:54 -05:00
Matt Mackall
0ed8797e8c merge with stable 2013-11-16 12:44:28 -05:00
FUJIWARA Katsunori
d759404236 scmutil: skip checks in "casecollisionauditor" if filename is already checked
Before this patch, almost all of check code in
"casecollisionauditor.__call__()" is executed, even if specified
filename is already checked, because "f in self._newfiles" is examined
lastly.

In addition to it, adding "fl" to "self._loweredfiles" and "f" to
"self._newfiles" are also redundant in such case.

This patch checks "f in self._newfiles" first, and returns immediately
to avoid execution of check code for efficiency.
2013-11-12 00:07:23 +09:00
Matt Mackall
6e88e21cca date: allow %z in format (issue4040) 2013-11-07 15:24:23 -06:00
Siddharth Agarwal
7decbaaad4 dirstate.status: return explicit unknown files even when not asked
dirstate.walk will return unknown files that were explicitly requested, even
if listunknown is false. There's no point in dropping these files on the
floor in dirstate.status.

This has no effect on any current callers, because all of them assume the
unknown list is empty and ignore it. Future callers may find it useful,
though.
2013-10-14 00:25:29 -04:00
Alexander Plavin
836ffef4a8 hgweb: fix unstoppable loading of graph when no more results
When a user reaches the end of repo history with graph view, it (unsuccessfully)
tried to load more entries. This patch disables further loading attempts.
2013-10-12 11:29:28 +04:00
Alexander Plavin
24f9b953ea hgweb: remove now unnecessary explicit header() and footer()
They became unnecessary after allowing custom-named entries in templates.
2013-07-24 03:20:26 +04:00
Alexander Plavin
06d5dbdf36 hgweb: replace 'shortlog' with 'changelog' in raw changelog template 2013-08-16 21:41:19 +04:00
FUJIWARA Katsunori
0b2abf8689 store: use "vfs.exists()" instead of "os.path.exists()" 2013-10-15 00:51:05 +09:00
FUJIWARA Katsunori
52c2363e13 context: use "vfs.lstat()" to examine target path instead of "os.path.*"
This patch gets stat object of target path by "vfs.lstat()", and
examines stat object to know the type of it. This follows the way in
"workingctx.add()".

This should be cheaper than original implementation invoking
"lexists()", "isfile()" and "islink()".
2013-10-15 00:51:05 +09:00
FUJIWARA Katsunori
269961e114 context: use "vfs.lstat()" instead of "os.lstat()" 2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
770590e67f context: use "vfs.lstat()" instead of "os.lstat()"
This patch also changes paths added to "rejected" list from full path
(referred by "p") to relative one (referred by "f"), when type of
target path is neither file nor symlink.

This change should be reasonable, because the path added to "rejected"
list is relative one, when "OSError" is raised at "lstat()".
2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
61a538d89f changelog: use "vfs.fstat()" instead of "util.fstat()"
Just invoking "os.fstat()" with "file.fileno()" doesn't require non
ANSI file API, because filename is not used for invocation of
"os.fstat()".

But "util.fstat()" should invoke "os.stat()" with "fp.name", if file
object doesn't have "fileno()" method for portability, and "fp.name"
may cause invocation of non ANSI file API.

So, this patch makes the constructor of appender class invoke
"util.fstat()" via vfs, to encapsulate filename handling.
2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
6d7cc2f5e0 changelog: use "vfs.rename()" instead of "util.rename()" 2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
49c8ebb7ec vfs: add "open()" for newly added code paths which open files via vfs
This patch replaces "open()" by own "__call__()" defined in derived
classes at the first invocation, for efficiency of succeeding
invocations.
2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
23a7a98972 bookmarks: use "vfs.utime()" instead of "os.utime()" 2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
33e3348b3e bookmarks: use "vfs.unlink()" instead of "util.unlink()" 2013-10-15 00:51:04 +09:00
Mads Kiilerich
c47c81f0e5 cmdutil: use None as default value for "function pointer" instead of False
Less type confusion.
2013-10-03 18:01:21 +02:00
Mads Kiilerich
86ecd7ae1f graft: make skip messages more helpful
This makes it possible for the user to understand and accept or work around
what is happening.
2013-10-03 18:01:21 +02:00
Matt Mackall
397a3b5d72 merge with stable 2013-10-09 14:15:34 -07:00
Matt Mackall
e1cd16976f hgweb: add escaping of tags and bookmarks in graph view 2013-10-09 12:02:32 -07:00
Matt Mackall
23bced957e json: add more paranoid escaping 2013-10-09 11:50:19 -07:00
Matt Mackall
4b0ea6e3c8 ui: send password prompts to stderr again (issue4056) 2013-10-09 11:27:59 -07:00
Matt Mackall
1b8efe2652 hgweb: escape branch names in graph view 2013-10-07 15:21:17 -07:00
Durham Goode
f6186031f7 changegroup: don't run changegroup hooks if nodes are gone
The changegroup hook runs when the repo lock is released, but it's possible that
multiple transactions have happened during that single lock and therefore the
commits the hook was for may be gone. This is the case in the shelve extension
where it adds a commit and strips it in the same lock but different
transactions (which results in warning messages during unshelve on hgsubversion
repos).

A real fix would be to attach the hook to the transaction instead, but that
might have unknown consequences. Since we're this close to code-freeze, this fix
just prevents the hook from running if the commit disappeared.
2013-10-07 11:45:01 -07:00
Augie Fackler
cdf1bbd9e1 merge with stable 2013-10-07 17:47:55 -04:00
Johan Bjork
bbce7855f8 patch: Fix nullid for binary git diffs (issue4054)
The index for an empty file in git is not 0, but sha-1("blobl 0\0").
2013-10-07 17:47:19 -04:00
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02:00
Siddharth Agarwal
0b1ce7709c cmdutil.service: move pidfile writing to the parent in daemon mode
There is a potential race here, which I suspect I've spotted in the wild, where
something reads the pid file after the parent exits but before the child has
had a chance to write to it. Moving writing the file to the parent causes this
to no longer be an issue.
2013-10-02 15:20:49 -07:00
Siddharth Agarwal
e4986d8e9e cmdutil.service: move pidfile writing to a local function
An upcoming patch will reuse this code.
2013-10-02 15:17:50 -07:00
David Soria Parra
4e97756fe4 hgweb: log headers only if headers were successfully parsed
The headers attribute is not initialized in certain error situations
(e.g. http 400 bad request). Check for self.headers before we attempt
to access it.
2013-10-01 09:54:46 +02:00
Pierre-Yves David
763949e575 repoview: have unfilteredpropertycache using the underlying cache
A  `unfilteredpropertycache` is a kind of `propertycache` used on `localrepo` to
unsure it will always be run against unfiltered repo and stored only once.

As the cached value is never stored in the repoview instance, the descriptor
will always be called. Before this patch such calls always result in a call to
the `__get__` method of the `propertycache` on the unfiltered repo. That was
recomputing a new value on every access through a repoview.

We can't prevent the repoview's `unfilteredpropertycache` to get called on every
access. In that case the new code makes a standard attribute access to the
property. If a value is cached it will be used.

The `propertycache` test file have been augmented with test about this issue.
2013-09-30 14:23:14 +02:00
Pierre-Yves David
a411302ece repoview: make propertycache.setcache compatible with repoview
Propertycache used standard attribute assignment. In the repoview case, this
assignment was forwarded to the unfiltered repo. This result in:
(1) unfiltered repo got a potentially wrong cache value,
(2) repoview never reused the cached value.

This patch replaces the standard attribute assignment by an assignment to
`objc.__dict__` which will bypass the `repoview.__setattr__`. This will not
affects other `propertycache` users and it is actually closer to the semantic we
need.

The interaction of `propertycache` and `repoview` are now tested in a python
test file.
2013-09-30 14:36:11 +02:00
FUJIWARA Katsunori
af33f66d43 help: use full name of extensions to look up them for keyword search
Before this patch, "hg help -k KEYWORD" fails, if there is the
extension of which name includes ".", because "extensions.load()"
invoked from "help.topicmatch()" fails to look such extension up, even
though it is already loaded in.

"help.topicmatch()" invokes "extensions.load()" with the name gotten
from "extensions.enabled()". The former expects full name of extension
(= key in '[extensions]' section), but the latter returns names
shortened by "split('.')[-1]". This difference causes failure of
looking extension up.

This patch adds "shortname" argument to "extensions.enabled()" to make
it return shortened names only if it is True. "help.topicmatch()"
turns it off to get full name of extensions.

Then, this patch shortens full name of extensions by "split('.')[-1]"
for showing them in the list of extensions.

Shortening is also applied on names gotten from
"extensions.disabled()" but harmless, because it returns only
extensions directly under "hgext" and their names should not include
".".
2013-09-23 20:23:25 +09:00
Wojciech Lopata
0a0c3321e2 generaldelta: initialize basecache properly
Previously basecache was incorrectly initialized before adding the first
revision from a changegroup. Basecache value influences when full revisions are
stored in revlog (when using generaldelta). As a result it was possible to
generate a generaldelta-revlog that could be bigger by arbitrary factor than its
non-generaldelta equivalent.
2013-09-20 10:45:51 -07:00
Augie Fackler
fd194f3d5b sslutil: backed out changeset 2cb59fd7ebb6 (issue4038)
Python docs are a little unclear, but mpm reports reading the OpenSSL
source code shows that PROTOCOL_SSLv23 allows TLS whereas
PROTOCOL_SSLv3 does not.
2013-09-18 14:40:17 -04:00
Augie Fackler
401f0a3a21 httpclient: apply upstream revision da7579b034a4 to fix SSL problems (issue4038) 2013-09-18 14:45:28 -04:00
Antoine Pitrou
ecc34bd7c0 bundle: fix performance regression when bundling file changes (issue4031)
Somewhere before 2.7, a change [82beb9b16505] was committed that
entailed a large performance regression when bundling (and therefore
remote cloning) repositories. For each file in the repository, it would
recompute the set of needed changesets even though it is the same for
all files. This computation would dominate bundle runtimes according to
profiler output (by 10x or more).
2013-09-07 21:20:00 +02:00
Alexander Plavin
fd04e86dd0 revset: fix wrong keyword() behaviour for strings with spaces
Some changesets can be wrongly reported as matched by this predicate
due to searching in a string joined with spaces and not individually.
A test case added, which fails without this fix.
2013-08-06 00:52:06 +04:00
FUJIWARA Katsunori
08b1b07292 tags: write tag overwriting history also into tag cache file (issue3911)
Before this patch, tag overwriting history is not written into tag
cache file ".hg/cache/tags".

This may give higher priority to local tag than global one, even if
the former is overwritten by the latter, because tag overwriting
history is used to compare priorities of them (as "rank").

In such cases, "hg tags" invocations using tag cache file shows
incorrect tag information.

This patch writes tag overwriting history also into tag cache file.
2013-08-28 22:09:53 +09:00
Kevin Bullock
7e226a7735 bookmarks: pull --update updates to active bookmark if it moved (issue4007)
This makes `hg pull --update` behave the same wrt the active bookmark as
`hg pull && hg update` does as of 13ea5e437ff8. A helper function,
bookmarks.calculateupdate, is added to prevent code duplication between
postincoming and update.
2013-08-01 21:43:14 -05:00
Wojciech Lopata
af27e2b918 bookmarks: update only proper bookmarks on push -r/-B (issue 3973)
Make push -r/-B update only these bookmarks that point to pushed revisions
or their ancestors, so we can be sure that commit pointed by bookmark is
present in the remote reposiory. Previously push tried to update all shared
bookmarks.
2013-07-26 13:34:51 -07:00
Matt Mackall
9b3084fb50 checklink: work around sshfs brain-damage (issue3636)
With the follow_symlinks option, sshfs will successfully create links
while claiming it encountered an I/O error. In addition, depending on
the type of link, it may subsequently be impossible to delete the link
via sshfs. Our existing link to '.' will cause sshfs to think the link
is a directory, and thus cause unlink to give EISDIR. Links to
non-existent names or circular links will cause the created link to not even
be visible.

Thus, we need to create a new temporary file and link to that. We'll
still get a failure, but we'll be able to remove the link.
2013-07-28 15:02:32 -05:00
Matt Mackall
aa456e3925 import: cut commit messages at --- unconditionally (issue2148)
We used to do this based on X-mailer: mentioning git, but git doesn't
put X-mailer in its git-format-patch output.
2013-07-27 19:31:14 -05:00
Matt Mackall
b2c60c13a2 revert: fix largefiles breakage 2013-07-26 21:03:25 -05:00
Matt Mackall
0bc2bdce17 revert: make backup when unforgetting a file (issue3423)
This skips the backup if it would be a duplicate.
2013-07-26 17:08:05 -05:00
Matt Mackall
fac649fcb2 revsingle: fix silly API issue (issue2992) 2013-07-26 15:42:10 -05:00
Siddharth Agarwal
52db69329a ancestor.deepest: ignore ninteresting while building result (issue3984)
ninteresting indicates the number of non-zero elements in the interesting
array, not the number of elements in the final list. Since elements in
interesting can stand for more than one gca, limiting the number of results to
ninteresting is an error.

Tests for issue3984 are included.
2013-07-25 14:43:15 -07:00
Wei, Elson
ec2b8c873f ancestor.deepest: decrement ninteresting correctly (issue3984)
The invariant this code tries to hold is that ninteresting is the number of
non-zero elements in the interesting array. interesting[nsp] is incremented at
the same time as interesting[sp] is decremented. So if interesting[nsp] was
previously 0, ninteresting shouldn't be decremented.
2013-07-25 17:35:53 +08:00
Siddharth Agarwal
2267993ebc ancestor.deepest: sort revs in C version
This isn't strictly necessary, but it makes the code more consistent with the
Python version.
2013-07-25 14:20:37 -07:00
Alexander Plavin
f7a860d1a8 hgweb: replace next(revs) to revs.next() to fix compatibility with Python 2.5- 2013-07-25 15:27:41 +04:00
Matt Mackall
6d0d30f28a checkunfinished: accommodate histedit quirk
Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
2013-07-25 02:17:52 -05:00
Matt Mackall
54bbf86a7b heads: fix children/descendants in doc (issue3992) 2013-07-25 00:54:49 -05:00
Alexander Plavin
da7dc49074 paper: fix rendering of the first tab in a line in Webkit (issue3990)
This fixes issue3990 for Webkit-browsers, and also older Opera versions.
Rendering in firefox is not changed.
2013-07-21 18:50:54 +04:00
Alexander Plavin
953f96e356 hgweb: fix duplication for some search queries
Given that N is maximum revision number in a repo, than if a revision with
number N-100n or N-100n+1 (for any integer n) is found with a hgweb search,
this revision is duplicated in search results.
2013-07-21 01:38:04 +04:00
Augie Fackler
9ec0b367aa sslutil: force SSLv3 on Python 2.6 and later (issue3905)
We can't (easily) force SSL version on older Pythons, but on 2.6 and
later we can force SSLv3, which is safer and widely supported. This
also appears to work around a bug in IIS detailed in issue 3905.
2013-07-24 14:51:13 -04:00
Augie Fackler
dfecda13f3 httpclient: update to revision 9517a2b56fe9 of httpplus (issue3905)
Includes upstream change "socketutil: force SSLv3 by default, as it is
safer" which should fix issue 3905.
2013-07-24 14:45:29 -04:00
Alexander Plavin
099a1df11b hgweb: call process_dates with a specified selector in ajax scroll
Now this function processes only newly added entries, and not old ones,
the amount of which can be much bigger.
2013-09-06 13:30:58 +04:00
Alexander Plavin
6ef3f6fe6f hgweb: add parentSelector argument to process_dates
Allow specifying parent selector of elements to process, useful for
incremental page updates.
2013-09-06 13:30:58 +04:00
Alexander Plavin
3fd64dca8e hgweb: optimize process_dates function
This function looped over every node due to getElementsByTagName('*'), instead
of using selectors. In this patch we use querySelectorAll('.age') and process
only these nodes, which is much faster and also doesn't require extra condition.

Browser compatibility isn't sacrificed: IE 8+, FF 3.5+, Opera 10+.
2013-09-06 13:30:58 +04:00
David Soria Parra
f7b7fb2df4 localrepo: make report level in repo.transaction configurable
repo.transaction always writes to stderr when a transaction aborts. In order to
be able to abort a transaction quietly (e.g shelve needs a temporary view on
the repo) we need to make the report level configurable.
2013-10-01 12:20:29 +02:00
Matt Mackall
7b8a7d221c merge with stable 2013-10-01 17:00:03 -07:00
FUJIWARA Katsunori
477426f110 discovery: abort also when pushing multiple headed new branch
Before this patch, pushing with --new-branch permits to create
multiple headed branch on the destination repository.

But permitting to create new branch should be different from
permitting to create multiple heads on branch.

This patch prevents from careless pushing multiple headed new branch,
and requires --force to push such branch forcibly.
2013-10-01 00:26:22 +09:00
Pierre-Yves David
b5bc8d504a branchmap: stop looking for stripped branch
Since repoview in 2.5 we do not make special call to `branchmap` when stripping.
We just recompute the branchmap from a lower subset that still has valid
branchmap. So I'm dropping this dead code.
2013-09-30 17:42:38 +02:00
Pierre-Yves David
64005d41eb branchmap: remove the droppednodes logic
It was unused. note how it is only extended if the list is empty. So it's always
empty at the end.

We could try to fix that, however this would part of the code is to be removed
in the next changeset as we do not run `branchmap` on truncated repo since
`repoview` in 2.5.
2013-09-30 17:31:39 +02:00
Pierre-Yves David
a58c8b0406 branchmap: fix blank line position
The blank line was after was after the `if` condition instead of before.
2013-09-30 15:52:37 +02:00
Alexander Plavin
0502c7c0ba hgweb: eliminate extra complexity in process_dates definition
There was an extra anonymous outer function, called immediately. It is removed
in this patch.
2013-09-06 13:30:58 +04:00
Siddharth Agarwal
4500805b25 util.h: backout cb07828e14e0 and 7d902369e960 for big-endian breakage
getbe32 and putbe32 need to behave differently on big-endian and little-endian
systems. On big-endian ones, they should be roughly equivalent to the identity
function with a cast, but on little-endian ones they should reverse the order
of the bytes. That is achieved by the original definition, but
__builtin_bswap32 and _byteswap_ulong, as the names suggest, swap bytes around
unconditionally.

There was no measurable performance improvement, so there's no point adding
extra complexity with even more ifdefs for endianncess.
2013-09-30 12:36:26 -07:00
Angel Ezquerra
65d42d2870 merge: let the user choose to merge, keep local or keep remote subrepo revisions
When a subrepo has changed on the local and remote revisions, prompt the user
whether it wants to merge those subrepo revisions, keep the local revision or
keep the remote revision.

Up until now mercurial would always perform a merge on a subrepo that had
changed on the local and the remote revisions. This is often inconvenient. For
example:

- You may want to perform the actual subrepo merge after you have merged the
parent subrepo files.
- Some subrepos may be considered "read only", in the sense that you are not
supposed to add new revisions to them. In those cases "merging a subrepo" means
choosing which _existing_ revision you want to use on the merged revision. This
is often the case for subrepos that contain binary dependencies (such as DLLs,
etc).

This new prompt makes mercurial better cope with those common scenarios.

Notes:

- The default behavior (which is the one that is used when ui is not
interactive) remains unchanged (i.e. merge is the default action).
- This prompt will be shown even if the ui --tool flag is set.
- I don't know of a way to test the "keep local" and "keep remote" options (i.e.
to force the test to choose those options).


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1378420708 -7200
#      Fri Sep 06 00:38:28 2013 +0200
# Node ID 2fb9cb0c7b26303ac3178b7739975e663075857d
# Parent  796d34e1b749b79834321ef1181ed8433a5515d9
merge: let the user choose to merge, keep local or keep remote subrepo revisions

When a subrepo has changed on the local and remote revisions, prompt the user
whether it wants to merge those subrepo revisions, keep the local revision or
keep the remote revision.

Up until now mercurial would always perform a merge on a subrepo that had
changed on the local and the remote revisions. This is often inconvenient. For
example:

- You may want to perform the actual subrepo merge after you have merged the
parent subrepo files.
- Some subrepos may be considered "read only", in the sense that you are not
supposed to add new revisions to them. In those cases "merging a subrepo" means
choosing which _existing_ revision you want to use on the merged revision. This
is often the case for subrepos that contain binary dependencies (such as DLLs,
etc).

This new prompt makes mercurial better cope with those common scenarios.

Notes:

- The default behavior (which is the one that is used when ui is not
interactive) remains unchanged (i.e. merge is the default action).
- This prompt will be shown even if the ui --tool flag is set.
- I don't know of a way to test the "keep local" and "keep remote" options (i.e.
to force the test to choose those options).
2013-09-06 00:38:28 +02:00
Augie Fackler
67877b90cc python2.4: fix imports of sub-packages of the email package
These all have an obvious comment so if/when we finally ditch Python
2.4 we can eradicate them easily.
2013-09-24 15:10:32 -04:00
Augie Fackler
3c989f7606 httpconnection: properly inject ssl_wrap_socket into httpclient (issue4038)
This causes httpclient to use the same SSL settings as the rest of
Mercurial, and adds an easy extension point for later modifications to
our ssl handling.
2013-09-20 09:16:07 -04:00
Augie Fackler
006064bcd2 sslutil: make keyfile and certfile arguments consistent between 2.6+ and 2.5- 2013-09-20 09:15:43 -04:00
Augie Fackler
ea14145f1e httpclient: import 4bb625347d4a to provide SSL wrapper injection
This lets us inject our own ssl.wrap_socket equivalent into
httpclient, which means that any changes we make to our ssl handling
can be *entirely* on our side without having to muck with httpclient,
which sounds appealing. For example, an extension could wrap
sslutil.ssl_wrap_socket with an api-compatible wrapper and then tweak
SSL settings more precisely or use GnuTLS instead of OpenSSL.
2013-09-20 09:15:09 -04:00
Augie Fackler
cb1c036518 sslutil: add a config knob to support TLS (default) or SSLv23 (bc) (issue4038)
Prior to this change, we default to SSLv23, which is insecure because
it allows use of SSLv2. Unfortunately, there's no constant for OpenSSL
to let us use SSLv3 or TLS - we have to pick one or the other. We
expose a knob to revert to pre-TLS SSL for the user that has an
ancient server that lacks proper TLS support.
2013-09-19 16:29:00 -04:00
Siddharth Agarwal
1addd98f97 cmdutil.bailifchanged: standardize error message for dirty working dir
This affects rebase, graft, histedit, and other similar commands.
2013-09-23 21:31:37 -07:00
Siddharth Agarwal
c84868311c merge: standardize error message for dirty subrepo 2013-09-23 20:53:14 -07:00
Siddharth Agarwal
88c86521eb merge: standardize error message for dirty working dir 2013-09-23 20:50:51 -07:00
Siddharth Agarwal
663145e3f0 update: standardize error message for dirty update --check
This and following patches will standardize the error message for dirty working
directories to "uncommitted changes".
2013-09-23 20:33:02 -07:00
Siddharth Agarwal
7213ad0e07 update: improve error message for dirty non-linear update with rev 2013-09-23 20:08:52 -07:00
Siddharth Agarwal
ecd3be8cef update: add error message for dirty non-linear update with no rev
Previously, the error message for a dirty non-linear update was the same (and
relatively unhelpful) whether or not a rev was specified. This patch and an
upcoming one will introduce separate, more helpful hints.
2013-09-23 20:07:30 -07:00
Siddharth Agarwal
55e7463f51 update: improve error message for clean non-linear update 2013-09-23 17:43:33 -07:00
Siddharth Agarwal
3bfd19f5c2 pull: for pull --update with failed update, print hint if any
An upcoming patch will add a hint to the abort message, and we don't want to
lose that here.
2013-09-23 19:02:32 -07:00
Alexander Plavin
8495f525a8 paper: edit search hint to include new feature description 2013-09-06 13:30:57 +04:00
Alexander Plavin
e94f8da7af paper: define searchhint message in map file and use it in other templates 2013-07-25 01:12:25 +04:00
Augie Fackler
a49f3fa2a8 mail: correct import of email module 2013-09-20 10:16:02 -04:00
Augie Fackler
897a535360 patch: correct import of email module 2013-09-20 10:15:51 -04:00
Augie Fackler
954e5e0c1c subrepo: move import of xml.minidom.dom to its own line for check-code 2013-09-20 10:15:37 -04:00
Alexander Plavin
7837b6944a paper: add infinite scrolling to graph by calling ajaxScrollInit at the page 2013-09-22 14:19:57 +04:00
Alexander Plavin
9bfb8fe898 hgweb: add graph mode of ajax response processing
While the default mode appends all the new entries to a container on the page,
the graph mode resizes canvas correctly, and repaints the graph to include
newly received data.
2013-09-20 00:42:13 +04:00
Alexander Plavin
f0c93d06c2 hgweb: make infinite scroll handling more generic and extensible
Namely, this allows the next page pointer to be not only revision hash given
in page code, but also any value computed from the value for previous page.
2013-09-22 14:18:23 +04:00
Alexander Plavin
ee2943c680 hgweb: add reset javascript function to Graph
It makes the Graph object to be in the same state as just after
the initialization. This will help to add infinite scrolling to graph view.
2013-09-06 13:30:59 +04:00
FUJIWARA Katsunori
c1e7da5d4f localrepo: make supported features manageable in each repositories individually
Before this patch, all localrepositories support same features,
because supported features are managed by the class variable
"supported" of "localrepository".

For example, "largefiles" feature provided by largefiles extension is
recognized as supported, by adding the feature name to "supported" of
"localrepository".

So, commands handling multiple repositories at a time like below
misunderstand that such features are supported also in repositories
not enabling corresponded extensions:

  - clone/pull from or push to localhost
  - recursive execution in subrepo tree

"reposetup()" can't be used to fix this problem, because it is invoked
after checking whether supported features satisfy ones required in the
target repository.

So, this patch adds the set object named as "featuresetupfuncs" to
"localrepository" to manage hook functions to setup supported features
of each repositories.

If any functions are added to "featuresetupfuncs", they are invoked,
and information about supported features is managed in each
repositories individually.

This patch also adds checking below:

  - pull from localhost: whether features supported in the local(= dst)
    repository satisfies ones required in the remote(= src)

  - push to localhost: whether features supported in the remote(= dst)
    repository satisfies ones required in the local(= src)

Managing supported features by the class variable means that there is
no difference of supported features between each instances of
"localrepository" in the same Python process, so such checking is not
needed before this patch.

Even with this patch, if intermediate bundlefile is used as pulling
source, pulling indirectly from the remote repository, which requires
features more than ones supported in the local, can't be prevented,
because bundlefile has no information about "required features" in it.
2013-09-21 21:33:29 +09:00
FUJIWARA Katsunori
495b98fa37 extensions: list up only enabled extensions, if "ui" is specified
Before this patch, "extensions.extensions()" always lists up all
loaded extensions. So, commands handling multiple repositories at a
time like below enable extensions unexpectedly.

  - clone from or push to localhost: extensions enabled only in the
    source are enabled also in the destination

  - pull from localhost: extensions enabled only in the destination
    are enabled also in the source

  - recursive execution in subrepo tree: extensions enabled only in
    the parent or some of siblings in the tree are enabled also in
    others

In addition to it, extensions disabled locally may be enabled
unexpectedly.

This patch checks whether each of extensions should be listed up or
not, if "ui" is specified to "extensions.extensions()", and invokes
"reposetup()" of each extensions only for repositories enabling it.
2013-09-21 21:33:29 +09:00
Matt Mackall
2513030d97 merge with stable 2013-09-23 11:37:06 -07:00
Alexander Plavin
38dc1f0139 templater: support using templates with non-standard names from map file
Allow to add arbitrarily-named entries to a template map file and then
reference them, to make it possible to deduplicate and simplify
templates code.
2013-09-22 13:52:18 +04:00
Alexander Plavin
e2c135afa3 hgweb: add link to force literal keyword search
This makes it possible to make keyword search in case the search query also
specifies an exact revision (like '1234' or 'abcdef'), or a revset expression.
2013-09-06 13:30:56 +04:00
Alexander Plavin
ce8b9c14cd raw: show current search mode name at search results 2013-09-06 13:30:56 +04:00
Alexander Plavin
d89a2b2e2e paper: show current search mode name at search results 2013-09-06 13:30:56 +04:00
Alexander Plavin
ce8859ee70 hgweb: pass variable with current search mode name to the search template 2013-09-06 13:30:56 +04:00
Alexander Plavin
50e5b58d11 paper: add reddish background to ajax error message 2013-09-06 13:30:58 +04:00
Alexander Plavin
9b7f2aaba4 paper: add simple animation to the loading indicator 2013-09-06 13:30:58 +04:00
Alexander Plavin
9e2716e461 hgweb: add CSS class to the last entry on a page
The entry which was last before an ajax load now has a specific CSS class
for easier styling.
2013-09-06 13:30:58 +04:00
Augie Fackler
f56544a399 commands: import hgweb.server in a way that 2to3 can rewrite 2013-09-19 15:28:26 -04:00
Alexander Plavin
29bb643339 hgweb: show message when an error occured during ajax loading 2013-09-06 13:30:58 +04:00
Alexander Plavin
6557099843 hgweb: show loading indicator while an ajax request is in process 2013-09-06 13:30:58 +04:00
Alexander Plavin
31f9685911 hgweb: show a message when there are no more entries in the list 2013-09-06 13:30:58 +04:00
Siddharth Agarwal
57e4e00df6 util.h: fix gcc version checking
gcc doesn't have a predefined GCC_VERSION macro.
2013-09-19 09:45:00 -07:00
Matt Mackall
4831f68cac merge with stable 2013-09-18 14:52:16 -05:00
Alexander Plavin
fb413116b4 paper: call ajaxScrollInit in shortlog
This just calls ajaxScrollInit at the shortlog page template with all needed
agruments. So, infinite scrolling is working now there.
2013-09-06 13:30:57 +04:00
Alexander Plavin
079f3668b4 hgweb: add ajaxScrollInit function, which does the ajax requests and processing
This function should be correctly called on a page, otherwise there is
no effect.
When called, it makes ajax requests for the next portion of changesets when the
user scrolls to the end. Also, when the monitor is high so that the
default amount of changesets isn't enough to fill it, multiple portions are
loaded if needed after the page load.
2013-09-18 22:44:12 +04:00
Wei, Elson
f78ba81b28 util.h: getbe32() and putbe32() use intrinsic function to improve performance
Refer to https://bugzilla.mozilla.org/show_bug.cgi?id=351557. It can improve
byte-swapping performance by intrinsic function.
2013-09-14 11:22:34 +08:00
Alexander Plavin
e340f5be55 hgweb: add appendFormatHTML javascript function
This is a convenient helper function to append some formatted HTML markup to a
DOM element.
2013-09-06 13:30:58 +04:00
Alexander Plavin
3b1957de7e hgweb: add removeByClassName javascript function
It removes all elements with specified class name from the document.
2013-09-06 13:30:58 +04:00
Alexander Plavin
48ee1c4c4f hgweb: add docFromHTML javascript function
It takes a string with HTML markup and creates DOM document from it.
The implementation is a part of code from
https://developer.mozilla.org/en-US/docs/Web/API/DOMParser#DOMParser_HTML_extension_for_other_browsers
2013-09-06 13:30:57 +04:00
Alexander Plavin
6bdbb6b69d hgweb: add makeRequest javascript function
This function performs an asynchronous HTTP request and calls provided
callbacks:
- onstart: request is sent
- onsuccess: response is received
- onerror: some error occured
- oncomplete: response is fully processed and all other callbacks finished
2013-09-06 13:30:57 +04:00
Alexander Plavin
1dc1ac5d6a hgweb: add format javascript function
It replaces placeholders like '%key%' with replacement values given.
2013-09-06 13:30:57 +04:00
Alexander Plavin
eee67f7bda hgweb: add nextentry variable for easy pagination in changelog
nextentry always contains the first entry not shown on current page (if there is
such entry)
2013-09-06 13:30:57 +04:00
Alexander Plavin
be32ad07fd hgweb: always compute all entries and latestentry in changelog
Get the whole list of entries before rendering instead of using lazy evaluation.
This doesn't affect the performance for usual case when the entries are shown
anyway. When both entries and latestentry are used, this performs unnoticeably
faster, and for pages which use only latestentry (quite uncommon case) it
would be a bit slower.
This change will make it possible to get the first entry of the next page easily
without computing the list twice.
2013-09-06 13:30:57 +04:00
David Soria Parra
bd9e14bcec templatefilters: add short format for age formatting
Implements a short output format for ages e.g. "1 second ago" is
abbrevated as "1s ago".
2013-09-17 17:42:13 +02:00
Alexander Plavin
3f021369d6 hgweb: remove unused argument of changelist function in changelog
This doesn't change the behavior as the argument isn't used anyway, and
it's a preparation to the next patches,
2013-09-06 13:30:57 +04:00
Sean Farley
89ec93306f context: move evolution functions from changectx to basectx
This is just a code move and corrects an overlook from my previous patch series
that assumed only a changectx would want this functionality.
2013-09-17 23:34:57 -05:00
Sean Farley
58d5c3fd06 context: use correct spelling of committable 2013-09-17 18:34:45 -05:00
Durham Goode
87385443b0 log: make file log slow path usable on large repos
Running "hg log <pattern or directory>" on large repos took a very, very long
time because it first read ctx.files() for every commit before even starting to
process the results.

This change makes the ctx.files() check lazy, which makes the command start
producing results immediately.
2013-09-10 19:49:34 -07:00
Jeff Sickel
c1824b83d9 plan9: update util.py for cpython 2.7 build 2013-09-13 15:40:04 -05:00
Siddharth Agarwal
f64894b936 parse_manifest: rewrite to use memchr
memchr is usually smarter than a simple for loop. With gcc 4.4.6 and glibc 2.12
on x86-64, for a 20 MB, 200,000 file manifest, parse_manifest goes from 0.116
seconds to 0.095 seconds.
2013-09-06 23:47:59 -07:00
Bryan O'Sullivan
87700a719c parsers: correctly handle a failed allocation 2013-09-16 12:17:55 -07:00
Bryan O'Sullivan
fb0fb16051 parsers: use Py_INCREF safely 2013-09-16 12:12:37 -07:00
Bryan O'Sullivan
3cfc802f1f parsers: state is a char, not an int 2013-09-16 12:10:28 -07:00
Wei, Elson
2400e9cc93 util.h: add stdint basic type definitions
MS C compiler v15 doesn't have stdint.h. Add basic int types those are defined
in stdint.h.
2013-09-13 09:54:43 +08:00
Alexander Plavin
e1392e4ce2 hgweb: add revset syntax support to search
This mode is used when all the conditions are met:
- 'reverse(%s)' % query string can be parsed to a revset tree
- this tree has depth more than two, i.e. the query has some part of
revset syntax used
- the repo can be actually matched against this tree, i.e. it has only existent
function/operators and revisions/tags/bookmarks specified are correct
- no revset regexes are used in the query (strings which start with 're:')
- only functions explicitly marked as safe in revset.py are used in the query

Add several new tests for different parsing conditions and exception handling.
2013-09-06 13:30:56 +04:00
Alexander Plavin
d519eef8ec revset: add a whitelist of DoS-safe symbols
'Safe' here means that they can't be used for a DoS attack for any given input.
2013-09-06 13:30:56 +04:00
Alexander Plavin
75dc3d55d6 revset: add helper function to get functions used in a revset parse tree
Will be used to determine whether all functions used in a hgweb search query
are allowed there.
2013-08-07 01:21:31 +04:00
Alexander Plavin
573b3e69b6 revset: add helper function to get revset parse tree depth
Will be used to determine if a hgweb search query actually uses
any revset syntax.
2013-08-09 22:52:58 +04:00
Siddharth Agarwal
b2531e9232 parsers: use a lookup table to convert hex to binary
This is a hotspot for parse_manifest. With this patch, for a 20 MB, 200,000
file manifest, parse_manifest goes down from 0.153 seconds to 0.116.
2013-09-07 00:59:24 -07:00
Siddharth Agarwal
64c41699fa revlog: remove _chunkbase since it is no longer used
This was introduced in 2011 for the lwcopy feature but never actually got used.
A similar hook can easily be reintroduced if needed in the future.
2013-09-06 23:05:33 -07:00
Siddharth Agarwal
bcd16c3892 revlog: move chunk cache preload from revision to _chunks
In case we don't have a cached text already, add the base rev to the list
passed to _chunks. In the cached case this also avoids unnecessarily preloading
the chunk for the cached rev.
2013-09-06 23:05:11 -07:00
Siddharth Agarwal
61f0e46895 revlog._chunks: inline getchunk
We do this in a somewhat hacky way, relying on the fact that our sole caller
preloads the cache right before calling us. An upcoming patch will make this
more sensible.

For a 20 MB manifest with a delta chain of > 40k, perfmanifest goes from 0.49
seconds to 0.46.
2013-09-06 22:57:51 -07:00
Siddharth Agarwal
b7abdca3c1 revlog.revision: fix cache preload for inline revlogs
Previously the length of data preloaded did not account for the interleaved io
contents. This meant that we'd sometimes have cache misses in _chunks despite
the preloading.

Having a correctly filled out cache will become essential in an upcoming patch.
2013-09-07 12:42:46 -07:00
Siddharth Agarwal
d24e970042 revlog: add a fast method for getting a list of chunks
This moves _chunkraw into the loop. Doing that improves revlog decompression --
in particular, manifest decompression -- significantly. For a 20 MB manifest
which is the result of a > 40k delta chain, hg perfmanifest improves from 0.55
seconds to 0.49 seconds.
2013-09-06 16:31:35 -07:00
Siddharth Agarwal
26051a2eee lrucachedict: implement clear() 2013-09-06 13:16:21 -07:00
Kevin Bullock
6e9f30dc4d merge with stable 2013-09-07 16:08:11 -05:00
Kevin Bullock
0903f71c12 merge with stable 2013-09-07 00:08:36 -05:00
Sean Farley
f65ef721e4 commitablefilectx: move children from workingfilectx 2013-08-15 13:42:56 -05:00
Sean Farley
f415142833 commitablefilectx: move parents from workingfilectx 2013-08-15 13:42:33 -05:00
Sean Farley
f31ebd758d commitablefilectx: move __nonzero__ from workingfilectx 2013-08-15 13:23:06 -05:00
Sean Farley
f38f187cbc commitablefilectx: move __init__ from workingfilectx 2013-08-15 13:12:50 -05:00
Sean Farley
608e9a1f09 commitablefilectx: add a class that will be used for mutable file contexts
Just like commitablectx, this will serve as a common place for code that will
be shared between workingfilectx and memfilectx.
2013-08-15 13:11:51 -05:00
Sean Farley
be4c3801e7 commitablectx: move dirs from workingctx 2013-08-14 16:40:34 -05:00
Sean Farley
e88dd1aaed commitablectx: move markcommitted from workingctx 2013-08-14 16:40:27 -05:00
Sean Farley
63bb66d577 commitablectx: move ancestors from workingctx 2013-08-14 16:37:59 -05:00
Sean Farley
402e7ea991 commitablectx: move walk from workingctx 2013-08-14 16:37:11 -05:00
Sean Farley
a895d35a4d commitablectx: move ancestor from workingctx 2013-08-14 16:37:01 -05:00
Sean Farley
72513aefb7 commitablectx: move flags from workingctx 2013-08-14 16:25:43 -05:00
Sean Farley
279f4b1ae7 commitablectx: move children from workingctx 2013-08-14 16:25:26 -05:00
Sean Farley
612da7c6bb commitablectx: move hidden from workingctx 2013-08-14 16:25:17 -05:00
Sean Farley
185f3bd11b commitablectx: move phase from workingctx 2013-08-14 16:24:59 -05:00
Sean Farley
03cb1762ec commitablectx: move bookmarks from workingctx 2013-08-14 16:24:33 -05:00
Sean Farley
286aebb4f4 commitablectx: move tags from workingctx 2013-08-14 16:24:16 -05:00
Sean Farley
2d15415c23 commitablectx: move extra from workingctx 2013-08-14 16:23:28 -05:00
Sean Farley
801497cf22 commitablectx: move closesbranch from workingctx 2013-08-14 16:23:16 -05:00
Sean Farley
a72a4edc59 commitablectx: move branch from workingctx 2013-08-14 16:23:02 -05:00
Sean Farley
8853002f4d commitablectx: move clean from workingctx 2013-08-14 16:22:42 -05:00
Sean Farley
c314be2c39 commitablectx: move ignored from workingctx 2013-08-14 16:22:32 -05:00
Sean Farley
32b922e204 commitablectx: move unknown from workingctx 2013-08-14 16:22:20 -05:00
Sean Farley
93bdfe006a commitablectx: move deleted from workingctx 2013-08-14 16:21:55 -05:00
Sean Farley
fe6d82e931 commitablectx: move removed from workingctx 2013-08-14 16:15:29 -05:00
Sean Farley
eba15bc142 commitablectx: move added from workingctx 2013-08-14 16:15:18 -05:00
Sean Farley
ecee868f25 commitablectx: move modified from workingctx 2013-08-14 16:14:58 -05:00
Sean Farley
cc0f5b38da commitablectx: move files from workingctx 2013-08-14 16:09:45 -05:00
Sean Farley
a8af5db123 commitablectx: move description from workingctx 2013-08-14 16:09:30 -05:00
Sean Farley
d3e48b9c15 commitablectx: move date from workingctx 2013-08-14 16:03:32 -05:00
Sean Farley
e01ebdbeaa commitablectx: move _date from workingctx 2013-08-15 10:57:43 -05:00
Sean Farley
ee2b1a6d19 commitablectx: move user from workingctx 2013-08-14 15:57:24 -05:00
Sean Farley
befd1a7b66 commitablectx: move _user from workingctx 2013-08-15 10:51:53 -05:00
Sean Farley
b9cfaf5912 commitablectx: move status from workingctx 2013-08-14 15:55:56 -05:00
Sean Farley
e5affa49cb commitablectx: move _status from workingctx 2013-08-14 15:41:22 -05:00
Sean Farley
ec4dfee71f commitablectx: move _manifest from workingctx 2013-08-14 15:34:18 -05:00
Sean Farley
99dae9c3c7 commitablectx: move _flagfunc from workingctx 2013-08-14 15:30:17 -05:00
Sean Farley
b14aec7508 commitablectx: move _buildflagfunc from workingctx 2013-08-14 15:29:48 -05:00
Sean Farley
55ce00c298 commitablectx: move __contains__ from workingctx 2013-08-14 15:29:09 -05:00
Sean Farley
c0f8038aa8 commitablectx: move __nonzero__ from workingctx 2013-08-14 15:28:43 -05:00
Sean Farley
15cba08e2b commitablectx: move __str__ from workingctx 2013-08-14 15:25:14 -05:00
Sean Farley
cbd1bba7bc commitablectx: move __init__ from workingctx 2013-08-14 15:24:58 -05:00
Sean Farley
3eacb95a31 commitablectx: add a class that will be used as a parent of mutable contexts
Currently, we have basectx that serves as a common ancestor of all contexts. We
will now add a new class commitablectx that will inherit from basectx and will
serve as a common place for code that will be shared between mutable contexts,
e.g. workingctx and memctx.
2013-08-14 15:02:08 -05:00
Sean Farley
18c9d5ae45 workingfilectx: remove unneeded __repr__ since it is now inherited 2013-08-14 13:32:56 -05:00
Sean Farley
f9c1629d6e workingfilectx: remove bogus comment 2013-08-15 13:09:34 -05:00
Sean Farley
e44c746203 workingfilectx: remove __str__ manifest since it is now inherited 2013-08-15 13:32:07 -05:00
Sean Farley
a1f0e066e5 basefilectx: use basectx __str__ instead of duplicating logic
This change allows us to only rely on one place to convert a context to a
string which will help eliminate duplicate code in context.py
2013-08-15 13:31:17 -05:00
Sean Farley
6ed862f6fd workingctx: remove unneeded manifest since it is now inherited 2013-08-14 13:41:09 -05:00
Sean Farley
1e8645944c workingctx: remove unneeded __repr__ since it is now inherited 2013-08-14 13:32:44 -05:00
Alexander Plavin
279ad45b7d hgweb: import the whole util module in webcommands instead of just one function
This is to allow using other functions from this module easily.
2013-09-03 20:02:53 +04:00
Alexander Plavin
0aac0cdac8 hgweb: add string constants for search mode names
It helps detecting mistakes in the mode names.
2013-09-04 19:40:04 +04:00
Siddharth Agarwal
4f7171d11d addremove: don't do full walks
Full walks are only necessary when the caller needs the list of clean files.
addremove by definition doesn't need them.

With this patch and an extension that produces a subset of results for
dirstate.walk when full is False, on a repository with over 200,000 files, hg
addremove drops from 2.8 seconds to 0.5.
2013-09-04 18:42:55 -07:00
Augie Fackler
06e82cc2f4 merge with mpm 2013-09-05 11:45:27 -04:00
Matt Mackall
71d7bb71a9 merge with stable 2013-09-03 18:08:27 -05:00
Siddharth Agarwal
cf3f4a0258 pack_dirstate: only invalidate mtime for files written in the last second
Previously we'd place files written in the last second in the lookup set. This
can lead to pathological cases where a file always remains in the lookup set if
it gets modified before the next time status is run.

With this patch, only the mtime of those files is invalidated. This means that
if a file's size or mode changes, we can immediately declare it as modified
without needing to compare file contents.
2013-08-17 20:48:49 -07:00
Siddharth Agarwal
d8f5823b88 dirstate.status: don't ignore symlink placeholders in the normal set
On Windows, there are two ways symlinks can manifest themselves:
1. As placeholders: text files containing the symlink's target. This is what
   usually happens with fresh clones on Windows.
2. With their dereferenced contents. This happens with clones accessed over NFS
   or Samba.

In order to handle case 2, 28af3e0c54f0 made dirstate.status ignore all symlink
placeholders on Windows. It doesn't ignore symlinks in the lookup set, though,
since those don't have the link bit set. This is problematic because it
violates the invariant that `hg status` with every file in the normal set
produces the same output as `hg status` with every file in the lookup set.

With this change, symlink placeholders in the normal set are no longer ignored.
We instead rely on code in localrepo.status that uses heuristics to look for
suspect placeholders.

An upcoming patch will test this out by no longer adding files written in the
last second of an update to the lookup set.
2013-08-31 10:20:15 -07:00
Siddharth Agarwal
036b5d2663 localrepo.status: ignore empty symlink placeholders
A symlink's target should never be empty in normal use. Solaris and some BSDs
do allow empty symlinks to be created (with varying semantics on dereference),
but a symlink placeholder that started off as empty is either

- going to be empty, in which case ignoring it is fine, since it's unchanged, or
- going to not be empty, in which case this check is irrelevant.
2013-08-31 10:16:06 -07:00
Sean Farley
8e759a3be5 dispatch: add ability to specify a custom pdb module as a debugger
This adds the ability to specify a config option, ui.debugger, to a custom pdb
module, such as ipdb, and have mercurial use that as its debugger. As long as
the value of ui.debugger is a loadable module with the set_trace and
post_mortem functions, then dispatch will be able to use the custom module.

Debugging _parseconfig is still available in the case of an error since it will
be caught with a default the value of pdb.post_mortem.
2013-07-25 22:28:34 -05:00
Sean Farley
480e39282c dispatch: move command line --config argument parsing to _runcatch()
Previously, command line parsing of --config arguments was done in
_dispatch. This means that it takes place after activating the debugger. In an
upcoming patch, we will add a ui.debugger setting so we need to have this
parsing done before _runcatch.
2013-07-13 16:33:07 -05:00
Angel Ezquerra
3a6f04eb6d subrepo: make submerge() return the merged substate
This will be useful when reusing submerge() to improve the handling of subrepos
on mq.


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1377117244 -7200
#      Wed Aug 21 22:34:04 2013 +0200
# Node ID 2defb5453f223c3027eb2f7788fbddd52bbb3352
# Parent  a5c90acff5e61aae714ba6c9457d766c54b4f124
subrepo: make submerge() return the merged substate

This will be useful when reusing submerge() to improve the handling of subrepos
on mq.
2013-08-21 22:34:04 +02:00
Wei, Elson
ec0c0007a1 localrepo: get value from the unfiltered caches should check if the attribute existed.
If the attribute existed already, it should be returned by getattr().
Otherwise, it will be evaluated again.
2013-08-07 09:59:45 +08:00
Alexander Plavin
eac9cb37ca hgweb: always run search when a query is entered (bc)
This changes the behavior for queries which point at a revision directly,
now the output is consistent to other cases: it results in only this matched
revision shown, not the log starting with it.
A new test checks this behaviour and fails for the old one.
2013-07-19 02:09:13 +04:00
Alexander Plavin
ea40ee8f63 hgweb: search() function supports direct pointing to revision
This doesn't change the behavior, as queries directly pointing to revisions
are not delegated to the search() function now.
2013-07-19 02:41:11 +04:00
Alexander Plavin
d2cc03584c hgweb: pass arguments which a function depends on explicitly in search
This changes makes clearer which arguments can a function depend on. Now all
the modified functions depend on the 'query' argument only, but future additions
will change it.
2013-08-22 16:42:10 +04:00
Alexander Plavin
44f0fb3b4e hgweb: add dynamic search function selection, depending on the query
This allows adding other specific search functions, in addition to current
keyword search.
2013-08-22 16:45:23 +04:00
Wojciech Lopata
9eb979f33b unionrevlog: extract 'baserevision' and 'baserevdiff' methods
This makes possible to use unionrevlog class with subclasses of revlog that
override revlog's 'revision' and 'revdiff' methods. In particular this change
is necessary to implement manifest compression, as it allows extension to
replace manifest class and override 'revision' amd 'revdiff' methods there.
2013-08-26 17:11:01 -07:00
Wojciech Lopata
53c13cb614 bundlerevlog: extract 'baserevision' method
This makes possible to use bundlerevlog class with subclasses of revlog
that override revlog's 'revision' method. In particular this change is necessary
to implement manifest compression, as it allows extension to replace manifest
class and override 'revision' method there.
2013-08-26 16:50:31 -07:00
Wojciech Lopata
3a79365ccc revlog: pass node as an argument of addrevision
This change will allow revlog subclasses that override 'checkhash' method
to use custom strategy of computing nodeids without overriding 'addrevision'
method. In particular this change is necessary to implement manifest
compression.
2013-08-19 11:25:23 -07:00
Wojciech Lopata
299c718f66 revlog: extract 'checkhash' method
Extract method that decides whether nodeid is correct for paricular revision
text and parent nodes. Having this method extracted will allow revlog
subclasses to implement custom way of computing nodes. In particular this
change is necessary to implement manifest compression.
2013-08-19 11:06:38 -07:00
Augie Fackler
16812584f2 httpclient: import 0d1b0a8bc549 to fix bug involving late-arriving RST after a response
After a day of hunting this defect, I'm now unable to reproduce the
bug without this patch applied. Regardless, this should fix the
problem I was observing with wireshark. Hopefully this fixes any
flakiness in the buildbot from http2.
2013-08-23 16:16:22 -04:00
Augie Fackler
2ae3ed4f92 Backed out changeset c65cc2c5ce84 2013-08-15 21:36:53 -04:00
Matt Mackall
1e6f803e48 debugfs: add hardlink support reporting 2013-08-14 12:42:22 -05:00
Dan Villiom Podlaski Christiansen
3f40ec5e82 obsolete: allow passing a revision to successorssets() 2013-08-04 13:43:39 +02:00
Sean Farley
2f686aa464 workingfilectx: inherit from basefilectx instead of filectx 2013-08-11 23:50:32 -05:00
Sean Farley
726ffb7462 basefilectx: move copies from filectx 2013-08-11 23:06:10 -05:00
Sean Farley
4ff2bdaf91 basefilectx: move ancestors from filectx 2013-08-11 23:05:50 -05:00
Sean Farley
6e02ef72e6 basefilectx: move ancestor from filectx 2013-08-11 23:05:08 -05:00
Sean Farley
9b77633abf basefilectx: move annotate from filectx 2013-08-11 23:03:33 -05:00
Sean Farley
d165e8257b basefilectx: move p2 from filectx 2013-08-11 23:00:11 -05:00
Sean Farley
98aa1d5037 basefilectx: move p1 from filectx 2013-08-11 22:59:10 -05:00
Sean Farley
7a7821cc2f basefilectx: move parents from filectx 2013-08-11 22:57:21 -05:00
Sean Farley
b4bfc8c2dc basefilectx: move cmp from filectx 2013-08-11 22:56:53 -05:00
Sean Farley
29424e6c91 basefilectx: move isbinary from filectx 2013-08-11 22:56:30 -05:00
Sean Farley
6173fa01da basefilectx: move path from filectx 2013-08-11 22:56:18 -05:00
Sean Farley
615c354555 basefilectx: move changectx from filectx 2013-08-11 22:56:02 -05:00
Sean Farley
7f9c8225f5 basefilectx: move manifest from filectx 2013-08-11 22:55:09 -05:00
Sean Farley
3d1241011d basefilectx: move phasestr from filectx 2013-08-11 22:54:58 -05:00