Commit Graph

34 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
3536b81882 share: wrap bmstore._writerepo for transaction sensitivity (issue4940)
4bc805f938a0 made 'bmstore.write()' transaction sensitive, to restore
original bookmarks correctly at failure of a transaction.

For example, shelve and unshelve imply steps below:

  before 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' writes updated ones into .hg/bookmarks
    3. rollback transaction to remove internal commits
    4. restore updated bookmarks manually

  after 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' doesn't write updated ones into .hg/bookmarks
       (these are written into .hg/bookmarks.pending, if external hook
       is spawn)
    3. rollback transaction to remove internal commits
    4. .hg/bookmarks should be clean, because it isn't changed while
       transaction running: see (2) above

But if shelve or unshelve is executed in the repository created with
"shared bookmarks" ("hg share -B"), this doesn't work as expected,
because:

  - share extension makes 'bmstore.write()' write updated bookmarks
    into .hg/bookmarks of shared source repository regardless of
    transaction activity, and

  - intentional transaction failure at the end of shelve/unshelve
    doesn't restore already updated .hg/bookmarks of shared source

This patch makes share extension wrap 'bmstore._writerepo()' instead
of 'bmstore.write()', because the former is used to actually write
bookmark changes out.
2015-11-13 02:36:30 +09:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Matt Mackall
43de6c5585 share: make option docs more check-config friendly 2015-07-18 14:17:17 -05:00
Gregory Szorc
c9f7c94c30 hg: support for auto sharing stores when cloning
Many 3rd party consumers of Mercurial have created wrappers to
essentially perform clone+share as a single operation. This is
especially popular in automated processes like continuous integration
systems. The Jenkins CI software and Mozilla's Firefox release
automation infrastructure have both implemented custom code that
effectively perform clone+share. The common use case here is that
clients want to obtain N>1 checkouts while minimizing disk space and
network requirements. Furthermore, they often don't care that a clone
is an exact mirror of a remote: they are simply looking to obtain
checkouts of specific revisions.

When multiple third parties implement a similar feature, it's a good
sign that the feature is worth adding to the core product. This patch
adds support for an easy-to-use clone+share feature.

The internal "clone" function now accepts options to control auto
sharing during clone. When the auto share mode is active, a store will
be created/updated under the base directory specified and a new
repository pointing to the shared store will be created at the path
specified by the user.

The share extension has grown the ability to pass these options into
the clone command/function.

No command line options for this feature are added because we don't
feel the feature will be popular enough to warrant their existence.

There are two modes for auto share mode. In the default mode, the shared
repo is derived from the first changeset (rev 0) in the remote
repository. This enables related repositories existing at different URLs
to automatically use the same storage. In environments that operate
several repositories (separate repo for branch/head/bookmark or separate
repo per user), this has the potential to drastically reduce storage
and network requirements. In the other mode, the name is derived from the
remote's path/URL.
2015-07-08 16:19:09 -07:00
Siddharth Agarwal
41bc76a3eb share: replace reference to 'sopener' with 'svfs'
sopener is deprecated. It's annoying for extension authors to have to deal with
both. Let's just kill it off.
2015-06-25 22:16:36 -07:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Augie Fackler
f95a6caba1 extensions: document that testedwith = 'internal' is special
Extension authors (notably at companies using hg) have been
cargo-culting the `testedwith = 'internal'` bit from hg's own
extensions, which then defeats our "file bugs over here" logic in
dispatch. Let's be more aggressive about trying to give extension
authors a hint about what testedwith should say.
2015-04-28 16:44:37 -04:00
Yuya Nishihara
53f1e7866c commands: replace "working copy" with "working directory" in help/messages
"working directory" is the standard term, we should use it consistently.

But I didn't touch the hint, "run 'hg update' to get a working copy", because
"get a working directory" sounds a bit odd.
2015-03-17 22:47:08 +09:00
Angel Ezquerra
79a2fd145f share: replace the bookmarks.shared file with an entry on a new "shared" file
0e5f75a52c9d introduced a way to share bookmarks. When a repository share that
shares bookmarks was created, a .hg/bookmarks.shared file was created to mark
the repository share as one that shares its bookmarks.

We have plans to introduce other levels of sharing, including a "full share"
mode. Rather than creating a new ".shared" file for each new thing that we may
want to share It seems better to create a single "shared" file that will list
what is shared for a given shared repository. This should make it much easier
to get a list of everything that is shared by a given shared repository.

The shared file contains a list of shared "items" (such as bookmarks). Each
shared "item" is added as a new line in the file. For now the only possible
entry in the file is "bookmarks".
2015-01-11 16:20:15 +01:00
Angel Ezquerra
1a80984319 localrepo: introduce shared method to check if a repository is shared
Up until now we compared the "path" and "sharedpath" repository properties to
check if a repository is shared. This was relying an implementation detail of
shared repositories. In order to make it possible to change the way shared
repositories are implemented, we encapsulate this check into its own localrepo
method, called shared.

