Commit Graph

9295 Commits

Author SHA1 Message Date
Adrian Buehlmann
7d6b329175 bookmarks: replace code-redundant comment with something more useful 2012-10-18 22:35:28 +02:00
Adrian Buehlmann
8d5e4c41c9 bookmarks: remove another uneeded return 2012-10-18 22:33:58 +02:00
Kevin Bullock
c9487f44be update: remove unnecessary argument check 2012-05-05 15:30:54 -05:00
Idan Kamara
1d290d6e7b grep: colorize all fields
Colors were picked in accordance to GNU grep.
2012-10-14 20:27:55 +02:00
Pierre-Yves David
99b5dd9737 clfilter: remove use of xrange in revset
For changelog level filtering to take effect it need to be used for any
iteration. Some remaining use of `xrange` in revset code is replace by proper
use of `changelog.revs` or direct iteration over changelog.
2012-10-08 15:54:53 +02:00
Matt Mackall
b170ca8911 repair: use node to track post-strip bookmark target
Revision numbers are unstable when non-consecutive revs are stripped.
2012-10-17 15:37:25 -05:00
Wagner Bruna
795c3947e9 wireproto: fix pushkey hook failure and output on remote http repo
Over http, a failed pushkey hook simply crashed the server, and
successful hook output was never sent to the client.
2012-10-15 18:37:34 -03:00
Sean Farley
26d22253ab phases: add a phase and phasestr method to file context 2012-10-16 17:09:50 -05:00
Kevin Bullock
6d33154670 bookmarks: simplify code
Remove some unnecessary return statements and collect some checks into
one place. As requested by Thomas Arendsen Hein <thomas@intevation.de>.
2012-10-17 12:15:23 -05:00
David Soria Parra
da3fc820fa bookmarks: abort when incompatible options are used (issue3663)
Options like --delete and --rename are incompatible with each
other. In this case we abort. We do not abort if the result is a nullop.
Nullops are: '--delete --inactive', '--delete --force'.
2012-10-17 11:50:47 +02:00
David Soria Parra
a224be4441 bookmarks: check bookmark format during rename (issue3662) 2012-10-17 08:44:49 +02:00
Sean Farley
a5e6af16d7 color: add additional changeset.phase label to log.changeset and log.parent
This allows the user to set different colors for each phase, e.g.

[color]
changeset.public = blue
changeset.draft = green
changeset.secret = red

In addition, this doesn't affect current configuration for custom log.changeset
colors, but rather adds the option for users that want to visually see which
changesets are amendable.
2012-10-16 13:35:58 -05:00
Augie Fackler
05dca2a258 http2: make it possible to connect w/o ssl on port 443
The fix is just to make sure we always pass use_ssl=False to non-SSL
connections.
2012-10-16 18:05:33 -05:00
Pierre-Yves David
abf7ca7986 branchpoint: remove useless intermediate set creation
We don't need to compute the set of all branchpoints. We can just check the
number of children that element of subset have. The extra work did not seems to
had particular performance impact but the code is simpler this way.
2012-10-15 17:43:05 +02:00
Pierre-Yves David
dcd3550206 clfilter: use changelog to iterate over the repo in branchpoint
Otherwise filtered changesets may cause false positives in `branchpoint()`.
2012-10-15 17:42:40 +02:00
Adrian Buehlmann
ac772dd620 store: fncache may contain non-existent entries (fixes e76e2e89c766) 2012-10-12 10:52:33 +02:00
Adrian Buehlmann
637c55b9a8 store: add new _exists helper function on fncachestore 2012-10-12 10:52:32 +02:00
Adrian Buehlmann
f86ce05929 store: move __contains__() implementation from class fncache into fncachestore
This restores the previous semantics of fncache.__contains__().

(a followup to e76e2e89c766)
2012-10-12 10:40:09 +02:00
Pierre-Yves David
2bf3f1f2c0 obsolete: flip obstore.successors and obsolete.precursors
People were confused by the fact `obstore.precursors` contained marker allowing
to find "precursors" and vice-versa.

This changeset changes their meaning to:

- precursors[x] -> set(markers on precursors edges of x)
- successors[x] -> set(markers on successors edges of x)

