Commit Graph

18 Commits

Author SHA1 Message Date
Sune Foldager
f9f5488566 push: add --new-branch option to allow intial push of new branches
Compare this to --force which allows anything to be pushed. With --new-branch,
only changesets to named branches not present on the and changesets not
introducing additional heads on existing branches are allowed.

Developed by
  Henrik Stuart <henrik.stuart@edlund.dk>
  Sune Foldager <cryo@cyanite.org>
2010-05-21 15:22:29 +02:00
Sune Foldager
a81e6a76a5 prepush: rewrite most of the code from scratch
For servers with branchmap support, the algorithm now works as follows:

1. A list of branches in outgoing changesets is created.
2. Using the remote branchmap, a check for new branches is performed.
3. A map (from branch to head list) of locally known remote heads before
   the push is created, and one which, after step 4, will contain the locally
   known remote heads after the push.
4. The post-push head map is updated with the outgoing changesets, using the
   branch cache update mechanism.
5. A check for new heads is performed, by comparing the length of the head list
   before and after push, for each branch. If there are new heads, an error
   depending on whether or not there are incoming changes on the branch,
   is returned.
6. If the push is allowed, a warning is written if there are incoming changes
   on any branches involved in the push.

For old servers, an algorithm similar to step 4-6 above is used to check for
new topological heads only.

Two bugs are also fixed:
1. Sometimes you would be allowed to push new branch heads without --force.
   A test for this case was added.
2. You would get the "note: unsynced remote changes!" warning if there were any
   incoming changesets, even if they were on unrelated branches.
2010-04-15 21:59:21 +02:00
Peter Arrenbrecht
da567ef452 prepush: add more test cases 2010-04-14 19:35:54 +02:00
Sune Foldager
62eb1177d6 prepush: fix bug in warning message selection
In certain situations you would be told "you should pull and merge" even when
there is nothing to pull.
2010-04-14 19:11:35 +02:00
Sune Foldager
b66624019c partial backout of 5a81f112887e and add tests (issue2131)
The tests are due to Peter Arrenbrecht
2010-04-08 19:46:47 +02:00
Sune Foldager
7acd5cb299 push: fix bug in prepush logic and its tests 2010-03-26 17:02:36 +01:00
Benoit Boissinot
4de7d9563f prepush: warn about every new outgoing named branch, not just the first 2010-02-07 00:43:24 +01:00
Sune Foldager
9318efef10 fix bug in prepush logic involving merge changesets
When creating new branches and merging them into existing ones, you would
sometimes be able to push some changesets (the existing branches) without using
--force, even when that creates a new head on the remote.

A test which triggers the error has been added.
2009-11-30 14:58:52 +01:00
Henrik Stuart
0175cbe7e2 tests: fix inadvertent use of existing test repository 2009-10-17 15:40:34 +02:00
Sune Foldager
30958eab97 push: fix subtle bug in prepush logic
A test case demonstrating the bug has been added.
Contributed by Henrik Stuart and Sune Foldager.
2009-09-23 18:56:09 +02: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
Benoit Boissinot
fc997dfbf2 fix calculation of new heads added during push with -r
fix issue450
2006-12-17 05:00:22 +01:00
Thomas Arendsen Hein
f6d571d204 Don't report an error when closing heads during local push (issue387) 2006-12-05 23:25:28 +01:00
Matt Mackall
303ec3f442 correct remote heads test in prepush 2006-11-19 16:32:36 -06:00
Vadim Gelfer
e5df462a15 deprecate 'update -m'. use 'merge' instead. 2006-05-14 21:07:34 -07:00
Thomas Arendsen Hein
7563660d88 Fix hg push and hg push -r sometimes creating new heads without --force.
Fixing issue179.

The algorithm checks if there not more new heads on the remote side than heads
which become non-heads due to getting children.

Pushing this repo:
    m
   /\
3 3a|
|/  /
2 2a
|/
1

to a repo only having 1, 2 and 3 didn't abort requiring --force before.

Added test cases for this and some doc strings for used methods.
2006-03-29 22:35:21 +02:00
Thomas Arendsen Hein
1b244c77c7 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Some systems show "Thu Jan 01" instead of "Thu Jan  1", which breaks tests.
Using "1000000" yields "Mon Jan 12 13:46:40 1970", which looks the same on
all systems.
2006-03-13 13:05:41 +01:00
mpm@selenic.com
7c0d9a3cf7 Warn on pushing unsynced repo or adding new heads
By popular demand
2005-08-01 23:17:22 -08:00