Commit Graph

8542 Commits

Author SHA1 Message Date
Matt Mackall
89c18ad8ce match: add some default args 2009-05-24 02:56:14 -05:00
Matt Mackall
532c58d931 match: change all users of util.matcher to match.match 2009-05-24 02:56:14 -05:00
Sune Foldager
13556c33e2 tests: add tests for new pre-push logic (issue736)
Co-contributor: Henrik Stuart <henrik.stuart@edlund.dk>
2009-05-23 17:04:41 +02:00
Sune Foldager
2161b139a6 named branches: improve pre-push logic (issue736)
Each named branch is considered separately, and the push is allowed if
no new branch heads are created for any named branch to be pushed.

Due to some tests's use of --debug, their output will change after this
addition. This has been fixed as well.

Co-contributor: Henrik Stuart <henrik.stuart@edlund.dk>
2009-05-23 17:04:31 +02:00
Henrik Stuart
a4975b3627 named branches: client branchmap wire protocol support (issue736)
Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-23 17:03:51 +02:00
Henrik Stuart
e3379206dc named branches: server branchmap wire protocol support (issue736)
The repository command, 'branchmap', returns a dictionary, branchname
-> [branchheads], and will be implemented for localrepo, httprepo and
sshrepo.

The following wire format is used for returning data:

branchname1 branch1head2 branch1head2 ...
branchname2 ...
...

Branch names are URL encoded to escape white space, and branch heads
are sent as hex encoded node ids. All branches and all their heads are
sent.

The background and motivation for this command is the desire for a
richer named branch semantics when pushing changesets. The details are
explained in the original proposal which is included below.


1. BACKGROUND

The algorithm currently implemented in Mercurial only considers the
graph theoretical heads when determining whether new heads are
created, rather than using the branch heads as a count (the algorithm
considers a branch head effectively closed when it is merged into
another branch or a new named branch is started from that point
onward).

Our particular problem with the algorithm is that we'd like to see the
following case working without forcing a push:

Upsteam has:

(0:dev) ---- (1:dev)
\
 `--- (2:stable)

Someone merges stable into dev:

(0:dev) ---- (1:dev) ------(3:dev)
\                         /
 `--- (2:stable) --------´

This can be pushed without --force (as it should).
Now someone else does some coding on stable (a bug fix, say):

(0:dev) ---- (1:dev) ------(3:dev)
\                          /
 `--- (2:stable) ---------´---------(4:stable)

This time we need --force to push.

We allow this to be pushed without using --force by getting all the
remote branch heads (by extending the wire protocol with a new
function).

We would, furthermore, also prefer if it is impossible to push a new
branch without --force (or a later --newbranch option so --force isn't
shoe-horned into too many disparate functions, if need be), except of
course in the case where the remote repository is empty.

This is what our patches accomplish.


2. ALTERNATIVES

We have, of course, considered some alternatives to reconstructing
enough information to decide whether we are creating new remote branch
heads, before we added the new wire protocol command.

2.1. LOOKUP ON REMOTE

The main alternative is to use the information from remote.heads() and
remote.lookup() to try to reconstruct enough graph information to
decide whether we are creating new heads. This is not adequate as
illustrated below.

Remember that each lookup is typically a request-response pair over
SSH or HTTP(S).

If we have a simple repository at the remote end like this:

(0:dev) ---- (1:dev) ---- (3:stable)
\
 `--- (2:dev)

then remote.heads() will yield [2, 3]. Assume we have nodes [0, 1, 2]
locally and want to create a new node, 4:dev, as a descendant from
(1:dev), which should be OK as 1:dev is a branch head.

If we do remote.lookup('dev') we will get [2]. Thus, we can get
information about whether a branch exists on the remote server or not,
but this does not solve our problem of figuring out whether we are
creating new heads or not.

Pushing 4:dev ought to be OK, since after the push, we still only have
two heads on branch a.

Using remote.lookup() and remote.heads() is thus not adequate to
consistently decide whether we are creating new remote heads (e.g. in
this situation the latter would never return 1:dev).

2.2. USING INCOMING TO RECONSTRUCT THE GRAPH

An alternative would be to use information equivalent to hg incoming
to get the full remote graph in addition to the local graph.

To do this, we would have to get a changegroup(subset) bundle
representing the remote end (which may be a substantial amount of
data), getting the branch heads from an instantiated bundlerepository,
deleting the bundle, and finally, we can compute the prepush logic.

While this is backwards compatible, it will cause a possibly
substantial slowdown of the push command as it first needs to pull in
all changes.


