Commit Graph

24516 Commits

Author SHA1 Message Date
Ryan McElroy
7500433d6e revsets: show current revset abort behavior 2015-04-13 21:06:21 -07:00
Gregory Szorc
cbc3d51109 tests: move blackbox testing of tags to test-tags.t
We're going to refactor tags cache shortly. It is easier to test the
blackbox logging if these tests are in test-tags.t.
2015-04-13 13:28:37 -04:00
Gregory Szorc
bc524f4cd2 tests: move mock blackbox extension into own file
Having all blackbox log testing in test-blackbox.t isn't scalable. Move
the mock blackbox extension into its own file so we can start to move
blackbox logging into other tests.
2015-04-13 09:36:33 -04:00
Pierre-Yves David
f0ebfa4a59 shelve: acquire lock in the right order
Text book says that 'wlock' should be acquired before 'lock'.
Caught through developer warning.
2015-04-12 14:59:31 -04:00
Pierre-Yves David
812e82cf4f check-commit: be more picky about detection of wrong bug tag
The check-commit script search for "bug" withing bracket and ask people to use
(issueXXXX) instead. The test was too wide and matching any "(+b+u+g"sequence.
2015-04-12 14:54:53 -04:00
Michael O'Connor
824e19a989 discovery: don't compute allfuturecommon when it won't be used
In repos with many changesets, the computation of allfuturecommon
can take a significant amount of time.  Since it's only used if
there's an obsstore, don't compute it otherwise.
2015-04-13 09:54:36 -04:00
Martin von Zweigbergk
63f47478d7 treemanifest: separate flags for trees in memory and trees on disk
When we start writing tree manifests with one manifest revlog per
directory, it will still be nice to be able to run tests using tree
manifests in memory but writing to a flat manifest to a single
revlog. Let's break the current '_usetreemanifest' flag on the revlog
into '_treeinmem' and '_treeondisk'. Both are populated from the same
config, but after this change, one can temporarily hard-code
_treeinmem=True to see that tests still pass.
2015-04-10 18:54:33 -07:00
Martin von Zweigbergk
320b8b5298 manifestdict: drop empty-string argument when creating empty manifest
manifestdict() creates an empty manifestdict, so let's consistently
use that instead of explicitly parsing an empty string (which does
result in an empty manifest).
2015-04-10 18:13:01 -07:00
Mike Hommey
50ad077324 lazymanifest: fix memory leak in lmiter_iterentriesnext() after e3b881ea6832 2015-04-12 06:51:13 -07:00
Pierre-Yves David
9ec3313e25 revert: do not requires '--all' if '--interative' is present
The '--all' option have been introduced in 0a81b7721d8f (August 2006), most
probably to prevent user shooting themselves in the foot. As the record process
will let you, view and select the set of files and change you want to revert, I
feel like the '--all' flag is superfluous in the '--interactive' case.
2015-04-11 12:26:54 -04:00
Pierre-Yves David
fd6a1d024d bundle2: drop the experimental hooks
The series at a17556fc1521::77b112363d48 introduced generic transaction level
hooking. This makes the experimental bundle2 specific hooks redundant, we drop
them.
2015-04-09 16:18:38 -04:00
Pierre-Yves David
393230ee25 bundle2: advertise bundle2 by default
That way, any new server will be ready to accept bundle2 payload. The decision
for the client to use it is still off by default so this is not turning bundle2
everywhere.

We introduce a new kill switch for this in case stuff goes wrong.
2015-04-10 15:41:33 -04:00
Matt Harbison
de8806d8c6 subrepo: convert the os.path references in git to vfs
There are a handful of os.path references in the free functions at the top of
the module that will be trickier to remove.
2015-02-07 12:57:40 -05:00
FUJIWARA Katsunori
1de7607de0 subrepo: use vfs.removedirs instead of os.removedirs
This patch also removes useless composing absolute path by "repo.wjoin()".
2015-04-11 00:47:09 +09:00
FUJIWARA Katsunori
798e1be41f vfs: add removedirs 2015-04-11 00:47:09 +09:00
FUJIWARA Katsunori
d376c990a1 util: add removedirs as platform depending function
According to 6b1369445b7b introducing "windows._removedirs()":

    If a hg repository including working directory is a reparse point
    (directory symlinked or a junction point), then using
    os.removedirs will remove the reparse point erroneously.

