Commit Graph

261 Commits

Author SHA1 Message Date
Eric Eisner
579b798395 subrepo: support for adding a git subrepo
gitsubrepo based on patch from David Soria Parra:
http://bitbucket.org/segv/davids-poor-git-subrepo-attempt/
2010-11-14 18:15:26 -05:00
Mads Kiilerich
eaea535bf7 subrepo: propagate non-default pull/push path to relative subrepos (issue1852) 2010-10-27 00:28:40 +02:00
Martin Geisler
0305929afc subrepo: svnsubrepo._wcrev should return str after 62328a9d763a 2010-10-21 10:54:37 +02:00
Matt Mackall
0677d9a163 subrepo: fix status check on SVN subrepos (issue2445) 2010-10-21 03:28:51 -05:00
Martin Geisler
77ce66fb6a check-code: find trailing whitespace 2010-10-20 10:13:04 +02:00
Mads Kiilerich
fd086af9b7 subrepo: abort instead of pushing/pulling to the repo itself
_abssource will now abort (or return None) in the rare cases where no push/pull
path can be found.
2010-10-19 03:56:20 +02:00
Mads Kiilerich
9c4dc8c331 subrepo: rename relpath to subrelpath and introduce reporelpath 2010-10-19 03:55:28 +02:00
Martin Geisler
afe812d8de subrepo: try remapping subpaths using the "final" path
Before, the right-hand side of a .hgsub entry was used, as is, to
match the left-hand side of a subpaths entry. This turned out to be
less useful than expected since a .hgsub file with

  src/foo = src/foo

has little context to do remapping on. The new idea is therefore to
prefix the parent repo path *before* the remapping takes place.

If the parent repository path (as defined by _abssource) is

  http://example.net/parent

then the remapping for the above .hgsub entry will be done on the
expanded path:

  http://example.net/parent/src/foo

If this expanded path is not changed by the remapping, then we remap

  src/foo

alone. This is the old behavior where the right-hand side is remapped
without context.
2011-09-22 15:15:18 +02:00
Martin Geisler
25c66ec3c7 subrepo: refactor state function 2011-09-22 14:39:49 +02:00
Matt Mackall
d4f66ce1b3 merge with stable 2011-08-26 16:08:24 -05:00
Matt Mackall
e75325116a merge with stable 2011-08-01 10:54:34 -05:00
Augie Fackler
9350462549 subrepo: use safehasattr instead of hasattr
Some of these instances could be rewritten as clever getattr(x, y,
default) ladders, but that felt like it impeded readability too much
to be worth the modest efficiency gain.
2011-07-25 15:53:22 -05:00
Brodie Rao
ac14679b96 subrepos: add missing self argument to abstractsubrepo.checknested 2010-09-26 16:11:04 -05:00
Wagner Bruna
141644d96f subrepo: improve lookup error messages 2010-09-13 10:33:49 -03:00
Martin Geisler
34af0cf109 subrepo: add support for 'hg archive' 2010-09-20 15:46:17 +02:00
Martin Geisler
37b2820a98 subrepo: introduce files and filedata methods for subrepo classes 2010-09-20 15:44:30 +02:00
Martin Geisler
d37ba034d5 incoming: recurse into subrepositories with --subrepos/-S flag
As with push and outgoing, the optional source path is ignored for the
subrepositories. Fixing this is Issue1852.
2010-09-13 13:09:31 +02:00
Martin Geisler
2346ea8e9e outgoing: recurse into subrepositories with --subrepos/-S flag
As with push, the optional destination path is ignored for the
subrepositories, i.e., they are always compared with their default
push path. Fixing this is Issue1852.
2010-09-13 13:09:26 +02:00
Martin Geisler
cb93a10b9b add: recurse into subrepositories with --subrepos/-S flag 2010-09-13 13:09:20 +02:00
Martin Geisler
ce594fa743 subrepo: handle diff with working copy
We cannot unconditionally call bin(node2) since node2 is None when
comparing with the working copy.
2010-09-10 23:53:49 +02:00
Patrick Mezard
30bd1afde3 subrepos: handle diff nodeids in subrepos, not before
Subversion nodeids are integer revisions.
2010-09-10 22:52:00 +02:00
Martin Geisler
c85f2356e3 subrepos: add function for iterating over ctx subrepos 2010-09-07 16:34:07 +02:00
Martin Geisler
e9c2a20771 diff: recurse into subrepositories with --subrepos/-S flag 2010-09-03 12:58:51 +02:00
Martin Geisler
f2188b5b90 status: recurse into subrepositories with --subrepos/-S flag 2010-09-03 12:58:51 +02:00
Martin Geisler
bfa6c992eb localrepo: add auditor attribute which knows about subrepos 2010-09-03 12:58:51 +02:00
Martin Geisler
9c67cf78d7 subrepo: use [0-9] instead of [\d] in svn subrepo regex
The \d was used in a normal (not raw) string and was only passed
through to re.search because Python does not define that escape
character itself. Using 0-9 makes it clearer what is happening.
2010-08-27 13:03:57 +02:00
Martin Geisler
9c87025d80 subrepos: handle backslashes in subpaths 2010-08-19 13:25:46 +02:00
Martin Geisler
174c3dbb8d subrepos: support remapping of .hgsub source paths
Given a .hgsub file containing

  lib/libfoo = http://server/libfoo