3. FURTHER ARGUMENTS IN FAVOUR OF THE BRANCHMAP WIRE-PROTOCOL EXTENSION

Currently, the commands incoming and pull, work based on the tip of a
given branch if used with "-r branchname", making it hard to get all
revisions of a certain branch only (if it has multiple heads). This
can be solved by requesting the remote's branchheads and letting the
revisions to be used with the command be these heads. This can be done
by extending the commands with a new option, e.g.:

hg pull -b branchname

which will be turned into the equivalent of:

hg pull -r branchhead1 -r branchhead2 -r branchhead3

We have a simple follow-up patch that can do this ready as well
(although not submitted yet as it is pending the acceptance of the
branch patch).


4. WRAP-UP

We generally find that the branchmap wire protocol extension can
provide better named branch support to Mercurial. Currently, some
things, like the initial push scenario in this mail, are fairly
counter-intuitive, and the more often you have to force push, the more
it is likely you will get a lot of spurious and unnecessary merge
nodes. Also, restricting incoming and pull to all changes on a branch
rather than changes on the tip-most head would be a sensible extension
to making named branches a first class citizen in Mercurial.
Currently, named branches sometimes feel like a late-coming unwanted
step-child.

We have run it in a production environment for a while, with fewer
multiple heads occurring in our repositories and fewer confused users
as a result.

Also, it fixes the long-standing issue 736.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-23 17:02:49 +02:00
Matt Mackall
620ef41579 Merge with -stable 2009-05-24 02:56:03 -05:00
Henrik Stuart
fa95cc9642 windows: make openhardlinks work
Despite the intention, openhardlinks would always evaluate to False.
2009-05-23 19:57:25 +02:00
Matt Mackall
d83f4579ab Merge with crew-stable 2009-05-23 12:31:28 -05:00
Matt Mackall
2c2304d400 revlog: fix reading of larger revlog indices on Windows 2009-05-23 11:53:23 -05:00
Patrick Mezard
1e0e3ba6d6 hgwebdir: fix [collections] evaluation under Windows
Virtual and real path separators are not the same under Windows.
2009-05-21 20:32:45 +02:00
Patrick Mezard
3e92f126a2 Add tests for qfold 2009-05-17 19:54:26 +02:00
David Frey
6d5875bc34 mq: abort qfold upon local changes (issue1662) 2009-05-16 16:20:37 -07:00
Martin Geisler
fc8a97dac3 changelog: refuse to add revisions with empty usernames
An empty username or a username with a "\n" will make the revision
text contain two "\n\n" sequences -> corrupt repository.

