threads / discuss / 21773

Unable to checkout a particular SVN revision

Subject: Unable to checkout a particular SVN revision

## tl;dr

5 messages between Nov 28, 2009 and Dec 1, 2009.

replies: 4people: 3as markdown or json

Marc Liyanage· Nov 28, 2009, 02:05 UTC · lore
I'm trying to clone a specific SVN revision with git-svn:
    git svn clone -r 12345 https://host/svn/foo/branches/bar xyz
but it doesn't check out any files, I see just this:
    Initialized empty Git repository in /Users/liyanage/Desktop/xyz/.git
If I try the same thing with SVN like this:
    svn co -r 12345 https://host/svn/foo/branches/bar xyz
    
then I get what I expect, it checks out all the files and "svn info" gives me this revision.
I think it's because this particular revision wasn't committed on this branch, i.e. it doesn't show up in "svn log". If I try a revision that is listed in the log, it works as expected.
Is there a way to make this work?
    
Michael J Gruber· Nov 28, 2009, 15:03 UTC · re: Marc Liyanage · lore

Re: Unable to checkout a particular SVN revision

Marc Liyanage venit, vidit, dixit 28.11.2009 03:05:
Show 20 quoted lines
> 
> I'm trying to clone a specific SVN revision with git-svn:
> 
>     git svn clone -r 12345 https://host/svn/foo/branches/bar xyz
> 
> but it doesn't check out any files, I see just this:
> 
>     Initialized empty Git repository in /Users/liyanage/Desktop/xyz/.git
> 
> If I try the same thing with SVN like this:
> 
>     svn co -r 12345 https://host/svn/foo/branches/bar xyz
>     
> then I get what I expect, it checks out all the files and "svn info" gives me this revision.
> 
> 
> I think it's because this particular revision wasn't committed on this branch, i.e. it doesn't show up in "svn log". If I try a revision that is listed in the log, it works as expected.
> 
> 
> Is there a way to make this work?

No. Because "this" is different in the two cases above: "git svn clone" clones the history of an svn repo, and the command above clearly gives you the history of that branch in the specified revision range (consisting of 1 revision). It is empty.

"svn co" checks out a specific revision.
You cannot "clone" a revision.

If all you want is a git repository with no history, but with the files of a specific svn revision, you can svn co -r 12345 https://host/svn/foo/branches/bar xyz cd xyz git init find . -name .svn -print0 | xargs -0 rm -Rf git add . git commit -m "r12345 of branch bar"

Michael
Marc Liyanage· Nov 29, 2009, 06:41 UTC · re: Michael J Gruber · lore

Re: Unable to checkout a particular SVN revision

Thanks for the explanation so far.
On 28.11.2009, at 07:03, Michael J Gruber wrote:
> No. Because "this" is different in the two cases above: "git svn clone"
> clones the history of an svn repo, and the command above clearly gives
> you the history of that branch in the specified revision range
> (consisting of 1 revision). It is empty.
I still don't quite understand why it couldn't do the same thing as the SVN checkout. That does exactly what I expect, it reflects the state of that part of the repository at the time of that revision. Would this be possible, but it's simply not (yet) implemented?
The problem I'm dealing with are svn:externals definitions that are pegged to such revisions. SVN checks them out fine, but git svn doesn't, so I have to hunt down the appropriate revision manually.

______________________________ Marc Liyanage www.entropy.ch

skype mliyanage iChat liyanage@mac.com

Daniele Segato· Nov 29, 2009, 16:50 UTC · re: Marc Liyanage · lore

Re: Unable to checkout a particular SVN revision

Il giorno ven, 27/11/2009 alle 18.05 -0800, Marc Liyanage ha scritto:
Show 19 quoted lines
> I'm trying to clone a specific SVN revision with git-svn:
> 
>     git svn clone -r 12345 https://host/svn/foo/branches/bar xyz
> 
> but it doesn't check out any files, I see just this:
> 
>     Initialized empty Git repository in /Users/liyanage/Desktop/xyz/.git
> 
> If I try the same thing with SVN like this:
> 
>     svn co -r 12345 https://host/svn/foo/branches/bar xyz
>     
> then I get what I expect, it checks out all the files and "svn info" gives me this revision.
> 
> 
> I think it's because this particular revision wasn't committed on this branch, i.e. it doesn't show up in "svn log". If I try a revision that is listed in the log, it works as expected.
> 
> 
> Is there a way to make this work?

You had to understand the difference between a distributed version control system (git) and a centralized version control system (svn).

On SVN there is a central repository and all user checkout a SINGLE revision at a time, if they want to switch to another revision/branch they had to update the local files communicating with the central repository (can't work offline)

On Git you clone the ENTIRE history of a repository and you keep it (all) locally. If you want to switch to another "revision" or branch you can do it locally without interacting over network with a remote repository, if you want to commit you can do it locally and the first time you got connected to the network you can push your change to the remote repository and pull others changes.

Git-SVN is a tool that allow you to interact with an SVN repository using Git as client: the cool thing is that you get a lot of the features of a distributed repository even if you are interacting with a centralized one. The bad news is that cloning the first time is really really slow: this is because SVN has not been wrote to support distributed repository and is not optimized to allow cloning of all the history.

to made thinks clearer:
SVN:

svn checkout -r <revision> <url> # this connect to <url> and download that revision locally

GIT:

git svn clone <url> -T trunk -t tags -b branches # this connect to <url> and start from revision 1 to the last cloning all the repository (supposing you have a standard SVN structure with trunk/tags/branches)

this could keep a lot of time if it is a big repository (even days)
but when it is done you can checkout any revision:
git checkout <your-revision-commit>

git doesn't store the history as SVN do, revision numbers does NOT make sense in a distributed environment... it just keep revision numbars inside commits comments.. so you'll first had to search your revision number into the git log history and then checkout the corresponding commit.

Git is NOT another SVN client, is a completely different way of doing versioning and you had to understand this and stop trying to use git as you use svn until now

Marc Liyanage· Dec 1, 2009, 04:59 UTC · re: Daniele Segato · lore

Re: Unable to checkout a particular SVN revision

On 29.11.2009, at 08:50, Daniele Segato wrote:
> You had to understand the difference between a distributed version
> control system (git) and a centralized version control system (svn).
I understand that, I use (pure) git for all my personal projects, and it works great.
And even as a front end for SVN, I am *very* happy with what I got from git-svn so far, I think it is an excellent tool, even better than the actual SVN client. I track an SVN repository in my local git master branch, then branch off locally for development, send patches for review, reorder/consolidate/squash commits back onto my master branch and then dcommit that back to SVN. All that is great.
I would like to understand why 
   git svn clone -r n <url>
does not work as expected while
   git svn clone -r m <url>
does work perfectly fine, if that m revision number happens to have been committed on the particular SVN branch I cloned (you left off that -r in your git svn clone examples). As it is, I have to hunt for the next lower or higher revision number that happens to be on that branch.
I might be doing a poor job explaining what my question is... Basically, what prevents that operation from doing the same thing that SVN does? Lack of information, i.e. should I just clone higher up in the tree?

______________________________ Marc Liyanage www.entropy.ch

skype mliyanage iChat liyanage@mac.com

← back to recent threads