Don't show svn:externals in svn status

前端 未结 3 1357
被撕碎了的回忆
被撕碎了的回忆 2021-02-12 10:37

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 informa

3条回答
  •  醉酒成梦
    2021-02-12 10:49

    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...

提交回复
热议问题