"windows._removedirs()" should be used instead of "os.removedirs()" on
Windows.

This patch adds "removedirs" as platform depending function to replace
"os.removedirs()" invocations for portability and safety
2015-04-11 00:47:09 +09:00
FUJIWARA Katsunori
85f9891920 subrepo: use vfs.unlink instead of os.remove
This patch also removes useless composing absolute path by
"os.path.join()".
2015-04-11 00:47:09 +09:00
FUJIWARA Katsunori
3a9e7a3504 subrepo: use vfs.rmtree instead of shutil.rmtree
This patch also removes useless "shutil" import.
2015-04-11 00:47:09 +09:00
FUJIWARA Katsunori
51fdbd9c2a vfs: add rmtree
This duplicates "onerror()" function from "svnsubrepo.remove()" for
equivalence of replacing in subsequent patch.

This "onerror()" function for "shutil.rmtree()" was introduced by
094a056562e7, which avoids failure of removing svn repository on
Windows.
2015-04-11 00:47:09 +09:00
FUJIWARA Katsunori
406aa94dc6 subrepo: use vfs.readdir instead of os.listdir to avoid expensive stat calls
"kind" information given from "vfs.readdir()" makes expensive stat
calls "os.path.isdir()" and "os.path.islink()" useless.
2015-04-11 00:47:09 +09:00
Alexander Drozdov
0af407fa48 editor: prefer 'intermediate-source' extra to use for HGREVISION environment variable
Revision 7fbf0ef28408 ('graft: record intermediate grafts in extras') introduced
'intermediate-source' extra which refers to the closest graft source.

As 'intermediate-source' extra provides more detailed information about the source
changeset than 'source' one, it is better to prefer the first one to use as a
value of HGREVISION environment variable for an editor.
2015-04-10 08:05:50 +03:00
Pierre-Yves David
af7d20b000 bundle2: rename format, parts and config to final names
It is finally time to freeze the bundle2 format! To do so we:
- rename HG2Y to HG20,
- drop "b2x:" prefix from all part names,
- rename capability to "bundle2-exp" to "bundle2"
- rename the hook flag from 'bundle2-exp' to 'bundle2'
2015-04-09 16:25:48 -04:00
Martin von Zweigbergk
4c187a8462 manifestdict: extract condition for _intersectfiles() and use for walk()
The condition on which manifestdict.matches() and manifestdict.walk()
take the fast path of iterating over files instead of the manifest, is
slightly different. Specifically, walk() does not take the fast path
for exact matchers and it does not avoid taking the fast path when
there are more than 100 files. Let's extract the condition so we don't
have to maintain it in two places and so walk() can gain these two
missing pieces of the condition (although there seems to be no current
caller of walk() with an exact matcher).
2015-04-08 09:38:09 -07:00
Martin von Zweigbergk
2592408744 manifestdict.walk: remove now-redundant check for match.files()
When checking whether we can take the fast path of iterating over
matcher files instead of manifest files, we check whether
match.files() is non-empty. However, now that return early for
match.always(), it can only be empty when there are only
include/exclude patterns, but in that case anypats() will be True, so
it's already covered. This makes manifestdict.walk() more similar to
manifestdict.matches().
2015-04-07 22:40:25 -07:00
Martin von Zweigbergk
67897f5b0b manifest.walk: special-case match.always() for speed
This cuts down the run time of

  hg files -r . > /dev/null

