subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris <devnullacco...@yahoo.se>
Subject Re: auto-props syntax in file vs. property
Date Wed, 10 Jan 2018 08:26:00 GMT
I think the fix to svn_apply_autoprops.py should be something like below (/subversion/trunk/contrib/client-side/svn_apply_autoprops.py)
If anyone with commit rights wants to fix it on the repo, feel free to use the below, or improve
it as necessary (my python knowledge is non-existing)

Index: svn_apply_autoprops.py
===================================================================
--- svn_apply_autoprops.py      (revision 103617)
+++ svn_apply_autoprops.py      (revision 103618)
@@ -101,7 +101,11 @@
     # leading and trailing whitespce from the propery names and
     # values.
     props_list = []
-    for prop in props.split(';'):
+    # Since ;; is a separator within one property, we need to do
+    # regex and use both negative lookahead and lookbehind to avoid
+    # ever matching a more than one semicolon in the split
+    semicolonpattern = re.compile("(?<!;);(?!;)")
+    for prop in re.split(semicolonpattern, props):
       prop = prop.strip()
       if not len(prop):
         continue

/Chris

--------------------------------------------
On Wed, 1/10/18, Chris <devnullaccount@yahoo.se> wrote:

 Subject: Re: auto-props syntax in file vs. property
 To: users@subversion.apache.org, "Daniel Shahaf" <d.s@daniel.shahaf.name>
 Date: Wednesday, January 10, 2018, 8:25 AM
 
 Hi Daniel,
 
 thanks for the reply.
 You're right that it seems to work when
 I do "svn add" and with that config file, but when I do the
 same with svn_apply_autoprops.py, it acts badly. I simply
 forgot to check the regular add :)
 So I get the problem when I do:
   ./svn_apply_autoprops.py
 --config myconfig /path/to/workspace
 
 Then it will set charset and mime-type
 as two separate properties.
 (and yes, it sets 3 properties overall,
 I just meant that the mime-type got split into two)
 
 I guess there's something in the parser
 in svn_apply_autoprops that is misbehaving rather than svn
 itself. A quick look in that file shows this line:
     for prop in
 props.split(';'):
 Which I suspect is the root cause of
 the issue, although I haven't verified it yet. I guess I
 need to figure out some python basics and see if I can
 ugly-hack that to work for double semicolons.
 
 /Chris
 
 --------------------------------------------
 On Tue, 1/9/18, Daniel Shahaf <d.s@daniel.shahaf.name>
 wrote:
 
  Subject: Re: auto-props syntax in file
 vs. property
  To: users@subversion.apache.org
  Date: Tuesday, January 9, 2018, 5:05
 PM
  
  Chris wrote on Tue, 09 Jan 2018
  15:15 +0000:
  > When setting
  svn:auto-props, it seems I can do
 this:
  >
  
  >  *.java =
 
 svn:mime-type=text/java;;charset=iso-8859-1;svn:eol-style=LF
  > 
  > That is, use ;; as
  an escape between the "parameters" for
 file type
  and 
  > charset. Adding a java-file and
  doing propget gives this:
  >
  text/java;charset=iso-8859-1
  > Which
  seems to be correct. Right?
  
  Yes.
  
  >
  Using the exact same line in
 ~/.subversion/config seems to
  see "charset" 
  > as a separate
  property from "mime-type" and set two
 different
  properties 
  > on the file with
  "charset" having no meaning.
  
  I can't reproduce this.  With that
 line in
  ~/.subversion/config I get:
  
  [[[
  % svn add foo.java 
  A         foo.java
  % svn pl
  -v foo.java
  Properties on
  'foo.java':
    svn:eol-style
      native
    svn:mime-type
      text/java;charset=iso-8859-1
  ]]]
  
  (The value
  'native' was inherited from
 svn:auto-props in the
  working
  copy I was testing in.)
  
  Also, does it really set *two*
  properties on the file?  Not
 three? 
  "svn:mime-type",
  "charset",
  "svn:eol-style"?
  
  What client and version do you use?
  
  Cheers,
  
  Daniel
  

Mime
View raw message