The problem is that changelog.read expects to find exactly one "\n\n"
separator and thus cannot unpack the revision.
2009-05-16 11:12:49 +02:00
Patrick Mezard
d3d9100f4a convert/bzr: fix symlinks target (issue1626/2) 2009-05-15 16:12:09 +02:00
Martin Geisler
aed75cf65f util: import random, missing since 5c703a28d882 2009-05-14 22:59:12 +02:00
Nicolas Dumazet
5b1c52187d inotify: Removing the unnecessary "inotifyserver" class variable. 2009-05-08 12:19:57 +09:00
Nicolas Dumazet
379b33ce17 inotify: set a flag so a failed inotify query doesn't get repeated.
If, for some reason, we can't get the inotify server to start, it's better to
disable inotify queries for the instance to avoid trying over and over to start
the server, which takes time. Just fall back on repo.status()
2009-05-06 01:40:03 +09:00
Mads Kiilerich
61b324eeb6 test-glog: Remove sed hack - '...$HGTMP...' isn't expanded anyway 2009-05-02 12:57:20 +02:00
Mads Kiilerich
9a2371955d test-convert-baz: hide GNU tar deprecation warning 2009-05-02 12:13:24 +02:00
Patrick Mezard
832313e290 rebase: fix bug where --keepbranches could leave wrong branch in dirstate
Report and original fix by Augie Fackler <durin42@gmail.com>
2009-05-01 12:26:37 +02:00
Sune Foldager
2f3ee06863 util.rename: use temporary file name for rename-targets on windows
Use a temporary file name as target for a forced rename on Windows. The
target file name is not opened at any time; just renamed into and then
unlinked. Using a temporary instead of a static name is necessary since
otherwise a hg crash can leave the file lying around, blocking future
attempts at renaming.
2009-04-29 09:30:28 +02:00
Patrick Mezard
bd41c37f9b convert/svn: keep latest and not oldest tag value 2009-04-29 21:44:25 +02:00
Martijn Pieters
0a6e43e789 Fix typeerror when specifying both --rebase and --pull 2009-04-29 11:39:49 +02:00
Matt Mackall
ee9ffff851 Merge with crew-stable 2009-04-26 16:49:47 -05:00
Patrick Mezard
ccca7abe8e convert/bzr: make it work with filemaps (issue1631)
The bzr converter maintains a child -> parents mapping and drop entries
whenever a child is read. It does not work with filemaps, getchangedfiles() may
be called more than once when filtered files belong to merge revisions.
getchanges() still works that way but it is not clear whether a similar issue
can arise when interacting with merges.
2009-04-26 11:35:53 +02:00
Patrick Mezard
62eea60737 convert/bzr: fix symlink handling (issue1626) 2009-04-24 10:34:11 +02:00
Matt Mackall
5c870ca09d Merge with crew-stable 2009-04-23 15:25:27 -05:00
Patrick Mezard
75233223fe convert/bzr: handle files replaced by directories (issue1623) 2009-04-23 15:07:05 +02:00
Paul Aurich
e41f434c50 convert/mtn: mtn does not record timezones, mark dates as UTC (issue1624) 2009-04-23 08:45:44 +02:00
Patrick Mezard
f7e8a4c038 convert/mtn: handle directory move into moved directory (issue1619/3) 2009-04-22 10:25:05 +02:00
Patrick Mezard
6bbead8918 convert/mtn: handle files moved in a moved directory (issue1619/2) 2009-04-21 22:31:16 +02:00
Matt Mackall
e612ed45dd Merge with crew-stable 2009-04-21 12:53:06 -05:00
Nicolas Dumazet
21b374a449 inotify: introduce debuginotify, which lists which paths are under watch 2009-04-22 00:37:35 +09:00
Nicolas Dumazet
ce74f8cde3 inotify: put STAT-specific query answer generation part in its own method 2009-04-22 00:23:40 +09:00
Paul Aurich
477feb0ff9 convert/mtn: handle subsecond commit dates (issue1616) 2009-04-21 15:57:15 +02:00
Patrick Mezard
551e0cf361 convert/mtn: handle new files in moved directories (issue1619)
Reported and investigated by Paul Aurich <paul@darkrain42.org>
2009-04-21 14:17:29 +02:00
Matt Mackall
56cd5d40bb Merge with crew-stable 2009-04-17 11:16:50 -05:00
Nicolas Dumazet
f83e3d685a inotify: change protocol so that different query types can be supported. 2009-04-17 20:10:47 +09:00
Patrick Mezard
0d13db37f7 extdiff: preserve execute-bit across copies (issue1562)
Bug report and test by Mads Kiilerich <mads@kiilerich.com>
2009-04-09 14:32:44 +02:00
Patrick Mezard
de41b9ace4 extdiff: merge node and working dir snapshot modes 2009-04-13 21:21:01 +02:00
Patrick Mezard
b3f0d7b5b8 convert/p4: win32 fixes
* cmd.exe does not know single quotes
* win32 does not like trailing whitespace very much. Trade test coverage for
  maintenance time and drop the trailing whitespaces tests.
2009-04-13 16:15:45 +02:00
Patrick Mezard
3ca6ee213a test-issue1438: make executable 2009-04-13 21:18:53 +02:00
Patrick Mezard
4764779700 context: fix workingctx.__contains__ 2009-04-13 19:47:11 +02:00
Patrick Mezard
b41a06764a httprepo: hide password in debug traces too 2009-04-13 14:33:47 +02:00
Steve Borho
7d99d0a5a5 hide passwords in httprepo error messages 2009-04-11 18:34:21 -05:00
Patrick Mezard
0dbcb77e35 convert/mtn: record changes from directory renames (issue1587)
Bug report and initial path by Pavel Volkovitskiy <int@mtx.ru>
2009-04-11 23:12:42 +02:00
Nicolas Dumazet
0d917847ce inotify: Separate query sending logic from Server starting.
Use a decorator around the public statusquery method of Client:

start_server(query_to_server):
    try:
        query_to_server()
    except QueryFailed:
        [error recovery, inotify Server (re)starting]
        query_to_server()

This way, introducing a new xxxquery Client method is easy:
one has only to code the protocol part of xxxquery, ignoring errors,
and decorating it using start_server to handle server recovery
and (re)starts
2009-04-07 19:30:01 +09:00
Nicolas Dumazet
73cefeb380 inotify: modular architecture for inotify clients
Put the socket init, query generation and response analysis in
a more generic client class.
2009-04-07 18:39:34 +09:00
Martin Geisler
a18ac5b4e2 setup: another newline if version could not be established. 2009-05-23 13:43:11 +02:00