Commit Graph

47 Commits

Author SHA1 Message Date
Durham Goode
fe6e42c6ab bookmark: don't allow integers as bookmark/branch/tag names
Bookmarks/branches/tags shouldn't be allowed to be integers because that
overlaps with revision numbers.  Right now if a user created one they can't
use it anyway because the revision numbers take precedence.

The check only happens when creating a new bookmark/etc from a command so it
shouldn't affect existing bookmarks/branches/tags or importing branches from
git.

This fix was prompted by us having a user create a bookmark named "404" then
accidentally checkout a very old version of our repository.
2013-02-05 16:22:53 -08:00
Kevin Bullock
dc307a1121 update: update to current bookmark if it moved out from under us (issue3682)
If the current bookmark (the one listed in .hg/bookmarks.current)
doesn't point to a parent of the working directory, e.g. if it was moved
by a pull, use that as the update target instead of the tipmost
descendent.

A small predicate is (finally) added to the bookmarks module to check
whether the current bookmark is also active.
2013-01-21 13:47:10 -06:00
Kevin Bullock
2deea1b073 commands: 'hg bookmark NAME' should work even with ui.strict=True
Before this patch, enabling strict command processing (ui.strict=True)
meant that 'hg bookmark NAME', as referenced several places in the
documentation, would not work. This adds 'bookmark' as an explicit alias
to 'bookmarks'.
2012-12-16 22:00:38 -06: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
Thomas Arendsen Hein
8cb037d432 test-bookmarks.t: check that bookmark "default" is not automatically checked out
This verifies that 7b0bf61addc9 fixes the problem originally reported in
issue3677.
2012-10-26 13:09:55 +02:00
Wagner Bruna
cc8c722c61 scmutil: generalize message to make it more i18n-friendly 2012-10-21 11:20:33 -02:00
Kevin Bullock
13bf0fbbec scmutil: add bad character checking to checknewlabel
This factors out the checks from tags and bookmarks, and newly applies
the same prohibitions to branches. checknewlabel takes a new parameter,
kind, indicating the kind of label being checked.

Test coverage is added for all three types of labels.
2012-10-17 21:42:06 -05:00
Kevin Bullock
4f9b1ecf92 bookmarks: disallow bookmarks named 'tip', '.', or 'null'
This makes bookmarks reject the same reserved names as tags and branches.
2012-10-17 16:32:43 -05:00
Kevin Bullock
0eae336995 bookmarks: remove redundant check for newline
New bookmarks are already checked for illegal characters (':', '\0',
'\n', and '\r') in bookmarks.valid().
2012-10-17 16:23:42 -05:00
David Soria Parra
da3fc820fa bookmarks: abort when incompatible options are used (issue3663)
Options like --delete and --rename are incompatible with each
other. In this case we abort. We do not abort if the result is a nullop.
Nullops are: '--delete --inactive', '--delete --force'.
2012-10-17 11:50:47 +02:00
David Soria Parra
a224be4441 bookmarks: check bookmark format during rename (issue3662) 2012-10-17 08:44:49 +02:00
Thomas Arendsen Hein
8ffc4bf2ff merge with crew-stable 2012-10-04 10:11:17 +02:00
Thomas Arendsen Hein
b144254849 clone: activate bookmark specified with --updaterev 2012-10-02 09:26:42 +02:00
David Soria Parra
2a3cae29ea bookmarks: teach the -r option to use revsets 2012-10-01 03:19:23 +02:00
Augie Fackler
d7b1ad91f4 strip: move bookmarks to nearest ancestor rather than '.'
If you've got this graph:

0-1-2
   \
    3

and 3 is checked out, 2 is bookmarked with "broken", and you do "hg
strip 2", the bookmark will move to 3, not 1. That's always struck me
as a bug.

