Don't show svn:externals in svn status
Asked Answered
P

3

24

I've made one svn:external in my repository. Everything works fine, except the output of the svn status command. In the output there is lot of information I don't need:

$ svn st
X      lib

Performing status on external item at 'lib'

I can run svn st --ignore-externals -q and I can place this line in a small script, but maybe there is better solution. How can I see status of my working copy without seeing info about externals?

Parthenon answered 7/5, 2010 at 14:36 Comment(4)
+1 I have the same problem, I would rather have liked --ignore-externals to be the default or configurable to become default.Buffalo
Just to be clear: -q (quiet mode) removes the line "X lib" and --ignore-externals removes the line "Performing status on external item at 'lib'". Best to update the answer based on this.Buffalo
For what it's worth, subversion.tigris.org/issues/show_bug.cgi?id=1935 has a lengthy discussion, which I have not yet finished reading. So far, it looks like a reasonable consensus on fixing this would have been established in 2004 ... /-:Containment
Oh, actually, the fix has been checked in and (if I understand correctly) is propsed to be included in release 1.8.0.Containment
B
4

That seems to be the proper way to ignore externals to appear in your svn status output.

Reference:

http://svnbook.red-bean.com/en/1.4/svn.ref.svn.html

Bigamy answered 7/5, 2010 at 15:48 Comment(2)
It's ancient history I know, but this answer needs to include the actual answer: links can break.Robespierre
svn status --ignore-externalsSoliloquy
E
0

Searching turns up a clever Bash script implementation that overrides the svn command with a script. However, I wanted to do something similar in Windows. Remove the svn directory from your PATH, then create a batch script named svn.bat and put it somewhere in your PATH (like C:\Windows):

@echo off
setlocal

if (%1)==(st) goto :match
if (%1)==(stat) goto :match
if (%1)==(status) goto :match

:: If not running Status command, just pass the args along
"C:\Program Files\SlikSvn\bin\svn" %*
goto :eof

:match

:: Init variables
set svnargs1=
set svnargs2=--ignore-externals

:: Loop through arguments
:loop
if "%~1"=="" goto :cont

:: Look for ignore externals flag
if "%~1"=="--examine-externals" (
    set svnargs2=
) else (
    if "%~1"=="-h" (
        set svnargs2=
    )

    set svnargs1=%svnargs1% %1%
)


shift & goto :loop
:cont

:: Call svn
"C:\Program Files\SlikSvn\bin\svn" %svnargs1% %svnargs2%
Electrobiology answered 8/2, 2012 at 17:53 Comment(0)
E
0

I think no answer yet really solves the problem in the sense that if changes in a part of svn:externals has been made, they of course should be displayed. This propably makes no sense for really external repositories. But I use svn:externals to add a general build folder from the same repository into projects (because no general hierarchie of the modules exist). And I don't want to use the options --ignore-externals -q as I loose information about unadded files and changes in the general build script I have done in this project (which I might want to commit). My solution was to patch the subversion java command line implemantation svnkit.

AbstractSVNCommand.registerCommand(new SVNStatusCommand());
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final PrintStream stream = new PrintStream(bos);

final SVNCommandLine commandLine = new SVNCommandLine();
commandLine.init(new String[] { "status", "PATH..." });

final SVNCommandEnvironment env = new SVNCommandEnvironment("mySvn", stream, stream, System.in);
env.init(commandLine);
env.initClientManager();

final SVNStatusCommand svnStatusCall = new SVNStatusCommand();
svnStatusCall.init(env);
svnStatusCall.run();
stream.flush();
String result = new String(bos.toByteArray());

StringBuffer buffer = new StringBuffer();
Scanner scanner = new Scanner(result);
while (scanner.hasNextLine()) {
    String line = scanner.nextLine();
    if (line.startsWith("X") || line.startsWith("Performing status on external item at")) {
        // ignore this output
    } else if (line.trim().isEmpty() == false) {
        buffer.append(line + "\n");
    }
}

System.out.println(buffer.toString());

This solves the problem because changes in externals are also marked with 'M' for modified...

Elaterid answered 31/10, 2012 at 7:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.