Commit Graph

528 Commits

Author SHA1 Message Date
Siddharth Agarwal
228773d706 hg: note that islocal only accepts paths pointing to repos
hg.islocal doesn't work for paths pointing to non-repos, such as patch files.
2014-02-03 14:36:20 -08:00
Siddharth Agarwal
cfe3861321 hg.openpath: use url.islocal to tell if the path is local (issue3624)
Previously we used hg.islocal, which doesn't work for paths pointing to
non-repos, such as patch files.
2014-02-03 14:53:44 -08:00
Brodie Rao
a446720e09 branchmap: cache open/closed branch head information
This lets us determine the open/closed state of a branch without
reading from the changelog (which can be costly over NFS and/or with
many branches).
2013-09-16 01:08:29 -07:00
Martin Geisler
865c68aba2 hg: remove outdated comment
The graphlog functionality has been in core since Mercurial 2.3.
2013-11-22 19:13:26 +01:00
FUJIWARA Katsunori
cf37230008 lock: take both vfs and lock file path relative to vfs to access via vfs
This patch makes "lock.lock.__init__()" take both vfs and lock file
path relative to vfs, instead of absolute path to lock file.

This allows lock file to be accessed via vfs.
2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
2b101a0a9d hg: rewrite "copystore()" with vfs
This patch rewrites "copystore()" with vfs, because succeeding patch
requires "lock.lock()" invocation with vfs.

This patch uses 'dstbase + "/lock"' instead of "join()" with both
elements even on Windows environment but it should be reasonable,
because target files given from "store.copyfiles()" already uses "/"
as path separator.

"util.copyfiles()" between two vfs-s may have to be rewritten in the
future.
2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
495b98fa37 extensions: list up only enabled extensions, if "ui" is specified
Before this patch, "extensions.extensions()" always lists up all
loaded extensions. So, commands handling multiple repositories at a
time like below enable extensions unexpectedly.

  - clone from or push to localhost: extensions enabled only in the
    source are enabled also in the destination

  - pull from localhost: extensions enabled only in the destination
    are enabled also in the source

  - recursive execution in subrepo tree: extensions enabled only in
    the parent or some of siblings in the tree are enabled also in
    others

In addition to it, extensions disabled locally may be enabled
unexpectedly.

This patch checks whether each of extensions should be listed up or
not, if "ui" is specified to "extensions.extensions()", and invokes
"reposetup()" of each extensions only for repositories enabling it.
2013-09-21 21:33:29 +09:00
Matt Mackall
4668c6cfad merge with stable 2013-06-30 15:19:39 -05:00
Siddharth Agarwal
f8c16bcd02 update: remove .hg/graftstate on clean (issue3970)
940ffc89c520 introduced a check for interrupted grafts while committing. This
exposed a bug where hg update --clean didn't remove that file.
2013-06-28 16:58:31 -07:00
simon@laptop-tosh
c8aaab9ec9 hg: move return statement after finally block
return is always run after finally block. Now we have same functionality,
but clearer readability.
2013-06-08 22:37:08 +02:00
Mads Kiilerich
64f616517b unionrepo: read-only operations on a union of two localrepos
unionrepo is just like bundlerepo without bundles.

The implementation is very similar to bundlerepo, but I don't see any obvious
way to generalize it.

Some most obvious use cases for this would be log and diff across local repos,
as a kind of preview of pulls, for instance:

  $ hg -R union:repo1+repo2 heads
  $ hg -R union:repo1+repo2 log -r REPO1REV -r REPO2REV
  $ hg -R union:repo1+repo2 log -r '::REPO1REV-::REPO2REV'
  $ hg -R union:repo1+repo2 log -r 'ancestor(REPO1REV,REPO2REV)'
  $ hg -R union:repo1+repo2 diff -r REPO1REV -r REPO2REV

This is going to be used in RhodeCode, and Bitbucket already uses something
similar. Having a core implementation would be beneficial.
2013-01-18 15:54:09 +01:00
Mads Kiilerich
b80d68316e largefiles: don't crash when trying to find default dest for url without path
79f69be29aed introduced a crash when cloning a url without path - where
util.url().path would be None.

