git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to prefix existing svn remotes?
@ 2009-01-22 17:32 Sébastien Mazy
  2009-01-23 11:13 ` Michael J Gruber
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Mazy @ 2009-01-22 17:32 UTC (permalink / raw)
  To: git

Hi all,


I created a few months ago a git-svn repository using:
git svn clone -s https://my_svn_repo .

wich also created the following remotes:
git branch -r
  branch0
  tags/tag0
  trunk

I would like to prefix theses remotes, so that it shows:
git branch -r
  prefix/branch0
  prefix/tags/tag0
  prefix/trunk

Of course I should have used the -prefix back when creating the repo but
it's too late. 'git help svn' doesn't explain how to achieve that and
simply editing .git/config to add the missing prefix will cause the next
'git svn fetch' to download again the whole history (which in my case is
huge).


Is it possible? Did I miss something obvious?


Cheers,

-- 
Sébastien Mazy

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

* Re: How to prefix existing svn remotes?
  2009-01-22 17:32 How to prefix existing svn remotes? Sébastien Mazy
@ 2009-01-23 11:13 ` Michael J Gruber
  2009-01-23 12:42   ` Sébastien Mazy
  0 siblings, 1 reply; 6+ messages in thread
From: Michael J Gruber @ 2009-01-23 11:13 UTC (permalink / raw)
  To: Sébastien Mazy; +Cc: git

Sébastien Mazy venit, vidit, dixit 22.01.2009 18:32:
> Hi all,
> 
> 
> I created a few months ago a git-svn repository using:
> git svn clone -s https://my_svn_repo .
> 
> wich also created the following remotes:
> git branch -r
>   branch0
>   tags/tag0
>   trunk
> 
> I would like to prefix theses remotes, so that it shows:
> git branch -r
>   prefix/branch0
>   prefix/tags/tag0
>   prefix/trunk
> 
> Of course I should have used the -prefix back when creating the repo but
> it's too late. 'git help svn' doesn't explain how to achieve that and
> simply editing .git/config to add the missing prefix will cause the next
> 'git svn fetch' to download again the whole history (which in my case is
> huge).
> 
> 
> Is it possible? Did I miss something obvious?

Yes! Depends!

The following works for me:

0) fetch to make sure you're current (optional)
1) edit .git/config and add the prefix (right hand side of the
refpsecs), or really rename in any way you want
2) rename the existing remote branches in the same way

The next git svn fetch will rebuild the map file (which is fast) but not
refetch any svn revisions you already have.

Regarding the renaming: Either I'm dumb or current git branch can't
rename git svn branches. I guess it's because they are remotes but not
really. I had to resort to git update-ref. I'll look into that.

Michael

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

* Re: How to prefix existing svn remotes?
  2009-01-23 11:13 ` Michael J Gruber
@ 2009-01-23 12:42   ` Sébastien Mazy
  2009-01-23 13:02     ` Michael J Gruber
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Mazy @ 2009-01-23 12:42 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git

Hi Michael,

Thanks for your reply.

On Fri, Jan 23, 2009 at 12:13:18PM +0100, Michael J Gruber wrote:
> The following works for me:
> 
> 0) fetch to make sure you're current (optional)
> 1) edit .git/config and add the prefix (right hand side of the
> refpsecs), or really rename in any way you want

OK.

> 2) rename the existing remote branches in the same way

I'm not sure how I can do it. 'trunk' is the only remote-tracking svn
branches under .git/refs/. Here is how it looks:

ls -R .git/refs
 .git/refs:  heads  remotes  tags
 .git/refs/heads:  master
 .git/refs/remotes:  trunk

Still, a 'branch0' remote exist:

git show-ref
 refs/heads/master
 refs/remotes/branch0
 refs/remotes/trunk

-- 
Sébastien Mazy

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

* Re: How to prefix existing svn remotes?
  2009-01-23 12:42   ` Sébastien Mazy
@ 2009-01-23 13:02     ` Michael J Gruber
  2009-01-23 17:13       ` Sébastien Mazy
  0 siblings, 1 reply; 6+ messages in thread
From: Michael J Gruber @ 2009-01-23 13:02 UTC (permalink / raw)
  To: Sébastien Mazy; +Cc: git

Sébastien Mazy venit, vidit, dixit 23.01.2009 13:42:
> Hi Michael,
> 
> Thanks for your reply.
> 
> On Fri, Jan 23, 2009 at 12:13:18PM +0100, Michael J Gruber wrote:
>> The following works for me:
>>
>> 0) fetch to make sure you're current (optional)
>> 1) edit .git/config and add the prefix (right hand side of the
>> refpsecs), or really rename in any way you want
> 
> OK.
> 
>> 2) rename the existing remote branches in the same way
> 
> I'm not sure how I can do it. 'trunk' is the only remote-tracking svn
> branches under .git/refs/. Here is how it looks:
> 
> ls -R .git/refs
>  .git/refs:  heads  remotes  tags
>  .git/refs/heads:  master
>  .git/refs/remotes:  trunk
> 
> Still, a 'branch0' remote exist:
> 
> git show-ref
>  refs/heads/master
>  refs/remotes/branch0
>  refs/remotes/trunk

You can do (bash)

for b in trunk branch0
do
  git update-ref refs/remotes/yournewprefix/$b refs/remotes/$b
  git update-ref -d refs/remotes/$b
done

OTOH, any incarnation of "git -m" (with or without "-r", specifying
refs/remotes/trunk, remotes/trunk or trunk) failed.

Michael

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

* Re: How to prefix existing svn remotes?
  2009-01-23 13:02     ` Michael J Gruber
@ 2009-01-23 17:13       ` Sébastien Mazy
  2009-01-23 17:51         ` Jakub Narebski
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Mazy @ 2009-01-23 17:13 UTC (permalink / raw)
  To: Michael J Gruber; +Cc: git

On Fri, Jan 23, 2009 at 02:02:31PM +0100, Michael J Gruber wrote:
> You can do (bash)
> 
> for b in trunk branch0
> do
>   git update-ref refs/remotes/yournewprefix/$b refs/remotes/$b
>   git update-ref -d refs/remotes/$b
> done

That did the trick. Thank you so much!

By the way, my renamed remote tracking svn branches now show under
.git/refs/ as expected.

-- 
Sébastien Mazy

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

* Re: How to prefix existing svn remotes?
  2009-01-23 17:13       ` Sébastien Mazy
@ 2009-01-23 17:51         ` Jakub Narebski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2009-01-23 17:51 UTC (permalink / raw)
  To: git

Sébastien Mazy wrote:

> By the way, my renamed remote tracking svn branches now show under
> .git/refs/ as expected.

They were inside file .git/packed-refs
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

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

end of thread, other threads:[~2009-01-23 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-22 17:32 How to prefix existing svn remotes? Sébastien Mazy
2009-01-23 11:13 ` Michael J Gruber
2009-01-23 12:42   ` Sébastien Mazy
2009-01-23 13:02     ` Michael J Gruber
2009-01-23 17:13       ` Sébastien Mazy
2009-01-23 17:51         ` Jakub Narebski

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).