git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-svn: Fetch svn branches only and have git recognize them as branches?
@ 2015-03-12 22:30 Brian Koehmstedt
  2015-03-12 23:13 ` Junio C Hamano
  2015-03-12 23:33 ` Eric Wong
  0 siblings, 2 replies; 5+ messages in thread
From: Brian Koehmstedt @ 2015-03-12 22:30 UTC (permalink / raw)
  To: git

I'm trying deal with a project where the server is disallowing access to
the root URL on the subversion server.

i.e.,
Doesn't allow access: http://abc.com/repo
Does allow access: http://abc.com/repo/trunk, http://abc.com/repo/branches,
http://abc.com/repo/tags

I know I can git-svn to clone each separately and get three separate git
repositories, which isn't really what I want (Ideally I want one, with the
branches and tags recognized).

But neverminding that for a second, even if I end up with three git
repositories, I'd also like to figure out how to get git-svn to clone
http://abc.com/branches and recognize all the top-level directories as a
branch in git, rather than it treating it all as separate directories on
one branch.

Same would be true for tags.

Is this possible with .git/config editing?

My latest failed attempt was this:

[svn-remote "svn"]
        url = http://abc.com/repo/branches
        fetch = :refs/remotes/svn/branches
        branches = *:refs/remotes/svn/*

git svn fetch svn
This fetched all the branch directories as one branch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git-svn: Fetch svn branches only and have git recognize them as branches?
  2015-03-12 22:30 git-svn: Fetch svn branches only and have git recognize them as branches? Brian Koehmstedt
@ 2015-03-12 23:13 ` Junio C Hamano
  2015-03-12 23:51   ` Brian Koehmstedt
  2015-03-12 23:33 ` Eric Wong
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2015-03-12 23:13 UTC (permalink / raw)
  To: Brian Koehmstedt; +Cc: git, Eric Wong

Brian Koehmstedt <bkoehmstedt@berkeley.edu> writes:

> I'm trying deal with a project where the server is disallowing access to
> the root URL on the subversion server.
>
> i.e.,
> Doesn't allow access: http://abc.com/repo
> Does allow access: http://abc.com/repo/trunk, http://abc.com/repo/branches,
> http://abc.com/repo/tags

[warning: I have never used 'git svn' myself for several years]

The problem sounds like what this commit (which is v1.5.1.5~15)
fixed:

commit 4a1bb4c3f87f355dd52fcd0babcbd005d59d7ed6
Author: Eric Wong <normalperson@yhbt.net>
Date:   Sun May 13 09:58:14 2007 -0700

    git-svn: don't attempt to minimize URLs by default
    
    For tracking branches and tags, git-svn prefers to connect
    to the root of the repository or at least the level that
    houses branches and tags as well as trunk.  However, users
    that are accustomed to tracking a single directory have
    no use for this feature.
    
    As pointed out by Junio, users may not have permissions to
    connect to connect to a higher-level path in the repository.
    
    While the current minimize_url() function detects lack of
    permissions to certain paths _after_ successful logins, it
    cannot effectively determine if it is trying to access a
    login-only portion of a repo when the user expects to
    connect to a part where anonymous access is allowed.
    
    For people used to the git-svnimport switches of
    --trunk, --tags, --branches, they'll already pass the
    repository root (or root+subdirectory), so minimize URL
    isn't of too much use to them, either.
    
    For people *not* used to git-svnimport, git-svn also
    supports:
    
     git svn init --minimize-url \
      --trunk http://repository-root/foo/trunk \
      --branches http://repository-root/foo/branches \
      --tags http://repository-root/foo/tags
    
    And this is where the new --minimize-url command-line switch
    comes in to allow for this behavior to continue working.

The description of the commit makes me think that mimicking the
sample command line without minimize-url ought to work, i.e.

    git svn init \
        --trunk    http://abc.com/repo/trunk \
        --branches http://abc.com/repo/branches \
        --tags     http://abc.com/repo/tags

But I've never used 'git svn' for several years, so I may be
completely off the mark.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git-svn: Fetch svn branches only and have git recognize them as branches?
  2015-03-12 22:30 git-svn: Fetch svn branches only and have git recognize them as branches? Brian Koehmstedt
  2015-03-12 23:13 ` Junio C Hamano
@ 2015-03-12 23:33 ` Eric Wong
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Wong @ 2015-03-12 23:33 UTC (permalink / raw)
  To: Brian Koehmstedt; +Cc: git

Brian Koehmstedt <bkoehmstedt@berkeley.edu> wrote:
> My latest failed attempt was this:
> 
> [svn-remote "svn"]
>         url = http://abc.com/repo/branches
>         fetch = :refs/remotes/svn/branches
>         branches = *:refs/remotes/svn/*
> 
> git svn fetch svn
> This fetched all the branch directories as one branch.

You probably do not need the "fetch" line there, only:

[svn-remote "svn"]
        url = http://abc.com/repo/branches
        branches = *:refs/remotes/svn/*

I haven't used the branches/tags functionality of git-svn in
many years, though.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git-svn: Fetch svn branches only and have git recognize them as branches?
  2015-03-12 23:13 ` Junio C Hamano
@ 2015-03-12 23:51   ` Brian Koehmstedt
  2015-03-16 14:27     ` Brian Koehmstedt
  0 siblings, 1 reply; 5+ messages in thread
From: Brian Koehmstedt @ 2015-03-12 23:51 UTC (permalink / raw)
  To: git

Junio C Hamano <gitster <at> pobox.com> writes:
> 
>      git svn init --minimize-url \
>       --trunk http://repository-root/foo/trunk \
>       --branches http://repository-root/foo/branches \
>       --tags http://repository-root/foo/tags
> 
>     And this is where the new --minimize-url command-line switch
>     comes in to allow for this behavior to continue working.
> 
> The description of the commit makes me think that mimicking the
> sample command line without minimize-url ought to work, i.e.
> 
>     git svn init \
>         --trunk    http://abc.com/repo/trunk \
>         --branches http://abc.com/repo/branches \
>         --tags     http://abc.com/repo/tags
> 

Sounds like what I need.  But both of these are yielding the following error:

"E: 'http:/abc.com/foo/trunk' is not a complete URL  and a separate URL is
not specified"

Notice the one slash after http:.

Here's the exact script I'm running to test:

$ cat sample.sh 
#!/bin/sh

rm -rf .git

git svn init \
      --trunk http://abc.com/foo/trunk \
      --branches http://abc.com/foo/branches \
      --tags http://abc.com/foo/tags

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git-svn: Fetch svn branches only and have git recognize them as branches?
  2015-03-12 23:51   ` Brian Koehmstedt
@ 2015-03-16 14:27     ` Brian Koehmstedt
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Koehmstedt @ 2015-03-16 14:27 UTC (permalink / raw)
  To: git

Just to close the loop on this, I wasn't able to get git-svn to deal with
this remote repository the way I wanted, so what I did is write some perl
scripts to mirror the remote subversion repository locally and then use
git-svn on that local "fixed" svn mirror.

The hard part was mirroring the svn repo locally, primarily because the
remote subversion server was denying access to the root.  Also complicating
matters was the dump files weren't completely loading properly.

In case anyone else is needing to do this, I've published my perl script
code that overcame all these issues.  Here it is:
https://github.com/ucidentity/failsafe-svn-sync

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-16 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 22:30 git-svn: Fetch svn branches only and have git recognize them as branches? Brian Koehmstedt
2015-03-12 23:13 ` Junio C Hamano
2015-03-12 23:51   ` Brian Koehmstedt
2015-03-16 14:27     ` Brian Koehmstedt
2015-03-12 23:33 ` Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).