This None will now be handled as ''. clone will thus abort with 'repository /
not found' as before.
2013-02-04 23:26:44 +01:00
Matt Harbison
b344797c5f share: backout f48752441ca0, except the test
Locating the share source when no default path is available is now handled in
subrepo._abssource(), so unconditionally setting a default path (and the
associated problems) can be avoided.

The test change reflects the fact that a default path is no longer set on the
resulting share.
2012-11-27 21:31:59 -05:00
Pierre-Yves David
d33c391bb4 discovery: outgoing pass unfiltered repo to findcommonincoming (issue3776)
We noa pass an unfiltered repo in the same way `localrepo.push` does. This does
not alter outgoing behavior and prevents possible crash with computing
common/missing.

The `findcommonincoming` code could be simplified to make this unnecessary, but
this is too much change for the freeze.
2013-01-28 13:56:11 +01:00
Augie Fackler
34ec9a8cb4 hg: replace DirCleanup class with normal try/finally use 2012-10-05 18:10:56 -05:00
Kevin Bullock
93f9cb7f25 filtering: rename filters to their antonyms
Now that changelog filtering is in place, it's become evident that
naming the filters according to the set of revs _not_ included in the
filtered changelog is confusing. This is especially evident in the
collaborative branch cache scheme.

This changes the names of the filters to reflect the revs that _are_
included:

  hidden -> visible
  unserved -> served
  mutable -> immutable
  impactable -> base

repoview.filteredrevs is renamed to filterrevs, so that callers read a
bit more sensibly, e.g.:

  filterrevs('visible') # filter revs according to what's visible
2013-01-13 01:39:16 -06:00
Pierre-Yves David
4e9586f18e clfilter: enforce hidden filtering on all repository accesses
We ensure all repositores created through `mercurial.hg.repository`
are "hidden" filtered. This is an even stronger enforcement than
86530c899687.

Citing Matt's response to changeset 86530c899687 installing filtering
in dispatch:

> Unfortunately, this means that code that doesn't go through dispatch (ie all
> those crazy misguided people using Mercurial as a library) are going to see
> these hidden changesets.
>
> Might be better to instead install the filter in localrepo construction by
> default and disable it in dispatch.
2013-01-11 20:34:54 +01:00
simon@laptop-tosh
b228b696db share: always set default path to work with subrepos (issue3518)
set the default path in any case because creating subrepo looks this up.
Subrepos are cloned, not shared.
2012-10-27 12:38:59 +02:00
Augie Fackler
9766845689 bookmarks: introduce a bmstore to manage bookmark persistence
Bookmarks persistence still showed a fair amount of its legacy as a
monkeypatching extension. This encapsulates all bookmarks
serialization and parsing in a single class, and offers a single
location where other bookmarks storage engines can be substituted
in. As a result, many files no longer import the bookmarks module,
which strikes me as an encapsulation win.

This doesn't do anything to the current bookmark state yet, but I'm
hoping put that in the bmstore class as well.
2012-11-07 16:21:39 -06:00
Adrian Buehlmann
b5e726b312 openpath: specify binary mode and use util.posixfile
follow-up to aa655773f574
2012-11-01 13:46:03 +01:00
Simon Heimberg
b731b379ec subrepo: only do clean update when overwrite is set (issue3276)
Files in a subrepo were overwritten on update. But this should only happen on a
clean update (example: -C is specified).
Use the overwrite parameter introduced for svn subrepos in e3640daa4703 to
decide whether to merge changes (as update) or remove them (as clean).

The new function hg.updaterepo is intruduced to keep all update calls in hg.

