Commit Graph

45 Commits

Author SHA1 Message Date
Siddharth Agarwal
262d694589 pull: list bookmarks before pulling changesets (issue3873)
Consider a bookmark B that exists both locally and remotely. If B is updated
remotely, and then a pull is performed where the pull set contains the new
location of B, the bookmark is updated locally. However, if remote B is
updated in the middle of a pull to a location not in the pull set, the
bookmark won't be updated locally at all.

To fix this, list bookmarks before pulling in changesets, not after. This
still leaves a race open if B gets moved in between listing bookmarks and
pulling in changesets, but the race window is much smaller. Fixing the race
properly would require a bundle format upgrade.

test-hook.t's output changes because we no longer do two listkeys calls during
pull, just one.

test-pull-http.t's output changes because we now search for bookmarks before
searching for changes.
2013-03-29 19:54:06 -07:00
Kevin Bullock
921b868783 bookmarks: don't use bookmarks.listbookmarks in local computations
bookmarks.listbookmarks is for wire-protocol use. The normal way to get
all the bookmarks on a local repository is repo._bookmarks.
2013-01-27 14:24:37 -06:00
Kevin Bullock
95941cafe7 bookmarks: show active bookmark even if not at working dir
If the active bookmark doesn't point at a parent of the working dir
(e.g. a pull moved it out from under us), we nonetheless show it as
active. This follows on 13ea5e437ff8 in removing the dichotomy (at least
in the UI) between "current" and "active" bookmarks.
2013-01-27 11:29:14 -06:00
Kevin Bullock
883809c825 test-bookmarks-pushpull.t: don't set bookmark active unnecessarily
The test in question doesn't have anything to do with having an active
bookmark. This change makes the test change the two bookmarks it affects
without making them active. It clears the way for adding a test for
updating to an active bookmark that moved out from under us.
2013-01-21 12:58:59 -06:00
Mads Kiilerich
4ff2b11ec9 bookmarks: process pulled remote bookmarks in sorted order 2013-01-15 02:59:12 +01:00
Mads Kiilerich
8cb1e5208b debugpushkey: list keys sorted 2012-12-16 20:50:57 +01:00
Adrian Buehlmann
ba8bb9b602 clone: show status "updating to bookmark @"
if bookmark @ is not on the default branch, we show

  updating to bookmark @ on branch <name>
2012-10-29 14:02:30 +01:00
Matt Mackall
1433ad1921 bookmarks: backed out new message from changeset ce6f3f8fb8a2
Not strictly a bugfix, hasn't achieved consensus yet.
2012-10-27 16:39:47 -05:00
Thomas Arendsen Hein
34208f8c42 clone: print bookmark name when clone activates a bookmark
Similar to the message that prints the checked out branch name.
Without this, the user might accidentally move the @ bookmark.
2012-10-26 14:53:31 +02:00
Thomas Arendsen Hein
98f6770b49 clone: activate @ bookmark if updating to it
The message "updating bookmark @ failed!" in test-bookmarks-pushpull.t
is correct, because the changeset that the @ bookmark points to is not
pushed to the target repository.
2012-10-26 14:37:03 +02:00
Pierre-Yves David
b13f928861 bookmark: prevent crashing when a successor is unknown locally (issue3680)
The `%ln` revset substitution does not accept unknown node. We prune unknown
node from potential successors before computing descendants.

This have no impact on the result of this function.

- Descendants of unknown changeset as unknown,
- all successors of unknown changesets are already return by the call who
  returned those same unknown changesets,
- unknown changesets are never a valid destination for a bookmark.
2012-10-25 23:43:52 +02:00
Pierre-Yves David
d88bdb0452 bookmark: complexity pull-push test to have deeper tree
This changeset only touch test.

The previous test was correct, it tested that the successors of an old bookmark
position was seen as a valid destination for bookmark.

However, a newer version is made for two reason:

(1) The new test check further. It check that the descendant of the successors
    is a valid destination

(2) An ever more complexe test is needed to validate a future fix to issue 3680
    Splitting complexification of the test and actual bugfix help to reduce the
    noise in the bugfix changeset. Issue 3680 is NOT fixed by this changeset.
2012-10-25 23:36:03 +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
Pierre-Yves David
6431172ad3 bookmark: take successors into account when updating (issue3561)
When we rewrite a bookmarked changeset, we want to update the
bookmark on its successors. But the successors are not descendants
of its precursor (by definition). This changeset alters the bookmarks
logic to update bookmark location if the newer location is a successor
of the old one[1].

note: valid destinations are in fact any kind of successors of any kind
      of descendants (recursively.)

This changeset requires the enabling of the obsolete feature in
some bookmark tests.
2012-08-26 01:28:22 +02:00
Pierre-Yves David
653c171718 checkheads: check successors for new heads in both missing and common
A relevant obsolete marker may have been added -after- we previously
exchanged the changeset. We have to search for remote heads that
disappear by the sole fact of pushing obsolescence.

