Arc parses svn property changes incorrectly

Observed Behavior:
svn diff outputs properties without newlines at the end followed by

\ No newline at end of property

e.g.

Index: aff.php
===================================================================
--- aff.php     (nonexistent)
+++ aff.php     (working copy)
@@ -0,0 +1 @@
+oi

Property changes on: aff.php
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property

Arc parses this note as part of the property when arc diff is run. This directly affects phabricator’s revision page, which shows it too:
2019-03-21-165713_523x226_scrot

Additionally, arc patch also tries to apply the property change using this invalid value:

svn: E135001: Unrecognized line ending style 'native
\ No newline at end of property' for '/home/user/svn/aff.php'

Expected Behavior:
\ No newline at end of property should not be considered part of the property value

Phabricator Version:

phabricator
    0e067213fbb17e5f06d78fcb2081e04f3907e94c (Dec 10 2018) 
arcanist
    3534d2baca4bf6dcdac46c49164bf5ba3a6660ad (Nov 8 2018) 
phutil
    1e590fd9e58e1e5e07954ad1ddc25a78add62abd (Dec 6 2018) 
diff
    3.2 at /usr/bin/diff 
git
    2.1.4 at /usr/bin/git 
hg
    Not Available 
pygmentize
    1.5 at /usr/bin/pygmentize 
svn
    1.8.19 at /usr/bin/svn 

Reproduction Steps:

  1. echo hello > hello.txt;
  2. svn propset svn:eol-style native;
  3. Create diff;
  4. Look at the changes on phabricator, they should include the newline message;
  5. Clean local copy;
  6. arc patch DXXXX;
  7. Confirm that arc tried to include the newline message in the property value.

Proposed Fix:

I was able to fix this issue on my local dev environment by telling arc to ignore lines beginning with \ in the property value. We cannot match the whole string, as it may be localized. I imagine an appropriate solution would be similar to this, with a dedicated comment, and maybe its own if:

*** src/parser/ArcanistDiffParser.php.orig      2019-03-21 20:11:08.326005329 +0000
--- src/parser/ArcanistDiffParser.php   2019-03-21 19:39:14.452524483 +0000
***************
*** 473,479 ****
          break;
        }
        $trimline = ltrim($line);
!       if ($trimline && $trimline[0] == '#') {
          // in svn1.7, a line like ## -0,0 +1 ## is put between the Added: line
          // and the line with the property change. If we have such a line, we'll
          // just ignore it (:
--- 473,479 ----
          break;
        }
        $trimline = ltrim($line);
!       if ($trimline && ($trimline[0] == '#' || $trimline[0] == '\\')) {
          // in svn1.7, a line like ## -0,0 +1 ## is put between the Added: line
          // and the line with the property change. If we have such a line, we'll
          // just ignore it (:
2 Likes

Works for me. Thanks.