test-subrepo.t is extended to test if an untracked file is overwritten
(issue3276). (Update -C is already tested in many places.)
The first two chunks are debugging output which has changed. (Because overwrite
is not always true anymore for subrepos)
All other tests still pass without any change.
2012-10-24 18:45:22 +02:00
Siddharth Agarwal
acc48ffd83 url: use open and not url.open for local files (issue3624) 2012-10-17 21:30:08 -07: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
Simon Heimberg
13de6e4d2f subrepo: more isolation, only use ui for hg.peer when there is no repo
ui contains repo specific configuration, so do not use it when there is a repo.
But pass it to hg.peer when there is no repo. Then it only contains global
configuration.
2012-10-04 19:46:43 +02:00
Simon Heimberg
6523213f0e peer: subrepo isolation, pass repo instead of repo.ui to hg.peer
Do not pass ui because it contains the configuration of the repo. It is the
same object as repo.ui.
When a repo is passed to hg.peer, the global configuration is read from
repo.baseui.
2012-07-28 23:28:36 +02: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
c1f9a37b15 clone: make sure to use "@" as bookmark and "default" as branch (issue3677)
Before this change a bookmark named "default" or a branch named "@" would
cause the wrong changeset to be checked out.

The change in output of test-hardlinks.t is due to the fact that no unneeded
tag lookups for the tags "@" or "default" happen, therefore the cache file is
not created.
2012-10-26 12:36:15 +02:00
Matt Mackall
86c978bc2c clone: don't %-escape the default destination (issue3145) 2012-10-19 14:47:55 -05:00
Kevin Bullock
6012647380 clone: update to @ bookmark if it exists 2012-03-21 16:53:39 -05:00
Tomasz Kleczek
8b2ac179dd branchcache: fetch source branchcache during clone (issue3378)
Recomputing branch cache on clone may be expensive,
therefore if possible we fetch it along with the data.

- If the clone is performed by copying, we just copy branchcache file.
- If we localrepo.clone and streaming then we follow the procedure:
  1. Fetch branchmap from the remote
  2. Fetch the actual data.
  3. Find the latest rev within branch heads (tip at the time of
     branchmap fetch)
  4. Update the cache for the revs in [remotetip+1, tip]

This way we ensure that the branchcache is correct even in case
of races with commits.
2012-10-03 13:19:53 -07: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
Pierre-Yves David
5ae3830b30 clfilter: introduce a hassecret function
We can only use copy clone if the cloned repo do not have any secret changeset.
The current method for that is to run the "secret()" revset on the remote repo.
But with proper filtering of hidden or unserved revision by the remote this
revset won't return any revision even if some exist remotely. This changeset
adds an explicit function to know if a repo have any secret revision or not.

The other option would be to disable filtering for the query but I prefer the
approach above, lighter both regarding code and performance.
2012-09-03 14:05:19 +02:00
Augie Fackler
5200764eb8 clone: don't fail with --update for non-local clones (issue3578)
This was broken by e01343f7da6f due to lack of test coverage. This
adds a test and fixes the defect.
2012-08-08 10:04:02 -05:00
Patrick Mezard
7221d12e58 discovery: add extinct changesets to outgoing.excluded
Before this change, push would incorrectly fast-path the bundle
generation when extinct changesets are involved, because they are not
added to outgoing.excluded. The reason to do so are related to
outgoing.excluded being assumed to contain only secret changesets by
scmutil.nochangesfound(), when displaying warnings like:

 changes found (ignored 9 secret changesets)

Still, outgoing.excluded seems like a good API to report the extinct
changesets instead of dedicated code and nothing in the docstring
indicates it to be bound to secret changesets. This patch adds extinct
changesets to outgoing.excluded and fixes scmutil.nochangesfound() to
filter the excluded node list.

Original version and test by Pierre-Yves.David@ens-lyon.org
2012-07-25 19:34:31 +02:00
Matt Harbison
0afe294dbc outgoing: accept revset argument for --rev
There may be a more generic way that would add revset support to more commands
by adding revset support to addbranchrevs(), but given the proximity of the next
code freeze, a minimal change seems like the better choice.
2012-07-15 12:43:10 -04:00
Sune Foldager
e82027e6f3 peer: remove cancopy from peer api; use directly on repo instead 2012-07-13 21:52:37 +02:00
Peter Arrenbrecht
ef7b77046e peer: introduce real peer classes
This change separates peer implementations from the repository implementation.
localpeer currently is a simple pass-through to localrepository, except for
legacy calls, which have already been removed from localpeer. This ensures that
the local client code only uses the most modern peer API when talking to local
repos.

