# git svn show-externals output format

3 messages from 2017-08-19 to 2017-08-19. Participants: Alexander Groß, Andreas Heiduk.
Thread: https://gitlist.dev/t/46626

## Alexander Groß, 2017-08-19 08:24

Subject: git svn show-externals output format
Message-ID: <CACcHa=NYgir8HDeR1ES9mKsqTQYk=90Z38csTgK-vfD=fQmHLg@mail.gmail.com>
URL: https://gitlist.dev/e/CACcHa%3DNYgir8HDeR1ES9mKsqTQYk%3D90Z38csTgK-vfD%3DfQmHLg%40mail.gmail.com

```
Hi all,

I am playing with svn-to-git conversion and wanted to have a look at
the svn:externals of a test SVN repository.

$ git svn clone svn://svn.code.sf.net/p/svn-to-git/code/ svn-to-git-code

The SVN repo in HEAD revision contains three externals:

$ cd svn-to-git-code
$ git svn show-externals

# /trunk/
/trunk/https://svn.code.sf.net/p/gc-webdav/svn webdav
/trunk/https://svn.code.sf.net/p/gc-webdav/svn@1 webdav-at-revision

# /trunk/sub directory/
/trunk/sub directory/https://svn.code.sf.net/p/gc-webdav/svn 'webdav in subdir'

An earlier version contains just one external:

$ git svn show-externals --revision 8

# /trunk/
/trunk/webdav https://svn.code.sf.net/p/gc-webdav/svn/

It seems like the output is inconsistent. In SVN revision 8 the output
looks like it's formatted like
<path> <URL>

In the HEAD revision it looks mangled
<path prefix><URL> <path suffix>

This makes consuming the output of git svn show-externals in HEAD
difficult because the parts are not clearly separated by space and
sometimes the path is the first element, sometimes it's a combination
of first and last elements.

I am able to checkout both revisions including externals using native svn.

Am I doing something wrong?

Thanks!


Alex
-- 
Alexander Groß
http://therightstuff.de/

```

## Andreas Heiduk, 2017-08-19 10:14

Subject: Re: git svn show-externals output format
Message-ID: <165f5000-df53-0b62-6b06-d628a09d3076@gmail.com>
URL: https://gitlist.dev/e/165f5000-df53-0b62-6b06-d628a09d3076%40gmail.com
In-Reply-To: <CACcHa=NYgir8HDeR1ES9mKsqTQYk=90Z38csTgK-vfD=fQmHLg@mail.gmail.com>

```
Am 19.08.2017 um 10:24 schrieb Alexander Groß:

> $ git svn show-externals
> 
> # /trunk/
> /trunk/https://svn.code.sf.net/p/gc-webdav/svn webdav
> /trunk/https://svn.code.sf.net/p/gc-webdav/svn@1 webdav-at-revision

This is the (bugged) output of `git svn show-externals` for "new
style" svn:externals.

> 
> # /trunk/sub directory/
> /trunk/sub directory/https://svn.code.sf.net/p/gc-webdav/svn 'webdav in subdir'
> 
> An earlier version contains just one external:
> 
> $ git svn show-externals --revision 8
> 
> # /trunk/
> /trunk/webdav https://svn.code.sf.net/p/gc-webdav/svn/

And that the proper output for "old style" svn:externals.

> It seems like the output is inconsistent. [...]

SVN changed/extended the svn:externals format in version 1.5.
(See [1] for details). One thing is - they switched the
order of the arguments. `git svn` dit not pick up these changes
and hence interprets the new format incorrectly. See [2] for 
a similar discussion - it is from 2012!

> This makes consuming the output of git svn show-externals in HEAD
> difficult because the parts are not clearly separated by space and
> sometimes the path is the first element, sometimes it's a combination
> of first and last elements.

My practical solution was to skip the man in the middle and ask the SVN
server directly for the property values with something like that:

    svn propget svn:externals -r 42 http://my-repo-url/path/to/ext/dir

I used the output to hardcode the values during the conversion.



[1] http://svnbook.red-bean.com/en/1.8/svn.advanced.externals.html
[2] https://public-inbox.org/git/E59CCE45-6F92-4748-9B6E-2A562647904B@nikolaus-demmel.de/

```

## Alexander Groß, 2017-08-19 12:59

Subject: Re: git svn show-externals output format
Message-ID: <CACcHa=M_9xaP83=gha3Z4KNd12MfC+C1hE3hOMv-qjQBtMt0Ww@mail.gmail.com>
URL: https://gitlist.dev/e/CACcHa%3DM_9xaP83%3Dgha3Z4KNd12MfC%2BC1hE3hOMv-qjQBtMt0Ww%40mail.gmail.com
In-Reply-To: <165f5000-df53-0b62-6b06-d628a09d3076@gmail.com>

```
> My practical solution was to skip the man in the middle and ask the SVN
> server directly for the property values

Thanks, that helped a lot!

Alex
Beste Grüße,

Alex
-- 
Alexander Groß
http://therightstuff.de/


On Sat, Aug 19, 2017 at 12:14 PM, Andreas Heiduk <asheiduk@gmail.com> wrote:
> Am 19.08.2017 um 10:24 schrieb Alexander Groß:
>
>> $ git svn show-externals
>>
>> # /trunk/
>> /trunk/https://svn.code.sf.net/p/gc-webdav/svn webdav
>> /trunk/https://svn.code.sf.net/p/gc-webdav/svn@1 webdav-at-revision
>
> This is the (bugged) output of `git svn show-externals` for "new
> style" svn:externals.
>
>>
>> # /trunk/sub directory/
>> /trunk/sub directory/https://svn.code.sf.net/p/gc-webdav/svn 'webdav in subdir'
>>
>> An earlier version contains just one external:
>>
>> $ git svn show-externals --revision 8
>>
>> # /trunk/
>> /trunk/webdav https://svn.code.sf.net/p/gc-webdav/svn/
>
> And that the proper output for "old style" svn:externals.
>
>> It seems like the output is inconsistent. [...]
>
> SVN changed/extended the svn:externals format in version 1.5.
> (See [1] for details). One thing is - they switched the
> order of the arguments. `git svn` dit not pick up these changes
> and hence interprets the new format incorrectly. See [2] for
> a similar discussion - it is from 2012!
>
>> This makes consuming the output of git svn show-externals in HEAD
>> difficult because the parts are not clearly separated by space and
>> sometimes the path is the first element, sometimes it's a combination
>> of first and last elements.
>
> My practical solution was to skip the man in the middle and ask the SVN
> server directly for the property values with something like that:
>
>     svn propget svn:externals -r 42 http://my-repo-url/path/to/ext/dir
>
> I used the output to hardcode the values during the conversion.
>
>
>
> [1] http://svnbook.red-bean.com/en/1.8/svn.advanced.externals.html
> [2] https://public-inbox.org/git/E59CCE45-6F92-4748-9B6E-2A562647904B@nikolaus-demmel.de/

```