Some documentation is added to clarify the situation.
2012-10-16 15:39:12 +02:00
Pierre-Yves David
e7bae9b381 obsolete: add example of marker usage in the documentation
Recent discussion with Augie Fackler pointed the lack of such example in the
documentation.
2012-10-14 23:33:10 +02:00
Pierre-Yves David
57d4155cf7 obsolete: cheap detection of nullid as successors
Nullid as successors create multiple issues:

- Nullid revnum is -1, confusing algorithm that use revnum unless you add
  special handling in all of them.
- Nullid confuses "divergent" changeset detection and resolution. As you can't
  add any successors to Nullid without being in even more troubles

Fortunately, there is no good reason to use nullid as a successor. The only
sensible meaning of "succeed by nullid" is "dropped" and this meaning is already
covered by obsolescence marker with empty successors set.

However, letting some nullid successors to slip in may cause terrible damage in
such algorithm difficult to debug. So I prefer to perform and clear detection of
of such pathological changeset. We could be much smarter by cleaning up nullid
successors on the fly but it would be much for expensive. As core Mercurial does
not create any such changeset, I think it is fine to just abort when suspicious
situation is detected.

Earlier experimental version created such changesets, so there are some out
there.  The evolve extension added the necessary logic to clean up its mess.
2012-10-15 00:12:06 +02:00
Siddharth Agarwal
a5e71891bd commands: don't infer repo for commands like update (issue2748)
Maintain a whitelist of commands to infer the repo for instead. The whitelist
contains those commands that take file(s) in the working dir as arguments.
2012-10-16 11:43:15 -07:00
Siddharth Agarwal
a03ea859ec hgweb: make the escape filter remove null characters (issue2567) 2012-10-15 09:43:34 -07:00
David M. Carr
c447f272ec bookmarks: when @ bookmark diverges, don't double the @ sign (BC)
This changeset treats the bookmark "@" as a special case for the naming of
divergent bookmarks, as per the tables below.  For the <no alias> case, the
actual suffix will vary, depending on what suffixes are already in use.

Before:
Bookmark | Remote     | Divergent Bookmark
--------------------------------------
foo      | bar        | foo@bar
foo      | <no alias> | foo@1
@        | bar        | @@bar
@        | <no alias> | @@1

After:
Bookmark | Remote     | Divergent Bookmark
--------------------------------------
foo      | bar        | foo@bar
foo      | <no alias> | foo@1
@        | bar        | @bar
@        | <no alias> | @1

This case is likely to be more common now that c1644655c164 has made the "@"
bookmark have special meaning to clone.

The change in behavior was discussed on the mailing list in the thread below:
http://markmail.org/thread/rwedgxp7le5j2h2f
2012-10-15 23:54:54 -04:00
Matt Mackall
5b51bfe8c9 vfs: use self.write to write symlink placeholders
The existing write() path is much more robust than the hand-rolled
version that was inlined here.
2012-10-13 15:10:39 -05:00
Matt Mackall
c3b65813c8 vfs: backout fchmod change from 0232a1565a3d
Only works on Unix with Python >= 2.6, need a different fix.
2012-10-13 15:03:00 -05:00
Kevin Bullock
6012647380 clone: update to @ bookmark if it exists 2012-03-21 16:53:39 -05:00
Christian Ebert
15900b9e01 templatefilters: avoid traceback caused by bogus date input (issue3344)
Wrap datefilters which split date texts with util.parsedate.

We do not abort, as the bogus date must have been given by the user.
2012-08-10 20:37:20 +01:00
Ivan Andrus
3a1f5d9617 revsets: add branchpoint() function
The branchpoint() function returns changesets with more than one child.
Eventually I would like to be able to see only branch points and merge
points in a graphical log to see the topology of the repository.
2012-08-13 21:50:45 +02:00
Matt Mackall
98c3be16ec vfs: use fchmod for _fixfilemode
On general principle, we should use fchmod instead of chmod to avoid
security pitfalls, although none is likely possible here.
2012-10-11 22:58:34 -05:00
FUJIWARA Katsunori
bcd74985e5 store: invoke "osutil.listdir()" via vfs
This patch invokes "osutil.listdir()" via vfs object.

The function added newly to "abstractvfs" is named not as "listdir()"
but as "readdir()", because:

  - "os.listdir()" seems to be more familiar as "listdir()" than
    "osutil.listdir()"

  - "osutil.listdir()" returns also type of each files like
    "readdir()" POSIX API: even though "d_type" field of "dirent"
    structure is defined mainly only on BSD/Linux