Peers have a .local() method which returns either None or the underlying
localrepository (or descendant thereof). Repos have a .peer() method to return
a freshly constructed localpeer. The latter is used by hg.peer(), and also to
allow folks to pass either a peer or a repo to some generic helper methods.
We might want to get rid of .peer() eventually.

The only user of locallegacypeer is debugdiscovery, which uses it to pose as a
pre-setdiscovery client. But we decided to leave the old API defined in
locallegacypeer for clarity and maybe for other uses in the future.

It might be nice to actually define the peer API directly in peer.py as stub
methods. One problem there is, however, that localpeer implements
lock/addchangegroup, whereas the true remote peers implement unbundle.
It might be desireable to get rid of this distinction eventually.
2012-07-13 21:47:06 +02:00
Sune Foldager
ffe56435bf peer: introduce peer methods to prepare for peer classes
This introduces a peer method into all repository classes, which currently
simply returns self. It also changes hg.repository so it now raises an
exception if the supplied paths does not resolve to a localrepo or descendant.

Finally, all call sites are changed to use the peer and local methods as
appropriate, where peer is used whenever the code is dealing with a remote
repository (even if it's on local disk).
2012-07-13 21:46:53 +02:00
FUJIWARA Katsunori
204c7d4046 localrepo: use the path relative to "self.vfs" instead of "path" argument
As a part of migration to vfs, this patch uses "self.root", which can
be recognized as the path relative to "self.vfs", instead of "path"
argument.

This fix allows to make invocations of "util.makedirs()" and
"os.path.exists()" while ensuring repository directory in
"localrepository.__init__()" ones indirectly via vfs.

But this fix also raises issue 2528: "hg clone" with empty destination.

"path" argument is empty in many cases, so this issue can't be fixed
in the view of "localrepository.__init__()".

Before this patch, it is fixed by empty-ness check ("not name") of
exception handler in "util.makedirs()".

    try:
        os.mkdir(name)
    except OSError, err:
        if err.errno == errno.EEXIST:
            return
        if err.errno != errno.ENOENT or not name:
            raise

This requires "localrepository.__init__()" to invoke "util.makedirs()"
with "path" instead of "self.root", because empty "path" is treated as
"current directory" and "self.root" becomes valid path.

But "hg clone" with empty destination can be detected also in
"hg.clone()" before "localrepository.__init__()" invocation, so this
patch re-fixes issue2528 by checking it in "hg.clone()".
2012-07-06 18:45:27 +09:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Thomas Arendsen Hein
5e3d9e57d7 clone: always close source repository (issue2491)
This is especially needed for cloning from bundles as a temporary
bundlerepository is created which needs to be deleted after clone has
finished.
2012-04-03 22:01:28 +02:00
Kevin Bullock
2e6b4bf150 bookmarks: clone non-divergent bookmarks with @ in them 2012-03-21 16:39:38 -05:00
Matt Mackall
684f6eea71 phases: fix verify with secret csets
Verify uses repo.cancopy() to detect whether a repo is a plain old
local repo, so it was giving a confusing error message when secret
changesets were present.
2012-01-29 13:36:10 -06:00
Matt Mackall
e4d11ad28c scmutil: unify some 'no changes found' messages
This keeps the wording more consistent for secret csets
2012-01-25 17:14:08 -06:00
Alain Leufroy
9a455ccd0e outgoing: display info about secret changets while no sharable changeset found 2012-01-25 19:41:34 +01:00
Matt Mackall
eb2ed976cb bookmarks: backout locking change in 31cb6aaf3b7a
Repo lock only applies to data in .hg/store/
2012-01-18 14:56:52 -06:00
Mads Kiilerich
50c2110b65 bookmarks: primarily use repo lock, not wlock
Bookmarks are repository data, not working directory data. Only the current
bookmark is working directory data.

Some lock shuffling is required to avoid lockout between the initial mock lock
and locking of the localrepo instance that is created after copying.
2012-01-13 02:30:43 +01:00