the 'lib/libfoo' subrepo will be cloned from 'http://server/libfoo'.

This changeset introduces a remapping mechanism whereby the source
paths (the right-hand sides) in the .hgsub file can be remapped. This
subpaths section

  [subpaths]
  http://server = /local

will result in the 'lib/libfoo' subrepo being cloned from
'/local/libfoo' instead of from 'http://server/libfoo'.

The patterns (left-hand sides) are really regular expressions and the
replacement strings (right-hand sides) can refer to matched groups
using normal backreferences. This can be used for more complicated
replacements such as

  [subpaths]
  http://server/(.*)-hg/ = http://hg.server/\1/

which replaces 'http://server/foo-hg/' with 'http://hg.server/foo/'.

All patterns are applied in the order by which they are listed in the
config files.
2010-07-15 18:10:05 +02:00
Martin Geisler
b5d9960615 Merge with stable 2010-07-15 14:11:14 +02:00
Mads Kiilerich
b68a37ac34 subrepo: docstrings 2010-07-15 13:24:02 +02:00
Martin Geisler
2061ba7fe0 subrepos: let caller specify a filename for SVN commands 2010-07-14 20:25:31 +02:00
Martin Geisler
294578fe50 subrepo: add abstract superclass for subrepo classes 2010-07-14 20:25:31 +02:00
Matt Mackall
49d11c6847 subrepo: correctly handle update -C with modified subrepos (issue2022)
(based on a patch by Saint Germain)
2010-06-30 23:56:35 -05:00
Matt Mackall
4edb323e75 subrepo: fix recording of + in .hgsubstate (issue2217) 2010-06-29 17:30:42 -05:00
Matt Mackall
43cb4cbcf4 subrepo: fix silent push failure for SVN (issue2241) 2010-06-27 18:20:49 -05:00
Martin Geisler
efe9b04aef subrepo: create subrepos using clone instead of pull
Subrepositories used to be created empty and then filled with data
using pull. This is wasteful when you do a clone from a local source
since it means that no hardlinks are created for the subrepos.

This patch make the hgsubrepo._get method check for an empty subrepo
and in that case do a clone instead of a pull. This brings in the same
data as before, but creates hardlinks when possible.
2011-05-09 17:15:44 +02:00
Adrian Buehlmann
e981d64ef2 rename path_auditor to pathauditor
The Mercurial 1.9 release is moving a lot of stuff around anyway and we are
already moving path_auditor from util.py to scmutil.py for that release.

So this seems like a good opportunity to do such a rename. It also strengthens
the current project policy to avoid underbars in names.
2011-05-06 09:54:06 +02:00
Brodie Rao
b7f0d2a103 url: move URL parsing functions into util to improve startup time
The introduction of the new URL parsing code has created a startup
time regression. This is mainly due to the use of url.hasscheme() in
the ui class. It ends up importing many libraries that the url module
requires.

This fix helps marginally, but if we can get rid of the urllib import
in the URL parser all together, startup time will go back to normal.

perfstartup time before the URL refactoring (707e4b1e8064):

! wall 0.050692 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

current startup time (9ad1dce9e7f4):

! wall 0.070685 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

after this change:

! wall 0.064667 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
2011-04-30 09:43:20 -07:00
Matt Mackall
3b61150db3 merge with stable 2011-04-30 03:44:31 -05:00
Matt Mackall
463d91c511 subrepo: backout 11184e56ccc1 2011-04-30 03:00:38 -05:00
Matt Mackall
f184c5b13d merge with stable 2011-04-30 02:42:05 -05:00
Augie Fackler
a2ae5598b9 svn subrepo: attempt work around obstructed checkouts (issue2752)
It should be possible to do better than this with 'svn switch', but
the logic required woud be significantly more complex. Until someone
needs the performance improvements of using switch, we'll just use the
same strategy for everything.
2011-04-29 03:34:18 -05:00
Adrian Buehlmann
307196b733 move path_auditor from util to scmutil 2011-04-20 22:43:31 +02:00
Augie Fackler
7070a6da65 subrepo: trailing whitespace cleanup 2011-04-11 07:34:40 -05:00
Adrian Buehlmann
b66c4be0ad subrepo: process merge substate in sorted order in submerge()
This ensures that subrepositories are pulled in a well defined
order when cloning the parent repository.

BEFORE:

  $ hg clone http://hg.gerg.ca/allextensions
  destination directory: allextensions
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 10 changesets with 20 changes to 6 files
  updating to branch default
  pulling subrepo caseguard from http://bitbucket.org/alexandru/caseguard
  real URL is https://bitbucket.org/alexandru/caseguard
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 81 changesets with 100 changes to 13 files
  pulling subrepo hg-prompt from http://bitbucket.org/sjl/hg-prompt
  real URL is https://bitbucket.org/sjl/hg-prompt
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 114 changesets with 176 changes to 35 files
  pulling subrepo hgpaste from http://bitbucket.org/birkenfeld/hgpaste
  real URL is https://bitbucket.org/birkenfeld/hgpaste
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 18 changesets with 18 changes to 2 files
  ...

AFTER:

  $ hg clone http://hg.gerg.ca/allextensions
  destination directory: allextensions
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 10 changesets with 20 changes to 6 files
  updating to branch default
  pulling subrepo Artemis from http://hg.mrzv.org/Artemis
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 55 changesets with 108 changes to 47 files
  ...
2011-04-03 01:57:17 +02:00
Brodie Rao
0a05d49587 subrepos: use url.url when normalizing repo paths
This works around an issue in older versions of Python that would
strip double slashes from SSH URLs when using urlunparse() on a parsed
URL.

Related issues:

- issue1755: WinXP: cmd line hg 1.3 clone of subrepo fails, due to %5C
  '\'? (originally fixed by f7e3eaf7ec0b).
2011-03-25 22:59:04 -07:00
Martin Geisler
48d4f1b703 subrepo: simplify hgsubrepo._get a little 2011-03-24 18:17:49 +01:00
Matt Mackall
9bb3fa8c69 merge with stable 2011-03-17 17:08:13 -05:00
David Soria Parra
4e5087c547 bookmarks: separate bookmarks update code from localrepo's pull.
We explicitly want to update bookmarks from a remote. This will avoid
duplicate calls to listkeys if we clone (which calls pull) and keep
bookmark related code together.
2011-03-14 00:10:43 +01:00
Eric Eisner
402d7f0b91 subrepo: show the source that git pulls 2011-03-08 15:36:56 -05:00
Patrick Mezard
d3588c996f merge with stable 2011-03-07 23:19:17 +01:00
Matt Mackall
8a87e46d4b merge with stable 2011-03-07 15:46:46 -06:00
Patrick Mezard
3e6d7b41d2 Merge with stable 2011-03-04 14:11:15 +01:00
Eric Eisner
bcb09d6c72 subrepo: show the source that git clones 2011-03-02 12:19:18 -05:00
Matt Mackall
8f1a07c9bd subrepo: fix 2.5ism in url parsing 2010-05-07 14:19:14 -05:00
Edouard Gomez
293b104156 subrepo: print paths relative to upper repo root for push/pull/commit
This makes more sense when using multiple levels of
nesting.

This happens to help a lot in a case where 3 projects
of mine all use the same makefile helper project as a
sub. A fourth project use these first three projects
and current output made it very hard to figure
which makefile helper was committed. it looked more
like the project was committed/pushed/pulled three times
in a row than dealing on three different repos.
2010-05-01 23:05:22 +02:00
Edouard Gomez
0a2d8e6eef subrepo: print pushing url 2010-05-01 23:05:22 +02:00
Edouard Gomez
46ea8095fd subrepo: normalize path part of URLs so that pulling subrepos from webdir works
For a "all projects at root" repo layout eg:
/main
/sub