from ~0.850s to ~0.780s on the Firefox repo. Note that
manifest.matches() already has the corresponding optimization.
2015-04-07 21:08:23 -07:00
Martin von Zweigbergk
fc5772e190 manifest.walk: use return instead of StopIteration in generator
Using "return" within a generator is supposedly more Pythonic than
raising StopIteration.
2015-04-07 22:36:17 -07:00
Yuya Nishihara
7de01412a9 archive: look for first visible revision to build repo identity (issue4591)
No test for the case where all revisions are hidden because "archive" command
aborts if the target revision is null.
2015-04-08 23:30:02 +09:00
Yuya Nishihara
1209d3b6f0 largefiles: use common function to build content of .hg_archival.txt
This fixes the missing "changessincelatesttag" field introduced by
7203a55cb648.
2015-04-08 22:42:37 +09:00
Yuya Nishihara
58c060fcfc test-largefiles: verify content of .hg_archival.txt 2015-04-08 22:38:46 +09:00
Yuya Nishihara
d2b9482bcd archive: extract metadata() closure to module-level function
This function will be reused in largefiles.
2015-04-08 22:37:03 +09:00
Yuya Nishihara
553dc1006c archive: use ctx object consistently to build meta data 2015-04-08 22:31:04 +09:00
Yuya Nishihara
e4b8aeed9f templatekw: have {manifest} use ctx.manifestnode() for consistency
changeset_printer was updated at dbba1dc6a539 to not access changeset by
index.
2015-04-08 21:04:06 +09:00
FUJIWARA Katsunori
39cf1ce825 subrepo: use vfs.reljoin instead of os.path.join 2015-04-10 00:36:42 +09:00
FUJIWARA Katsunori
95d1624750 subrepo: inline reporelpath into abstractsubrepo._relpath to centralize logic
"reporelpath()" is referred only from "abstractsubrepo._relpath()".
2015-04-10 00:36:42 +09:00
FUJIWARA Katsunori
11f7c1e0a8 subrepo: add _relpath field to centralize subrelpath logic
This patch adds propertycache-ed "_relpath" field to
"abstractsubrepo", to centralize "subrelpath" logic into it.

Now, "subrelpath()" can always return "_relpath" field of the
specified subrepo object, because it is ensured that subrepo object
has it. To reduce changes in this patch, "subrelpath()" itself is
still kept, even though it seems to be redundant.

This is also a part of eliminating "os.path.*" API invocations for
"Windows UTF-8 Plan".
2015-04-10 00:36:42 +09:00
FUJIWARA Katsunori
0372433bb6 subrepo: add wvfs field to access the working directory via vfs
This patch doesn't create vfs object in "abstractsubrepo.__init__()"
but adds propertycache-ed "wvfs" field, because the latter can:

  - delay vfs instantiation until it is actually needed

  - allow to use "hgsubrepo._repo.wvfs" as "wvfs"

    "hgsubrepo._repo" is initialized after
    "abstractsubrepo.__init__()" invocation, and passing
    "hgsubrepo._repo.wvfs" to "abstractsubrepo.__init__()" is
    difficult.
2015-04-10 00:36:42 +09:00
FUJIWARA Katsunori
f594576ac1 subrepo: change arguments of abstractsubrepo.__init__ (API)
This patch passes "ctx" and "path" instead of "ui" to
"abstractsubrepo.__init__()" and stores them as "_ctx" and "_path" to
use them in subsequent patches.

This also removes redundant field initializations in the constructor
of classes derived from "abstractsubrepo".
2015-04-10 00:36:42 +09:00
Drew Gottlieb
6d2651f8ba treemanifest: optimize treemanifest._walk() to skip directories
This makes treemanifest.walk() not visit submanifests that are known not to
have any matching files. It does this by calling match.visitdir() on
submanifests as it walks.

This change also updates largefiles to be able to work with this new behavior
in treemanifests. It overrides match.visitdir(), the function that dictates
how walk() and matches() skip over directories.

The greatest speed improvements are seen with narrower scopes. For example,
this commit speeds up the following command on the Mozilla repo from 1.14s
to 1.02s:
  hg files -r . dom/apps/

Whereas with a wider scope, dom/, the speed only improves from 1.21s to 1.13s.

