Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn diff doesn't show modified external files

I add some changes to my local repo and run svn diff, but diff output is empty. But svn status marked my files as modified. This is files is external items, how can I use diff command with this?

like image 362
Gr1N Avatar asked Jul 12 '12 13:07

Gr1N


4 Answers

Here is a quote from the manual:

Besides the svn checkout, svn update, svn switch, and svn export commands which actually manage the disjoint (or disconnected) subdirectories into which externals are checked out, the svn status command also recognizes externals definitions. It displays a status code of X for the disjoint external subdirectories, and then recurses into those subdirectories to display the status of the external items themselves. You can pass the --ignore-externals option to any of these subcommands to disable externals definition processing.

One can deduce from the above that only the mentioned commands support externals.

I do not know why it is so, but my hunch is that it was relatively difficult to design properly and was not high on the feature list.

like image 158
malenkiy_scot Avatar answered Sep 24 '22 03:09

malenkiy_scot


You can use this shell one-liner:

svn st -q | grep '^[AM]' | cut -c9- | xargs svn diff

Explanation:

  1. svn st -q takes the output of SVN status without additional lines (“quiet”).
  2. grep '^[AM]' filters added and modified files.
  3. cut -c9- cuts the metadata away and passes the paths further.
  4. xargs svn diff runs svn diff for each file.
like image 30
Melebius Avatar answered Sep 25 '22 03:09

Melebius


This is logical because The reason is that the svn status shows status with respect to the last revision of the trunk. it means that your local is not updated to the last revision on the trunk. By taking the svn info you would see that the

Path: /home/....
Working Copy Root Path: /home/trunk
URL: https://svn.***.**/trunk
Repository Root: https://svn.***.**/
Repository UUID: 
Revision: **LAST_UPDATED_REVISION_Nr**

However, the svn diff shows the difference between your local file and file situation in your LAST_UPDATED_REVISION_Nr. In order to see the difference with respect to the last revision on trunk:

svn diff -rHEAD address_of_your_file
like image 25
H'H Avatar answered Sep 24 '22 03:09

H'H


You'll need to use an external program to do it. I wrote this script which seems to do the job well.

<?php
passthru('svn diff');
exec('svn propget svn:externals',$externals);
foreach($externals as $line) {
    list($local, $path) = explode(' ',$line);
    passthru('svn diff '.$local);
}
?>
like image 35
Tim Avatar answered Sep 24 '22 03:09

Tim