Where subrepos are used such that a clone of main has this layout:
./main/
./main/.hgsub
./main/sub/

And the .hgsub content is:
sub = ../sub

This allows a pull from a hgweb where main and sub are exposed
at the root (or same directory level)

The current code doesn't normalize the path component of a pull
url. this results in trying to pull from
http://server.com/hg/main/../sub

Current hgweb implementation doesn't reduce the path component
so this results in a 404 error though everything is setup logically.

This patch adresses this 404 error on the puller side
normalizing the URLs used for pulling sub repos. For this
example, the URL would be reduced to http://server.com/hg/sub

Fix + test
2010-05-01 23:05:19 +02:00
Matt Mackall
7f6aa6252c Merge with stable 2010-05-01 15:15:35 -05:00
Matt Mackall
53ab4498e1 subrepo: propagate and catch push failures 2010-04-30 18:32:18 -05:00
Brett Cannon
8e100766b6 subrepo: fix repo root path handling in svn subrepo 2010-04-18 14:20:08 -07:00
Matt Mackall
399ebe1c0f Merge with stable 2010-04-19 17:00:02 -05:00
Martin Geisler
7dc53bec4e Merge with stable 2010-03-15 18:36:11 +01:00
Edouard Gomez
8969d04970 subrepo: fix hgrc paths section during subrepo pulling
There are two bugs in current subrepo ctor:
 - hgrc paths were using parent repo (ctx._repo) instead of self._repo
 - it was joined with local extract path, not its source repo path

Fixed both bugs using _abssource on self once it is fully initialized.
It gets the job done perfectly for pull and push urls.
2010-03-14 00:28:10 +01:00
Benoit Boissinot
9803653bf1 subrepo: keep ui and hgrc in sync when creating new repo 2010-03-12 01:23:35 +01:00
Edouard Gomez
ec1cf25023 subrepo: forward the push to argument into _abssource 2010-03-12 01:23:35 +01:00
Martin Geisler
5be19296c9 subrepo: wrap long line 2010-03-13 19:57:52 +01:00
Benoit Boissinot
d6eff743cd merge with stable 2010-03-13 17:02:41 +01:00
Edouard Gomez
2b89d37c12 subrepo: print subrepo pulling URL 2010-03-12 01:23:35 +01:00
Benoit Boissinot
7dae5be27b i18n: mark more strings for translation 2010-02-19 02:23:38 +01:00
David Soria Parra
11f271739c subrepo: make sure that the source path is stripped
Test by Patrick Mézard <pmezard@gmail.com>
2010-02-09 18:32:57 +01:00
Saint Germain
ca80dfaea9 subrepo: change default path in hgrc of subrepo after cloning
Previous behavior was to put in the cloned subrepos the path found in the original main repo.
However it isn't valid for relative path and it seems more logical to reference instead the subrepos
working copy path of the original main repo.
2010-02-06 19:14:37 +01:00
David Soria Parra
6dcc1537f6 subrepo: correct copyright 2010-02-06 10:23:18 +01:00
Benoit Boissinot
5fd3bf33e2 subrepo: fix errors reported by pylint 2010-01-31 18:02:16 +01:00
Patrick Mezard
b3819101ba subrepo: handle svn externals and meta changes (issue1982)
- Detect changes to meta on regular and external entries
- Do not try to commit external entries
2010-01-21 13:26:26 +01:00
Patrick Mezard
8cc6cf7f71 subrepo: svn xml output is much easier to parse
That's especially true with status flags: there are different fields and values
for regular changes, meta changes, externals changes and externals meta
changes.
2010-01-21 15:13:40 +01:00
Patrick Mezard
d8a25e7f28 subrepo: make svn use C locale for portability
My reasons to do 877151efa5f3 were wrong. We want to have non-localized svn
output while preserving current locale for input arguments and svn internals.
This is achieved by setting LC_MESSAGE=C.
2010-01-21 15:13:03 +01:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Benoit Boissinot
ef2921d9e6 merge with stable 2010-01-15 21:32:53 +01:00
Benoit Boissinot
8fa7d00586 subrepo: fix merging of already merged subrepos (issue1986)
This fixes a bug seen when merging a main repo which contains a subrepo when
both repos have been merged before. Each repo (main and sub) has two
branches, both of which have been merged before.