As with similar a similar optimization to treemanifest.matches(), this change
will bring out even bigger performance improvements once treemanifests are
loaded lazily. Once that happens, we won't just skip over looking at
submanifests, but we'll skip even loading them.
2015-04-07 15:18:52 -07:00
Matt Harbison
6a81772054 import-checker: force 'fcntl', 'grp', 'pwd', and 'termios' to stdlib modules
These are Unix only, and caused these additional warnings on Windows if they
aren't hardcoded as stdlib:

  mercurial/posix.py mixed imports
     stdlib:    errno, getpass, os, socket, stat, sys, tempfile
     relative:  grp, pwd, unicodedata
  mercurial/posix.py mixed imports
     stdlib:    re
     relative:  fcntl
  mercurial/posix.py mixed imports
     stdlib:    array
     relative:  termios

Additionally, this was missing on Windows:

  mercurial/crecord.py mixed imports
     stdlib:    fcntl, termios
     relative:  curses


https://docs.python.org/2/library/fcntl.html
https://docs.python.org/2/library/grp.html
https://docs.python.org/2/library/pwd.html
https://docs.python.org/2/library/termios.html
2015-04-08 22:31:50 -04:00
Matt Harbison
8fffff85bf import-checker: allow *.pyd based stdlib modules
These are Windows dlls, and eliminate the following import check diffs that are
not on Unix:

  mercurial/changegroup.py mixed imports
     stdlib:    os, struct, tempfile, zlib
     relative:  bz2
  mercurial/encoding.py mixed imports
     stdlib:    locale, os
     relative:  unicodedata
2015-04-08 22:23:51 -04:00
Martin von Zweigbergk
89a5bacd48 manifest.walk: join nested if-conditions
This makes it more closely match the similar condition in
manifestdict.matches().
2015-04-07 22:35:44 -07:00
Martin von Zweigbergk
eff6f72dc8 manifestdict: inline _intersectfiles()
The _intersectfiles() method is only called from one place, it's
pretty short, and its caller has to be aware when it's appropriate to
call it (when the number of files in the matcher is not too large), so
let's inline it.
2015-04-08 10:01:31 -07:00
Martin von Zweigbergk
1430a21750 manifestdict._intersectfiles: avoid one level of property indirection
We have already bothered to extract "lm = self._lm", so let's use "lm"
where possible.
2015-04-08 10:03:59 -07:00
Martin von Zweigbergk
0d47282240 manifestdict.matches: avoid name 'lm' for a not-lazymanifest 2015-04-08 10:06:05 -07:00
Mathias De Maré
8b3f5b98e3 commands: add ui.statuscopies config knob
statuscopies enables viewing of copies and moves in 'hg status' by default.
2015-03-24 21:25:57 +01:00
Yuya Nishihara
7941359b9d changelog: inline revlog.__contains__ in case it is used in hot loop
Currently __contains__ is called only by "rev()" revset, but "x in cl" is a
function that is likely to be used in hot loop. revlog.__contains__ is simple
enough to duplicate to changelog, so just inline it.
2015-04-04 22:30:59 +09:00
FUJIWARA Katsunori
15fa88d61c bookmarks: show detailed status about outgoing bookmarks
Before this patch, "hg outgoing -B" shows only difference of bookmarks
between two repositories, and it isn't user friendly.

This patch shows detailed status about outgoing bookmarks at "hg
outgoing -B".

To avoid breaking backward compatibility with other tool chains, this
patch shows status, only if --verbose is specified,
2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
f7b7fe9dcb bookmarks: show detailed status about incoming bookmarks
Before this patch, "hg incoming -B" shows only difference of bookmarks
between two repositories, and it isn't user friendly.

This patch shows detailed status about incoming bookmarks at "hg
incoming -B".

To avoid breaking backward compatibility with other tool chains, this
patch shows status, only if --verbose is specified,
2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
a3fd38b1fc bookmarks: enhance test of showing detail about incoming/outgoing bookmarks 2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
71b8a887f2 bookmarks: show outgoing bookmarks more exactly
Before this patch, "hg outgoing -B" shows only bookmarks added
locally. Then, users can't know about bookmarks below before "hg push"
execution.

  - deleted locally (even though it may be added remotely from "hg pull" view)
  - advanced locally
  - diverged
  - changed (= remote revision is unknown for local)

This patch shows such bookmarks, too.
2015-04-08 02:56:19 +09:00