8

I work with another developer in the same working copy (I know that is a bad idea), we usually do updated of individual files, and now we have files in some revision and others in another. How can I see a list of files with their respectives revision numbers? (The working copy is in a linux box, and we're using svn command line.

Thanks in advance for any help

3
  • 3
    I'm sorry for doing this, but I can't stop myself from asking: If you know it's a bad idea, why do you do this? Commented Aug 9, 2010 at 20:28
  • The problem occurs in a working copy that is the production folder where apache runs. Sometimes when we need to solve a bug rapidly we use directly that working copy. Commented Sep 9, 2010 at 18:23
  • 2
    This is a terrible idea. You're just as likely to create problems rapidly as you are to fix them rapidly. Commented Feb 4, 2013 at 17:23

6 Answers 6

9

Try this in your working copy

svn info *

or

svn info -R *

to see all files and directories recursively

You may type svn help info to see other options

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, but I looking for the versions of all subdirectories and files recursively. That only show me the versions of the files in the parent directory.
5
svn -R list --verbose

It will give output like this

109 authorname 3818 Nov 20 2012 JSON/xyz.json

Comments

3

svn info -R . | egrep "^Path:|^Revision:" | paste - -

Which means

  • Recursively get info of every file in the sub tree rooted at the current directory
  • Keep only lines beginning with "Path:" or "Revision:"
  • Join the Path/Revision lines onto a single line

Produces output like this:

Path: Tools/xmlvalidator    Revision: 69114
Path: Tools/xmlvalidator/main.c Revision: 69114

Comments

2

The svnversion command may be what you need as it will show the range of revisions in the working copy.

2 Comments

@JonathonReinhart - this post states an answer. Although it also contains a link, the link is not necessary for the answer to be valid. The key puzzle here is knowing what command to use, and this provides that information in a stand alone fashion.
@ChrisStratton Agreed. I was a bit over-zealous on the review.
0

Finally I used combined solution using the command posted by Dmitry Yudakov and a litle script in js-rhino. Now I can find all the files with a different revision number doing something like:

svn info -R > tmp_info rhino read-svn.js | grep -v 295

/* The script */ 
lines = readFile("tmp_info").split("\n");  
lines.pop();
String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g,"");
}
var idx = 0;
var files = [];
files[0] = {};
var line;
for (i in lines) {
  line = lines[i].toString();
  if(line.length) { 
    key = line.split(':')[0];
    if(key == 'Name' || key == 'Revision' || key == 'Path')
      files[idx][key] = line.split(':')[1];
  } else {
    idx++;
    files[idx] = {};
  }
}

print( 'files : ' + files.length + "\n");
for (i = 0; i< files.length ; i++) {
  var file = files[i];
  if(typeof(file.Name) !== "undefined")
    print(" REVISION: " + file.Revision.trim() + ' -  ' + file.Path.trim() +'/' + file.Name.trim() );
}

Comments

0

Same program in php:

svn info -R > tmp_info && php versions.php

<?php
$lines = explode("\n",file_get_contents("tmp_info"));
array_pop($lines);

$idx = 0;
$files = array();
$files[] = array();

foreach($lines as $i => $line) {
  if(!empty($line)) { 
    $spl = explode(':',$line);
    $key = $spl[0];
    if($key == 'Name' || $key == 'Revision' || $key == 'Path')
      $files[$idx][$key] = $spl[1];
  } else {
    $idx++;
    $files[$idx] = array();
  }
}


echo  'files : ' . count($files) . "\n";
foreach($files as $file) {
  if(isset($file["Name"]))
    echo " REVISION: " . trim($file["Revision"]) . ' -  ' . trim($file["Path"]) .'/' . trim($file["Name"]) . "\n";
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.