This patch invokes "osutil.listdir()" via "rawvfs" object to avoid
filename encoding, because the path passed to "osutil.listdir()"
shouldn't be encoded.

This patch also omits importing "osutil" module, because it is no
longer used.
2012-10-09 16:17:55 +09:00
smuralid
d42ff23b07 log: speed up hg log for untracked files (issue1340)
'hg log' on untracked files tends to be fairly slow. The root cause is that we end up using the 'slowpath' when we can't find a revlog for the files listed. This could happen if the file in question is an untracked file, or it is a directory.
This diff tries to speed up 'hg log' (by avoiding the slowpath) for files if we can determine if that file is not (and was never) a directory. We use the previously added store.__contains__ methods to test if the directory exists (or existed) in the store.
To avoid changing any existing semantics, this 'optimization' kicks in only when none of the files listed as arguments to the hg log command exist in the store.
2012-09-13 23:50:45 -07:00
smuralid
ef33964734 store: add a contains method to fncachestore
Adds a __contains__ method to fncachestore to check for file/dir existence (using fncache.__contains__).
Also extends fncache.__contains__ to check for directories (by prefix matching)
2012-09-13 17:57:43 -07:00
smuralid
49e0e33106 store: add a contains method to basicstore
Adds a __contains__ method to basicstore that checks if a file/dir is present in the store
2012-09-13 17:00:34 -07:00
Tomasz Kleczek
8b2ac179dd branchcache: fetch source branchcache during clone (issue3378)
Recomputing branch cache on clone may be expensive,
therefore if possible we fetch it along with the data.

- If the clone is performed by copying, we just copy branchcache file.
- If we localrepo.clone and streaming then we follow the procedure:
  1. Fetch branchmap from the remote
  2. Fetch the actual data.
  3. Find the latest rev within branch heads (tip at the time of
     branchmap fetch)
  4. Update the cache for the revs in [remotetip+1, tip]

This way we ensure that the branchcache is correct even in case
of races with commits.
2012-10-03 13:19:53 -07:00
Mads Kiilerich
588e53b65c spelling: fix minor spell checker issues 2012-10-10 01:29:56 +02:00
Thomas Arendsen Hein
1c896206b1 merge with crew-stable 2012-10-09 09:45:44 +02:00
Matt Mackall
38701c0855 dirstate: handle large dates and times with masking (issue2608)
Dates and times that are outside the 31-bit signed range are now
compared modulo 2^31. This should prevent it from behaving badly with
very large files or corrupt dates while still having a high
probability of detecting changes.
2012-10-08 17:50:42 -05:00
Kevin Bullock
564144c8dd bookmarks: deactivate current bookmark if no name is given
a0d2da57b726 added this help text to hg bookmark:

  If no NAME is given, the current active bookmark will be marked inactive.

But that was never actually the case.

Originally spotted by Idan Kamara <idankk86@gmail.com>.
2012-10-08 00:19:30 +02:00
Thomas Arendsen Hein
42db02b2a5 subrepo: setting LC_MESSAGES only works if LC_ALL is empty or unset
For example LC_ALL=de_DE.utf-8 would cause the version check to fail,
because "svn, Version 1.6.12 (r955767)" with a capital "V" will be printed.
Using "svn --version --quiet" would only print the version number, but then
matching other messages, e.g. "Committed revision" would fail.
2012-10-04 16:30:40 +02:00
Thomas Arendsen Hein
b144254849 clone: activate bookmark specified with --updaterev 2012-10-02 09:26:42 +02:00
Tomasz Kleczek
7063833db6 lock: fixed race condition in trylock/testlock (issue3506)
Suppose the following scenario:

1. Process A takes the lock (e.g. on commit).
2. Process B wants to grab the lock. Since lock file exists
   the exception is raised. In the catch block the testlock
   function is called.
3. Process A releases the lock.
4. Process B tries to read the lock file as a part of testlock
   function. This results in OSError (ENOENT) and since we're
   not inside the exception handler function this is propagated
   and aborts the whole operation.