This new method returns None if the repository is shared, and something else
(for now a string describing the short of share) otherwise.

The reason why I did not call this method "isshared" and made it return a
boolean is that I plan to introduce a new type of shared repository soon.

# NOTES:

This is the first patch in a series whose purpose is to add support for
creating "full repository shares", which are repositories that share everything
with the repository source except their current revision, branch and bookmark.

This series is RFC because I am not very sure of some of the solutions I took.
Comments are welcome!
2014-12-21 00:19:10 +01:00
Matt Harbison
83145196b9 share: use the 'sharedpath' attr on repo instead of reloading from the file
Seems like a useful optimization, and now the exact file content is not a
concern.
2014-12-18 23:24:17 -05:00
Matt Harbison
fb818cc375 share: fix source repo lookup on Windows
The stored path contains platform specific separators, so splitting on '/.hg'
returned the string unmodified on Windows.  The source was then looked for in
$source/.hg/.hg, which obviously fails.  This caused cascading errors in
test-share.t relating to the recent bookmark support.
2014-12-18 23:16:37 -05:00
Ryan McElroy
88ff1f64d6 share: add option to share bookmarks
This patch adds the -B/--bookmarks option to the share command added by the
share extension. All it does for now is create a marker, 'bookmarks.shared',
that will be used by future code to implement the sharing functionality.
2014-12-13 11:32:46 -08:00
Ryan McElroy
efe10f8c7a share: implement shared bookmark functionality
This does not cause any behavioral change unless a 'bookmarks.shared' marker
file exists. A future change will add UI to create this file when a repository
is shared.
2014-12-13 14:31:55 -08:00
Gregory Szorc
564ed0a4b1 share: define norepo in command decorator 2014-05-04 22:03:11 -07:00
Gregory Szorc
3eeb610c1f share: declare commands using decorator 2014-05-04 21:33:14 -07:00
Brodie Rao
c0209a0c13 share: fix unshare calling wrong repo.__init__() method
When running the unshare command, if there's other code that tries to use
the repo after the command is finished, it'll end up with a ui object for
repo.unfiltered(). This change fixes an erroneous call to repo.__init__()
that could be on the repoview proxy class--now it's always done on the
unfiltered repo.
2013-11-16 17:30:34 -05:00
Simon Heimberg
25ae76fc48 documentation: add an extra newline after note directive
Like this no docutils version interprets any line in the following text as
argument of note.
2013-11-05 08:59:55 +01:00
Matt Mackall
cc099c8d79 share: remove reference to tip 2013-07-11 19:26:53 -05:00
Simon Heimberg
9e6ca20cff repo: repo isolation, do not pass on repo.ui for creating new repos
A repo should not get the configuration from an other repo, so create it with
the global configuration in repo.baseui.
This is done too when recreating a repo. The repo configuration is reread
anyway. And now deleted repo configuration does not persist.
2012-10-10 21:55:49 +02:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Matt Mackall
ffc757047f share: drop unused import 2011-09-10 17:59:47 -05:00
Simon Heimberg
329de5444b hgext: introduce unshare command 2011-08-11 00:04:00 +02:00
Erik Zielke
c732a9771b Use note admonition 2010-09-22 16:23:55 +02:00
Martin Geisler
3e53380842 share: drop experimental label
As per mail from Matt:

  http://selenic.com/pipermail/mercurial/2010-March/030774.html
2010-04-01 00:02:12 +02:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Greg Ward
c0a5547680 share: be more explicit about the dangers of rollback. 2010-01-13 22:05:06 -05:00
Martin Geisler
f6e67e065a share: wrap docstrings at 70 characters 2009-07-26 02:01:19 +02:00
Martin Geisler
cab1b2c2c7 share: wrapped docstrings at 78 characters 2009-07-07 23:54:42 +02:00
Brodie Rao
a77b70fbf3 extensions: remove unused imports 2009-07-01 10:19:40 -04:00
Cédric Duval
dbcec5595d extensions: improve the consistency of synopses
Trying as much as possible to consistently:
 - use a present tense predicate followed by a direct object
 - verb referring directly to the functionality provided
   (ie. not "add command that does this" but simple "do that")
 - keep simple and to the point, leaving details for the long help
   (width is tight, possibly even more so for translations)

Thanks to timeless, Martin Geisler, Rafael Villar Burke, Dan Villiom
Podlaski Christiansen and others for the helpful suggestions.
2009-06-22 15:48:08 +02:00
Dirkjan Ochtman
a774ff01bc help: add/fix docstrings for a bunch of extensions 2009-06-21 16:45:47 +02:00
Matt Mackall
f004f8a57f share: allow dest to default to the basename of source 2009-06-13 18:16:44 -05:00
Matt Mackall
d9cad07c11 share: add experimental share extension 2009-06-13 18:01:48 -05:00