In a subrepo, if the revision to merge to is an ancestor of the current rev,
then the merge should be a noop.

Test provided by Steve Losh.
2010-01-15 21:08:04 +01:00
Matt Mackall
4387f67807 subrepo: add default path to new clones 2009-12-14 15:01:13 -06:00
Matt Mackall
238098252f submerge: properly deal with overwrites
also pull .hgsubstate check out of inner loop
2009-11-08 10:29:52 -06:00
Matt Mackall
297f3b873b subrepo: add more debugging output, lose _ markers 2009-11-08 10:24:18 -06:00
Matt Mackall
ca298b21c0 subrepo: do a linear update when appropriate 2009-11-07 16:31:43 -06:00
Matt Mackall
34dc7c3fa5 subrepo: notice dirty subrepo states when merging 2009-11-07 16:30:42 -06:00
Matt Mackall
7900d62499 subrepo: add some debug output to submerge 2009-11-07 16:29:49 -06:00
Matt Mackall
03aa7b74f1 subrepo: more robust split for .hgsubstate parsing 2009-11-07 14:09:16 -06:00
Matt Mackall
3e6199cea0 Merge with -stable 2009-09-30 21:42:51 -05:00
Matt Mackall
76ac5743c5 subrepo: add auto-pull for merge 2009-09-30 18:47:33 -05:00
Matt Mackall
60ca8ea58d subrepo: use '/' for joining non-local paths 2009-07-22 17:53:23 -05:00
Matt Mackall
aa26914af7 subrepo: audit subrepo paths 2009-07-01 13:55:24 -05:00
Dirkjan Ochtman
da9d2d8f2b merge with crew-stable 2009-07-23 20:44:26 +02:00
Abderrahim Kitouni
45a072d541 subrepo: use hg.repository instead of creating localrepo directly
this way, extensions' reposetup will be called, which allows for git
subrepos to be handled by hg-git (and I believe the same goes for
svn and hgsubversion)
2009-07-04 14:18:15 +01:00
Martin Geisler
ecfc8a98d6 filemerge, subrepo: correct indention 2009-07-07 17:26:20 +02:00
Simon Heimberg
e0e4fc74e3 ui: extract choice from prompt
avoid translating single characters (as l for _local or sym_link)
2009-06-21 01:13:19 +02:00
Dongsheng Song
4e62c61983 Fix warning: Seen unexpected token "%" 2009-06-19 14:28:29 +08:00
Matt Mackall
459bbfbb56 subrepo: basic push support 2009-06-15 02:46:20 -05:00
Matt Mackall
430046de97 subrepo: add update/merge logic 2009-06-15 02:45:38 -05:00
Matt Mackall
fd08adf4d6 commit: recurse into subrepositories 2009-06-15 02:45:38 -05:00
Matt Mackall
ce2e49a0da subrepo: introduce basic state parsing 2009-06-15 02:45:38 -05:00
Jens Bäckman
5c0be1ee6f subrepo: fix typo in help text 2010-01-09 23:12:21 +01:00
Patrick Mezard
324692dc75 subrepo: force en_US.UTF-8 locale when calling svn
Parser only knows about en_US output. Forcing the encoding to UTF-8 might not
be the best thing to do since the caller may receive some of the subversion
output, but at least it should prevent conversion errors from svn client.
2010-01-02 16:42:00 +01:00
Patrick Mezard
a0b47f1b48 subrepo: normalize svn output line-endings 2010-01-02 16:03:25 +01:00
Martin Geisler
4a972a4431 subrepo: mark string for translation and fix case 2010-01-01 18:46:24 +01:00
Augie Fackler
3851c9d2b8 subrepo: Subversion support 2009-12-31 13:16:03 -06:00
Augie Fackler
83a898418b subrepo: add table-based dispatch for subrepo types 2009-12-31 17:10:03 -06:00
Augie Fackler
ed975d02f0 subrepo: load from a context where the subrepo exists 2009-12-31 16:30:34 -06:00
Matt Mackall
3a5a0bbe7e subrepo: fix includes support in .hgsub 2009-12-31 17:25:46 -06:00
Matt Mackall
3365ccd07f Merge with -stable 2009-12-14 15:02:02 -06:00
Augie Fackler
3f9bd57c62 subrepo: document necessary methods for a subrepo class 2009-12-09 14:33:22 -06:00