Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read content of a file off a remote svn repo without checking it out locally

Tags:

bash

ruby

svn

(Thanks in advance, SOers!)

Problem I'm trying to solve

Is there a way (e.g., in bash or in ruby) to read the content of a file on a remote svn repo without first checking it out locally and read it locally, given I have the path to it (e.g., "svn+ssh://svn.something/folder/morefolder/something.txt")

Things I've tried or thought of trying

There isn't a counterpart for something like more or less as an svn option. Looking at the list of available options for the svn command, the closest possible thing I can think of to achieve this is something along the line of

  1. Using svn praise [svn file path], and then
  2. Parse it accordingly (in my program or in bash) to extract what I want out of it.

Additional Note

I've googled and looked around on StackOverflow, and it seems like no one else (or at least I haven't yet come across anyone) has discussed about this problem/usecase. I have a legit reason for this specific need but I do wonder if I'm missing anything in my thought process.

Please let me know if I'm missing any info in this question. Thanks again!

like image 435
Alex Ku Avatar asked Apr 28 '12 19:04

Alex Ku


People also ask

What is check in and check out in svn?

The Checkout command is used to copy the files from the SVN repository to the working copy. If we want to access files from the SVN server, then we have to check out it first. The checkout operation creates a working copy of the repository where we can edit, delete, or add contents.

How do I view svn files?

SVN Checkout First then, In a directory create a new folder where you'll check the repository contents out to. It's important that we don't drill down into this folder. We want to check the contents of our repository out into this folder. So we right-click on this folder and select 'SVN Checkout…'

How do I checkout code from svn to local repository?

Check out files from Subversion repositoryIn the Get from Version Control dialog, click Add Repository Location and specify the repository URL. Click Check Out. In the dialog that opens, specify the destination directory where the local copy of the repository files will be created, and click OK.


1 Answers

Have you tried svn cat? I believe that's precisely the functionality you are seeking.

Here's the documentation http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.cat.html

This command conveniently outputs the contents of the remote repository URL to stdout.

like image 52
Tom McClure Avatar answered Nov 14 '22 22:11

Tom McClure