This case will also happen when remote got the new version from a
repository that does not propagate obsolescence markers.
2012-08-26 00:25:33 +02:00
Mads Kiilerich
cdcad9a14c check-code: fix check for trailing whitespace on empty lines
It seems like the intention with c4ecbbd282fe was to catch lines with only
one whitespace too.
2012-08-08 18:10:30 +02:00
Mads Kiilerich
9cddfd19ab check-code: fix check for trailing whitespace on sh command lines
The $ has been without necessary escaping since introduced in c4ecbbd282fe.
2012-08-08 18:10:16 +02:00
Pierre-Yves David
fd393b84f3 pushkey: do not exchange obsole markers if feature is disabled
This apply to both push and pull both when client or server.
2012-07-28 13:33:06 +02:00
Augie Fackler
4441aecdd5 test-bookmarks-pushpull.t: verify correct push -B behavior
I wasn't able to find a test that proved this behavior worked, so I
felt obligated to write a quick test so it won't regress in the
future.
2012-07-06 14:11:58 -05:00
Pierre-Yves.David@ens-lyon.org
d60eedc2d6 obsolete: exchange obsolete marker over pushkey
For a version of the exchange, all markers are exchange. This won't
scale and we will need a better protocol later.
2012-06-07 19:21:59 +02:00
Sune Foldager
77ac86c2b5 fix push of moved bookmark when creating new branch heads
The problem occured when pushing a changeset that at the same time creates a
new named branch head and moves a bookmark. The code invoked methods that only
exist on localrepo instances, so it failed for any other type of remote. The
test suite only tested against local remotes.
2012-06-26 23:05:25 +02:00
Adrian Buehlmann
938a48ede9 test-bookmarks-pushpull: partially adapt for Windows
The kill call at the end is redundant, as we already have

199:  $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
200:  $ cat ../hg.pid >> $DAEMON_PIDS

So there is nothing left that would not already be killed by the $DAEMON_PIDS
mechanism.
2012-06-20 18:02:01 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Levi Bard
c4e66ba62d bookmarks: allow existing remote bookmarks to become heads when pushing 2012-05-13 10:21:27 +02:00
Levi Bard
ff2ee52b29 bookmarks: pull new bookmarks from remote by default (BC) 2012-05-12 17:00:01 +02:00
Matt Mackall
31ad230c52 pull: backout change to return code
This bit a number of people.
2012-02-10 16:09:30 -06:00
Matt Mackall
902bee47a8 pull: return 1 when no changes found (BC)
Currently we have the following return codes if nothing is found:

                commit   incoming    outgoing      pull     push
intended           1        1           1            1       1
documented         1        1           1            0       1
actual             1        1           1            0       1

This makes pull agree with the rest of the table and makes it easy to
detect "nothing was pulled" in scripts.
2012-01-30 16:01:54 -06:00
Matt Mackall
1c8e8627b0 push: don't treat bookmark as a found change
Treating bookmarks as a found change results in confusing
documentation or output and is less useful for scripting.
2012-01-30 15:56:35 -06:00
Kevin Bullock
d1f8c5d7da update: note updated bookmark
This brings update in line with pull: we notify the user when an action
indirectly updates a bookmark.
2012-01-27 13:12:56 -06:00
Matt Mackall
0e96c1d311 bookmarks: automatically advance bookmark on naked update (BC) (issue2894) 2012-01-19 14:07:48 -06:00
Pierre-Yves David
a6373d74dc phases: add basic pushkey support 2011-12-15 11:24:26 +01:00
Matt Mackall
239b73ab8c bookmarks: mark divergent bookmarks with book@pathalias when source in [paths] 2011-12-07 16:19:39 -06:00
Matt Mackall
395e8d3f93 bookmarks: shadow divergent bookmarks of foo with foo@n 2011-12-06 14:17:33 -06:00
Mads Kiilerich
8415df7277 tests: use 'hghave serve' to guard tests that requires serve daemon management 2011-11-07 03:24:53 +01:00
Peter Arrenbrecht
75fa0e5ea9 discovery: add new set-based discovery
Adds a new discovery method based on repeatedly sampling the still
undecided subset of the local node graph to determine the set of nodes
common to both the client and the server.

For small differences between client and server, it uses about the same
or slightly fewer roundtrips than the old tree-based discovery. For
larger differences, it typically reduces the number of roundtrips
drastically (from 150 to 4, for instance).

The old discovery code now lives in treediscovery.py, the new code is
in setdiscovery.py.

Still missing is a hook for extensions to contribute nodes to the
initial sample. For instance, Augie's remotebranches could contribute
the last known state of the server's heads.

Credits for the actual sampler and computing common heads instead of
bases go to Benoit Boissinot.
2011-05-02 19:21:30 +02:00
David Soria Parra
848c5155b1 localrepo: do not update bookmarks in addchangegroup
We want to update the current bookmark to the most recent revision on
current branch unless there is a remote bookmark that points to
a different descendant. Addchangegroup is called before we can check for
remote bookmarks.

We don't update the bookmark in addchangegroup anymore to allow proper updating
of bookmarks in pull.
2011-03-14 20:53:55 +01:00
David Soria Parra
d5ce5f0e0b hg: add support for cloning bookmarks 2011-03-13 12:24:17 +01:00
David Soria Parra
6b3204aa84 tests: remove bookmark extension configuration 2011-02-24 03:13:48 +01:00
David Soria Parra
12aa64e430 bookmarks: make track.current=True default behaviour and remove option (BC) 2011-02-16 01:29:26 +01:00
David Soria Parra
6759d1e574 localrepo: sort hg bookmark output
sort bookmarks before we write them to stdout to get a predictable output.
2011-02-11 20:35:32 +01:00
Matt Mackall
d27d1fae16 bookmarks: move push/pull command features to core 2011-02-10 13:46:28 -06:00
Matt Mackall
509a829041 pushkey: force HTTP POST on push and add tests (issue2489) 2010-11-12 01:21:45 -06:00
Matt Mackall
32de98afbd tests: drop final true command from unified tests 2010-09-20 16:00:15 -05:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Will Maier
8775baf673 tests: add test for bookmark push/pull 2010-09-14 22:26:43 -05:00