Commit Graph

17748 Commits

Author SHA1 Message Date
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
Pierre-Yves David
4c13968496 histedit: create obsolescence markers in deterministic order
I arbitrary use the revnum of the precursor because it sound a right order.
2012-10-16 16:56:14 +02: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
Thomas Arendsen Hein
4ab7bd04fc histedit: max(x, key=y) and min(x, key=y) are not available in python 2.4
Use sorted(x, key=y)[-1] or sorted(x, key=y)[0] instead.
2012-10-16 16:04:28 +02: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
Pierre-Yves David
e5dbcdf7b1 histedit: do not use "min" on ctx
It does not crash but does not compare revision number at all. We actually
remove any call to min because the list is already topologically sorted.
2012-10-14 23:49:28 +02:00
Pierre-Yves David
29277d440c histedit: clean abort when there is nothing to edit 2012-10-14 23:58:02 +02:00
Pierre-Yves David
c86f3a557a histedit: rename revs in ctxs inside the between function
The variable content is actually contexts, not revision numbers.
2012-10-15 00:05:16 +02:00
Pierre-Yves David
0cada00ea6 test: fix invalid redirection for histedit text
Appending to the file is wrong, we want new content.
2012-10-14 23:03:58 +02: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
Pierre-Yves David
f329dd0261 histedit: refuse to edit public changeset
Public changeset are immutable. This changeset enforce that in histedit.
2012-10-12 21:41:08 +02:00
Pierre-Yves David
2237d9bd3f histedit: ignores hidden revision when checking for orphaned nodes
We do not want hidden revision to block histedit. They are already "dead"
and we do not care about dead orphans. see similar changeset 40db49347807 for
rebase.
2012-09-27 14:00:52 +02:00
Pierre-Yves David
3607c94328 histedit: simplify computation of edited set (issue3620)
This complex code can be replaced by two simple revset calls.
2012-10-10 06:27:06 +02:00
Pierre-Yves David
e4f0351734 histedit: add obsolete support
When the obsolete feature is enabled, histedit creates obsolescence marker
instead of stripping replaced changesets.

For now, we keep stripping temporary nodes created along the way.
2012-09-27 13:59:48 +02:00
Pierre-Yves David
c922450686 histedit: replace various nodes lists with replacement graph (and issue3582)
This changeset rewrites the change tracking logic of histedit to record every
operation it does. Tracked operations record the full list of "old" node that
will eventually be removed to the list of new nodes that replace it. Operations
on temporary nodes are tracked too. Dropped changesets are also recorded as an
"old" node replacement by nothing. This logic is similar to the obsolescence
marker one and will be used for this purpose in later commit.

This new logic implies a big amount of change in the histedit code base.

histedit action functions now always return a tuple of

    (new-ctx, [list of rewriting operations])

The old `created`, `replaced` and `tmpnodes` are no longer returned and stored
during histedit operation. When such information is necessary it is computed
from the replacement graph. This computation is done in the `processreplacement`
function.

The `replacemap` is also dropped. It is computed at the end of the command from the
graph.  The `bootstrapcontinue` methods are altered to compute this different kind of
information.

This new mechanism requires much less information to be written on disk.

Note:

    This changes allows a more accurate bookmark movement. bookmark on dropped
    changeset are now move of their parent (or replacement of their parent)
    instead of their children.

    This fix issue3582
2012-10-11 08:36:50 +02:00
Matt Mackall
5047212c31 merge with durin42 2012-10-12 15:52:59 -05:00
Pierre-Yves David
8b8b1a2322 histedit: update bookmark movement notice
New format is:

    histedit: moving bookmarks <bookmark> from <old> to <new>
2012-10-10 05:54:38 +02:00
Pierre-Yves David
4a01290b0d histedit: simplify computation of newchildren during --continue
We are now checking for any changesets between the previous `parentctx` and the
current working directory parent. If the current working directory parent is
inconsistent, we abort.

This change is useful as it simplifies the --continue process, easing upcoming
changes.

While working on this changeset, I spotted an unhandled corner case. This corner
case is now documented and have an appropriate issue in the tracker (issue3655).
However, the corner case is still unhandled. handling this test case would
required some additional work:

- actually decide what the proper behavior should be:
- change content of "histedit-state" to add missing data necessary to detect
  the situation
- add proper testcase,

But leaving the case unhandled is "okay":

- this is not a regression,
- this is not the purpose of the current series,
- the freeze was near and I had more critical stuff to attend to,
- this is a simple but non trivial, (see above)
2012-10-10 06:20:14 +02:00
Adrian Buehlmann
0375a75090 test-fncache: enable for Windows
Should also fix
http://hgbuildbot.kublai.com/builders/vfat%20hg%20tests/builds/182
2012-10-03 19:43:10 +02:00
Bryan O'Sullivan
b5a37656e8 contrib: add a commit synthesizer for reproducing scaling problems
This adds two new commands:

- analyze examines an existing repo and writes out a statistical
  description of its properties that contains no identifying
  information.

- synthesize creates new commits based on the description generated
  by analyze.

The intention is that a repo constructed using synthesize will have
properties that are vaguely statistically similar to the originating
repo, but entirely random content.