To fix this we now check in testlock function whether lock file
actually exists and if not (i.e. if readlock fails) we just return.
2012-09-27 14:38:03 -07:00
Adrian Buehlmann
d768b47592 exewrapper: adapt for legacy HackableMercurial
We give up using CPython's PythonXX.lib import libraries (and Python.h), and
now "manually" call the LoadLibrary() / GetProcAddress() Windows API's instead.

If there is a "hg-python" subdirectory (the canonical directory name for
HackableMercurial's private Python copy) next to the hg.exe, we load the
pythonXX.dll from there (feeding an absolute path to LoadLibrary) and we set
Py_SetPythonHome() to that directory, so that the Python libraries are used
from there as well.

If there is no "hg-python" subdir found next to the hg.exe, we do not feed an
absolute path to LoadLibrary. This continues to allow to find a globally
installed Python DLL, as before this change - that is, without having to edit,
delete, rename, or configure anything.

Note that the hg.exe built is still bound to a *specific* major version of the
pythonXX.dll (e.g. python27.dll). What version it is, is inferred from the
version of the python interpreter that was used when calling setup.py. For
example

  C:\python27_x86\python.exe setup.py build_hgexe -i --compiler=mingw32

builds a hg.exe (using the mingw32 tool chain) bound to (x86) Python 2.7. And

  C:\python27_x86\python.exe setup.py build_hgexe -i

builds the same using the Microsoft C compiler/linker. (Note that the Microsoft
toolchain combined with x64 CPython can be used to build an x64 hg.exe.)

setup.py is changed to write the name of the pythonlib into the generated header
file "mercurial/hgpythonlib.h", which is #included by exewrapper.c. For a Python
2.7 build, it for example contains:

  #define HGPYTHONLIB "python27"

exewrapper.c then uses HGPYTHONLIB for the name of the Python dll to load.

We don't want to track mercurial/hgpythonlib.h, so we add it to .hgignore.
2012-08-07 11:04:41 +02:00
Matt Mackall
1fc6275c72 store: restore getsize method
This method was created for subclassing.
2012-10-08 16:46:11 -05:00
Matt Mackall
12037daac2 templater: drop redundant return in _flatten 2012-10-08 16:21:24 -05:00
FUJIWARA Katsunori
adaaef3263 store: invoke "os.path.isdir()" via vfs
This patch invokes "os.path.isdir()" via "rawvfs" object to avoid
filename encoding, because the path passed to "os.path.isdir()"
shouldn't be encoded.

This patch newly adds "self.rawvfs" field only to "basicstore" and
"encodedstore", because "fncachestore" has "self.rawvfs" already.
2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
e94a854ac3 store: replace invocation of "getsize()" by "vfs.stat()"
This patch replaces invocation of "getsize()", which calls "os.stat()"
internally, by "vfs.stat()".

The object referred by "self.rawvfs" is used internally by
"_fncachevfs" and doesn't encode filename for each file API invocation.

This patch invokes "os.stat()" via "self.rawvfs" to avoid redundant
filename encoding: invocation of "os.stat()" via "self.vfs" hides
filename encoding and encoding result from caller, so it is not
appropriate, when both encoded and non-encoded filenames should be
yield.

Even though changeset 89eacc6262af improved stream_out performance by
"self.pathsep + path", this patch replaces it by
"os.path.join(self.base, path)" of vfs. So, this may increase cost to
join path components.

But this shouldn't have large impact, because:

  - such cost is much less than cost of "os.stat()" which causes
    system call invocation

  - "datafiles()" of store object is invoked only for "hg manifest
    --all" or "hg verify" which are both heavy functions
2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
e100683d0e store: invoke "os.stat()" for "createmode" initialization via vfs
This just replaces "os.stat()" invocation: refactoring around
"self.createmode" and "vfs.createmode" initialization is omitted.

This patch also newly adds "stat()" function to "abstractvfs".
2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
f503d56231 vfs: define "join()" in each classes derived from "abstractvfs"
This patch defines "join()" in each classes derived from "abstractvfs"
except "vfs", which already defines it.

This allows all vfs instances to be used for indirect file API
invocation.
2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
2e01d06780 store: initialize vfs field first to use it for initialization of others
This patch initializes "vfs" field in the constructor of each store
classes to use it for initialization of others.

In this patch, "self.vfs.base" is used to initialize "self.path",
because redo join of path components for "self.path" is redundant.
2012-10-09 01:41:55 +09:00