This change makes bookmarks move to the tipmost ancestor of
the stripped set rather than the currently-checked-out revision, which
is what I always expected should happen.
2012-07-26 16:57:50 -05:00
Simon King
e5e759a651 revset: add pattern matching to 'bookmarks' revset expression 2012-05-30 23:13:33 +01:00
Matt Mackall
ed0ae26f56 bookmarks: catch the proper exception for missing revisions
This fixes a regression from 1.7
2012-05-03 16:03:08 -05:00
Kevin Bullock
2e6b4bf150 bookmarks: clone non-divergent bookmarks with @ in them 2012-03-21 16:39:38 -05:00
Matt Mackall
a69962e18c branch: warn on branching 2011-12-08 14:32:44 -06:00
Augie Fackler
2847cf3f0e summary: show bookmarks separate from tags and note active mark (issue2892) 2011-07-18 07:53:26 -05:00
Pierre-Yves David
31fc6f84be bookmarks: add a warning for non empty malformed line 2011-07-05 10:20:27 +02:00
Pierre-Yves David
5984ee96d7 bookmarks: more robust parsing of bookmarks file 2011-07-05 10:13:54 +02:00
Matt Mackall
511ac574fb merge with stable 2011-05-08 16:16:41 -05:00
Alexander Solovyov
6240007914 fix bookmarks rollback behavior
Before this patch undo.bookmarks was created on bookmarks write and
not with other transaction-related files. There were two issues: first
is that if you have changed bookmarks few times after a transaction
happened, rollback will give you a state which can point to
non-existing revision. Second is that if you have not changed
bookmarks after a transaction, rollback will touch your state anyway.

This change also adds `localrepo._writejournal` method, which can be
used by other extensions to save their transaction-related backup in
right time.
2011-05-01 13:07:00 +02:00
Kevin Bullock
111736008c id: add bookmarks to id
Since bookmarks are no longer merged with repo.tags() as of
8e2d23f4bd25, they don't show up in `hg id` as they used to. This adds
them back into the summary that `hg id` prints, and adds a
-B/--bookmarks flag alongside the -t/--tags and -b/--branch options.

Note this introduces a slight backwards-incompatibility: the summary
printed by `hg id` now separates bookmarks from tags with a space, as
seen below, instead of running it into the tags list.

Default summary output:

  $ hg id
  db815d6d32e6 tip/tag1 bm1/bm2

Output with --bookmarks:

  $ hg id --bookmarks
  bm1 bm2

See also 5672c9e8202d which adds bookmarks back into `hg summary`.
2011-02-18 17:09:08 -06:00
David Soria Parra
214ed358f0 tests: check if the bookmarks extension is ignored 2011-02-24 19:15:00 +01:00
David Soria Parra
6b3204aa84 tests: remove bookmark extension configuration 2011-02-24 03:13:48 +01:00
David Soria Parra
cfd53141e2 summary: add bookmarks to summary 2011-02-21 23:27:45 +01:00
David Soria Parra
fe7c493017 bookmarks: mark new bookmark as current if it points to the current dirstate
hg bookmark -r ancestorrev X will not mark X as the current bookmark anymore.
If you want to point a bookmark to a ancestor rev you will use hg update to
move to it. This will set the current bookmark.
2011-02-20 00:57:55 +01:00
David Soria Parra
90a5744f74 bookmarks: forbid \0 \r \n : in bookmark names (BC)
We restrict : to 1. make it easer to convert bookmarks to git branches,
2. use : later for a syntax to push a local bookmark to a remote bookmark
of a different name. \0, \n, \r are fobbidden they are used to separate
bookmarks in the bookmark file.

This change breaks backward compatbility as ':' was an allowed character in
previous versions.
2011-02-16 18:36:45 +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
David Soria Parra
60c47bdb07 templater: add bookmarks to templates and default output
as bookmarks are not dispalyed as tags anymore, we add a bookmark label
to the changeset printer.
2011-02-11 19:47:39 +01:00
David Soria Parra
7547a71806 tags: do not merge bookmarks with tags
bookmarks are no tags, therefore they should not be returned as tags.
2011-02-11 19:44:17 +01:00
Idan Kamara
3828767e58 tests: add tests for non-existant branch/tag/bookmark 2011-04-10 11:30:53 +03:00
Idan Kamara
17914fe278 bookmarks: change error messages to match those given by 'hg tag' commands 2011-04-07 17:57:38 +03:00
Mads Kiilerich
635406bf76 tests: use (esc) for all non-ASCII test output 2010-11-08 01:41:41 +01:00
Patrick Mezard
bd120906a2 Fix and unify transplant and bookmarks revsets doc registration 2010-10-23 19:22:42 +02:00
Augie Fackler
0f661dc6d3 bookmarks: add revset for referencing bookmarks 2010-10-10 12:40:25 -05: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
Martin Geisler
7793ee7004 tests: unify test-bookmarks 2010-08-14 02:57:54 +02:00
David Soria Parra
10510a0de1 bundle: update current bookmark to most recent revision on current branch
We check if the current bookmark is set to the first parent of the
dirstate. Is this the case we move the bookmark to most recent revision
on the current branch (where hg update will update you to).
2011-03-14 23:03:56 +01:00
David Soria Parra
d5ce5f0e0b hg: add support for cloning bookmarks 2011-03-13 12:24:17 +01:00