Commit Graph

651 Commits

Author SHA1 Message Date
Matt Mackall
fd08adf4d6 commit: recurse into subrepositories 2009-06-15 02:45:38 -05:00
Matt Mackall
66b213eda6 repo: add internal support for sharing store directories
set .hg/sharedpath to point to the .hg to share with
2009-06-13 18:01:46 -05:00
Matt Mackall
da6d619643 repo: set up ui and extensions earlier 2009-06-13 14:44:59 -05:00
John Mulligan
8806103077 localrepo: remove 'closed' argument to heads(...) function
- repository heads are not associated with the closed attribute, so
remove it making the code in line with the concept.
- Fix functions that were calling heads with the parameter.
- Adjust webcommands.branches to include the concept of inactive
as well as open and closed branches
- Fix code and docstrings in commands to make the correct use of
closed branches & branch heads clearer
- Improve grammar of 'hg heads' help text (2nd submission)

this does not alter the cli for hg branches, that work is
still to be done
2009-06-10 19:11:49 -04:00
Henri Wiechers
4269cb82b8 cleanup: removed unused imports 2009-06-07 21:16:05 +02:00
Matt Mackall
5ae9b1fb50 commit: move some setup outside the lock 2009-06-04 16:21:03 -05:00
Matt Mackall
243b33c531 commit: rename wctx to cctx 2009-06-03 17:12:48 -05:00
Matt Mackall
8b6f125b5e commit: trade O(n^2) file checks for O(n^2) dir checks 2009-06-01 22:13:08 -05:00
Matt Mackall
fcb44e87db commit: move explicit file checking into repo.commit 2009-06-01 21:51:00 -05:00
Matt Mackall
7c83f8b030 commit: editor reads file lists from provided context 2009-06-01 14:51:47 -05:00
Matt Mackall
c1213eaf9d commit: drop the now-unused files parameter 2009-06-01 14:11:32 -05:00
Matt Mackall
914f8e938d tag: use match.exact for commit 2009-06-01 14:11:19 -05:00
Matt Mackall
c22dd49465 commit: apply force flag without files 2009-06-01 13:51:21 -05:00
John Mulligan
e094244749 localrepo: set heads and branchheads to be closed=False by default
The heads(...) and branchheads(...) functions will now only return closed
heads when explicitly asked for them. This will cause 'hg merge' to have
better behavior in the presence of a branch that has closed heads when no
explicit rev is passed.
2009-06-03 13:42:55 +02:00
Matt Mackall
37eaadf540 match: ignore return of match.bad
All users returned false, return can now be dropped
2009-05-31 17:54:18 -05:00
Martin Geisler
3f7c86dc69 wrap string literals in error messages 2009-05-31 01:30:16 +02:00
Adrian Buehlmann
7a0533d1fa localrepo: move comment 2009-05-28 08:29:40 +02:00
Simon Heimberg
1d6b2ca034 localrepo: use lock.release for single lock 2009-05-27 14:16:13 +02:00
Matt Mackall
1c30179455 lookup: check for dirstate damage on failure 2009-05-25 10:44:37 -05:00
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
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
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
Benoit Boissinot
5b1d4a56ec filelog encoding: move the encoding/decoding into store
the escaping of directories ending with .i or .d doesn't
really belong to filelog.

we put the encoding/decoding in store instead, for backwards
compat, streamclone and the fncache file format still uses the
partially encoded filenames.
2009-05-20 18:35:47 +02:00
Martin Geisler
0a365d5ca2 use 'x is None' instead of 'x == None'
The built-in None object is a singleton and it is therefore safe to
compare memory addresses with is. It is also faster, how much depends
on the object being compared. For a simple type like str I get:

            | s = "foo" | s = None
  ----------+-----------+----------
  s == None | 0.25 usec | 0.21 usec
  s is None | 0.17 usec | 0.17 usec
2009-05-20 00:52:46 +02:00
Benoit Boissinot
32cfb07e37 localrepo: update commit*() docstrings 2009-05-19 11:39:12 +02:00
Matt Mackall
2c76d48a96 commit: tidy up mergestate slightly 2009-05-18 17:36:24 -05:00
Matt Mackall
74e80399a4 commit: drop unneeded dirstate invalidate logic
We no longer touch the dirstate in the middle of a commit, so a
failing commit doesn't require invalidating the dirstate.
2009-05-18 17:36:24 -05:00
Matt Mackall
4a8855a861 commit: some tidying
- simplify handling of 'close'
- kill silly wlock=None
- sort/uniq files later
2009-05-18 17:36:24 -05:00
Matt Mackall
7e42b4325d commit: remove unused lock var 2009-05-18 17:36:24 -05:00
Matt Mackall
98aa07c578 commit: move description trimming into changelog 2009-05-18 17:36:24 -05:00
Matt Mackall
6489ae039f commit: simplify manifest commit 2009-05-18 17:36:24 -05:00
Matt Mackall
89cb6de980 commit: move editor outside transaction
The commit editor is now invoked before files and manifest are
committed. The editor is now run with only the wlock held and aborting
an edit no longer requires rolling back a transaction. Changes to
files during a commit still result in undefined behavior.

(This is preliminary work for committing subrepositories)
2009-05-18 17:36:24 -05:00
Martin Geisler
6668b0e4a5 localrepo: use set.update for bulk updates 2009-05-17 16:56:53 +02:00
Benoit Boissinot
491d11faff localrepo: use set instead of dict 2009-05-17 04:33:39 +02:00
Matt Mackall
1317ac7a01 commit: hoist the rest of the dirstate manipulation out of commitctx 2009-05-14 13:24:39 -05:00
Matt Mackall
c2aadfc41a commit: hoist up dirstate invalidate 2009-05-14 13:24:39 -05:00
Matt Mackall
a8b0644dec commitctx: use contexts more fully 2009-05-14 13:24:26 -05:00
Matt Mackall
3a18f346a9 commitctx: eliminate some variables 2009-05-14 13:21:20 -05:00
Matt Mackall
38ebdc6dd1 commit: move lots of commitctx outside of the repo lock 2009-05-14 13:21:20 -05:00
Matt Mackall
a9fbdd49f0 commit: combine _commitctx and commitctx, drop unused force argument 2009-05-14 13:21:20 -05:00
Matt Mackall
ebe3b0ebc3 commit: move commit editor to cmdutil, pass as function 2009-05-14 13:20:40 -05:00
Matt Mackall
ad33c59077 commit: push repo lock down into _commitctx 2009-05-14 13:20:40 -05:00
Matt Mackall
580ab4b4ab commit: move 'nothing changed' test into commit() 2009-05-14 13:20:40 -05:00
Matt Mackall
771b18c870 commit: drop unused p1 and p2 args 2009-05-14 13:20:40 -05:00
Matt Mackall
d229f38315 tag: drop unused use_dirstate and parent from _tag() 2009-05-14 13:20:40 -05:00
Matt Mackall
49e6e0b6c0 filecommit: swallow some bits from _commitctx, add _ 2009-05-14 13:20:40 -05:00
Matt Mackall
e77584d5e2 commitctx: replace wctx with ctx 2009-05-14 13:20:40 -05:00
Matt Mackall
32a69c4899 commitctx: replace two dirstate vars with working 2009-05-14 13:20:40 -05:00
Matt Mackall
f0bc29419d commitctx: simplify locking
(spotted by Simon Heimberg)
2009-05-14 13:20:40 -05:00