This can be useful for forecasting performance as a repo grows, and
for developers who want to find bottlenecks in proprietary repos
to which they do not have access.
2012-10-08 15:57:21 -07: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
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
David Soria Parra
fb0ed62638 mq: update bookmarks during qrefresh
Bookmarks are updated during qpop and qpush, but they are not updated
during qrefresh. This behaviour makes it hard to work on an evolving
changeset at the head of a branch. qrefresh should update all bookmarks
that point to the refreshed commit with the new nodeid.
2012-10-01 02:44:46 +02: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
FUJIWARA Katsunori
159588adfd scmutil: reorder newly added functions for vfs support in dictionary order
Definition functions for vfs support in dictionary order increases
readability/maintainability, because there are functions which invoke
file API:

  - with same name: "os.listdir" and "osutil.listdir", for example
  - with ambiguous names: "os.mkdir" and "util.makedirs", for example
2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
92325ab8e2 store: rename field name from "opener" to "vfs" in internal classes for fncache
These fields are used only in store module, so keeping "self.opener"
for backward compatibility like as "localrepository" class is not
needed.
2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
5a20ad61ef store: rename argument name from "op"(ener) to "vfs" 2012-10-09 01:41:55 +09:00
FUJIWARA Katsunori
ec48173940 verify: rename "hasmanifest" variable for source code readability
Before this patch, there are two ambiguous variables: "havemf" and
"hasmanifest".

"havemf" means whether there are any "manifest" entries.

"hasmanifest" means whether there are any "changelog" entries
referring to "manifest" entry.

This patch renames from "hasmanifest" to "refersmf" to clear
difference from "havemf".
2012-10-04 01:24:05 +09:00
FUJIWARA Katsunori
beefacf118 verify: use appropriate local variable in "checkentry()"
Before this patch, "checkentry()" internal function uses both
"node"(argument of itself) and "n"(defined in outer of it) variables.

Because all callers of "checkentry()" use "n" to refer the object
which is passed to "checkentry()" as "node", both can refer same
object in "checkentry()". So, "checkentry()" works correctly.

But such usage is not good for independence of "checkentry()".

This patch replaces "n" in "checkentry()" with "node".
2012-10-04 01:24:05 +09:00
FUJIWARA Katsunori
07219f1b5d verify: use appropriate node information to show verification error
Before this patch, verify module shows verification error message
below:

    unknown parent 2 <HASH_OF_P2> of <HASH_OF_P1>

even though it should show:

    unknown parent 2 <HASH_OF_P2> of <HASH_OF_TARGET>

This patch uses appropriate node information.
2012-10-04 01:24:05 +09:00
FUJIWARA Katsunori
29424945df help: add information about recovery from corruption to help of "verify"
Before this patch, there is no information about what users should (or
can) do for recovery from corruption of repositories.

This patch adds URL of the Mercurial Wiki page explaining about
recovery from corruption.
2012-10-04 01:24:05 +09:00
Pierre-Yves David
db63606246 hidden: remove tags use in hidden computation
Tags initially prevented revision to be hidden. It seemed a bad idea to have
tags refer to revisions that one can't see. But proper filtering of hidden
revisions excludes them from tag computation. Coming changelog filtering will do
that. Anyway, tags that really matter will likely be public and therefore not
hidden.

The current working directory parent and bookmarked revision are still not
hidden. Bookmarks were likely automatically moved at rewrite time, bookmarks
that remain on obsolete revisions were probably moved there on purpose.
2012-09-03 14:35:31 +02:00
Pierre-Yves David
3fc4db8ab5 clfilter: do not use tags cache if there are filtered changesets
If there are filtered changesets the cache is not valid. We'll have to cache
tags for filtered state too, but for now recomputing the tags is enough.
2012-09-03 14:35:05 +02:00
Pierre-Yves David
9ed771c48f clfilter: do not use branchmap cache if there are filtered changesets
If there are filtered changesets the cache is not valid. We'll have to cache
branchmap for filtered state too, but for now recomputing the branchmap is
enough.
2012-09-03 14:34:19 +02:00
Bryan O'Sullivan
2f5fcdb4f3 Merge 2012-10-08 09:55:41 -07:00
Idan Kamara
4d2c787f1d fancyopts: don't show a traceback on invalid integer values 2012-10-08 15:35:16 +02:00
Bryan O'Sullivan
6c7ac8b7de setup: calculate version more correctly
The old calculation code failed to properly identify revs that
weren't tagged, leaving us with a version of "unknown" most of the
time during development.
2012-10-05 13:44:52 -05:00
Bryan O'Sullivan
52fd9933cb mq: improve qqueue message with patches applied (issue3036) 2012-10-04 17:00:32 -05:00
Thomas Arendsen Hein
024d25472d subrepo, hghave: use "svn --version --quiet" to determine version number
svn --version --quiet is implemented since svn 0.14.1 (August 2002)
and prints just the version number, not the long output (21 lines)
of "svn --version".

Additionally I expect this output format to be more stable, at least
it is not changed with different translations.
2012-10-04 16:52:20 +02:00
Thomas Arendsen Hein
b722606b41 merge with crew-stable 2012-10-04 16:44:28 +02:00