You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ryan Schmidt <su...@ryandesign.com> on 2008/09/21 09:23:05 UTC

Retroactively adding versioned properties to files in a dumpfile

Anybody know how I can retroactively add properties to files? I'd  
like to set svn:mime-type and svn:executable correctly for all my files.

I've used svndumptool.py [1] to clean up some other things in my  
repository dump, but I'm not finding this feature. I find features  
that are close:

There's "svndumptool.py transform-prop" to change an existing  
versioned property.
There's "svndumptool.py edit --propdel" to delete a versioned property.
There's "svndumptool.py eolfix" to set or change the svn:eol-style  
property and rewrite files' contents accordingly.

What I'd sure like is "svndumptool.py set-prop" with which I could  
set a property on files by regex, regardless of whether the property  
was already set or not.

Or maybe even better, a way for svndumptool.py to use the autoprops  
section of my config file and rewrite history as if I'd had that  
config file in place when adding every file.


[1] http://svn.borg.ch/svndumptool/



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Retroactively adding versioned properties to files in a dumpfile

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 21, 2008, at 7:16 PM, Martin Furter wrote:

> On Sun, 21 Sep 2008, Ryan Schmidt wrote:
>
>> On Sep 21, 2008, at 6:54 PM, Martin Furter wrote:
>>
>>> Please try the new svndumptool command 'apply-autoprops'. I hope  
>>> it does what you want (you need trunk).
>>> svndumptool.py apply-autoprops input.dmp output.dmp

[snip]

>> Will this also handle eol transformations, or do I need to  
>> separately use svndumptool.py eolfix?

[snip]

> I always wanted to redesign svndumptool to be able to chain  
> commands, but that's not done yet.
>
> So you still have to run it once for each command you need.

I realize there's no command chaining, but I was thinking of this  
scenario:

I add a DOS text file foo.txt to a repository. It has CRLF line  
endings. I apply no properties to the file before committing it.

Later I add the auto-props rule "*.txt = svn:eol-style=native" to my  
config file. That's great for new files but I'd like old files to  
have the correct line endings too, even when looking at historical  
versions.

svndumptool 0.5.0 already has the function "eolfix" so I can fix this  
by dumping the repository and running:


$ svndumptool.py eolfix --fix=CRLF --eol-style=native --regexp='\.txt 
$' repo.dump eolfix.dump


If I examine the difference between these dumps, I see that the  
property has been added and the content of the files has been changed  
(the line endings have presumably been changed from CRLF to LF):


$ svndumptool.py diff repo.dump eolfix.dump
Comparing
   dump1: 'repo.dump'
   dump2: 'eolfix.dump'
Revision: 1/1
   Node: add file 'foo.txt' (0/0)
     Properties:
+     Property 'svn:eol-style' missing in dump1
         dump2: 'native'
+   Different TextLen:
       dump1: '14'
       dump2: '12'
+   Different TextMD5:
       dump1: '7ac062d8a84466e70d9b899c0821a51c'
       dump2: '0f723ae7f9bf07744445e93ac5595156'
+   Text differs (type 'Text')
Revision: 2/2
   Node: change file 'foo.txt' (0/0)
+   Different TextLen:
       dump1: '32'
       dump2: '27'
+   Different TextMD5:
       dump1: '70c9e53fc3a0a449255aa3cbc7b61b1a'
       dump2: '62f7f37725498bb4c31353fc49d0d107'
+   Text differs (type 'Text')
Done, found diffs.
   type              total  showed
   Text                  2       2
   PropMissing           1       1
   TextMD5               2       2
   TextLen               2       2
$


This seems to do what I need, however it is tedious to specify line  
ending styles and regular expressions on the command line. I've  
already defined in my auto-props what files I want to have what line  
endings.

Now you have a new command "apply-autoprops" which seems like it  
would be a much easier way to do the same thing (and much more):


$ svndumptool.py apply-autoprops repo.dump autoprops.dump


However, it only applies the property; it does not normalize the line  
endings in the file to LF:


$ svndumptool.py diff repo.dump autoprops.dump
Comparing
   dump1: 'repo.dump'
   dump2: 'autoprops.dump'
Revision: 1/1
   Node: add file 'foo.txt' (0/0)
     Properties:
+     Property 'svn:eol-style' missing in dump1
         dump2: 'native'
Done, found diffs.
   type              total  showed
   PropMissing           1       1
$


I was under the impression that if a file in the repository has the  
svn:eol-style property set (to any value), then the file in the  
repository must have only LF line endings. So my hope was that when  
"apply-autoprops" encounters the svn:eol-style property, it would  
automatically perform the "eolfix" function.

However I will say that loading autoprops.dump into a new repository  
with Subversion 1.5.2 worked fine, as did checking it out, and the  
file in the working copy had LF line endings like it should (I'm on  
Mac OS X where LF is the native line ending style).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Retroactively adding versioned properties to files in a dumpfile

Posted by Martin Furter <mf...@rola.ch>.

On Sun, 21 Sep 2008, Ryan Schmidt wrote:

> On Sep 21, 2008, at 6:54 PM, Martin Furter wrote:
>
>> On Sun, 21 Sep 2008, Ryan Schmidt wrote:
>> 
>>> Anybody know how I can retroactively add properties to files? I'd like to 
>>> set svn:mime-type and svn:executable correctly for all my files.
>>> 
>>> I've used svndumptool.py [1] to clean up some other things in my 
>>> repository dump, but I'm not finding this feature. I find features that 
>>> are close:
>>> 
>>> There's "svndumptool.py transform-prop" to change an existing versioned 
>>> property.
>>> There's "svndumptool.py edit --propdel" to delete a versioned property.
>>> There's "svndumptool.py eolfix" to set or change the svn:eol-style 
>>> property and rewrite files' contents accordingly.
>>> 
>>> What I'd sure like is "svndumptool.py set-prop" with which I could set a 
>>> property on files by regex, regardless of whether the property was already 
>>> set or not.
>>> 
>>> Or maybe even better, a way for svndumptool.py to use the autoprops 
>>> section of my config file and rewrite history as if I'd had that config 
>>> file in place when adding every file.
>>> 
>>> 
>>> [1] http://svn.borg.ch/svndumptool/
>> 
>> Please try the new svndumptool command 'apply-autoprops'. I hope it does 
>> what you want (you need trunk).
>> 
>> svndumptool.py apply-autoprops input.dmp output.dmp
>
> Wow, that sounds great!
>
> It's not mentioned in the README yet... Will this also handle eol 
> transformations, or do I need to separately use svndumptool.py eolfix?

Heh, I didn't write any documentation at all, just hacked the feature...

I always wanted to redesign svndumptool to be able to chain commands, but 
that's not done yet.

So you still have to run it once for each command you need.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Retroactively adding versioned properties to files in a dumpfile

Posted by Martin Furter <mf...@rola.ch>.

On Sun, 21 Sep 2008, Ryan Schmidt wrote:

> On Sep 21, 2008, at 6:54 PM, Martin Furter wrote:
>
>> On Sun, 21 Sep 2008, Ryan Schmidt wrote:
>> 
>>> Anybody know how I can retroactively add properties to files? I'd like to 
>>> set svn:mime-type and svn:executable correctly for all my files.
>>> 
>>> I've used svndumptool.py [1] to clean up some other things in my 
>>> repository dump, but I'm not finding this feature. I find features that 
>>> are close:
>>> 
>>> There's "svndumptool.py transform-prop" to change an existing versioned 
>>> property.
>>> There's "svndumptool.py edit --propdel" to delete a versioned property.
>>> There's "svndumptool.py eolfix" to set or change the svn:eol-style 
>>> property and rewrite files' contents accordingly.
>>> 
>>> What I'd sure like is "svndumptool.py set-prop" with which I could set a 
>>> property on files by regex, regardless of whether the property was already 
>>> set or not.
>>> 
>>> Or maybe even better, a way for svndumptool.py to use the autoprops 
>>> section of my config file and rewrite history as if I'd had that config 
>>> file in place when adding every file.
>>> 
>>> 
>>> [1] http://svn.borg.ch/svndumptool/
>> 
>> Please try the new svndumptool command 'apply-autoprops'. I hope it does 
>> what you want (you need trunk).
>> 
>> svndumptool.py apply-autoprops input.dmp output.dmp

I found a bug in that command, I forgot to add '^' and '$' to the regex.
It's fixed in r233, and also a bit documented added.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Retroactively adding versioned properties to files in a dumpfile

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Sep 21, 2008, at 6:54 PM, Martin Furter wrote:

> On Sun, 21 Sep 2008, Ryan Schmidt wrote:
>
>> Anybody know how I can retroactively add properties to files? I'd  
>> like to set svn:mime-type and svn:executable correctly for all my  
>> files.
>>
>> I've used svndumptool.py [1] to clean up some other things in my  
>> repository dump, but I'm not finding this feature. I find features  
>> that are close:
>>
>> There's "svndumptool.py transform-prop" to change an existing  
>> versioned property.
>> There's "svndumptool.py edit --propdel" to delete a versioned  
>> property.
>> There's "svndumptool.py eolfix" to set or change the svn:eol-style  
>> property and rewrite files' contents accordingly.
>>
>> What I'd sure like is "svndumptool.py set-prop" with which I could  
>> set a property on files by regex, regardless of whether the  
>> property was already set or not.
>>
>> Or maybe even better, a way for svndumptool.py to use the  
>> autoprops section of my config file and rewrite history as if I'd  
>> had that config file in place when adding every file.
>>
>>
>> [1] http://svn.borg.ch/svndumptool/
>
> Please try the new svndumptool command 'apply-autoprops'. I hope it  
> does what you want (you need trunk).
>
> svndumptool.py apply-autoprops input.dmp output.dmp

Wow, that sounds great!

It's not mentioned in the README yet... Will this also handle eol  
transformations, or do I need to separately use svndumptool.py eolfix?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Retroactively adding versioned properties to files in a dumpfile

Posted by Martin Furter <mf...@rola.ch>.
Please try the new svndumptool command 'apply-autoprops'. I hope it does 
what you want (you need trunk).

svndumptool.py apply-autoprops input.dmp output.dmp

Martin


On Sun, 21 Sep 2008, Ryan Schmidt wrote:

> Anybody know how I can retroactively add properties to files? I'd like to set 
> svn:mime-type and svn:executable correctly for all my files.
>
> I've used svndumptool.py [1] to clean up some other things in my repository 
> dump, but I'm not finding this feature. I find features that are close:
>
> There's "svndumptool.py transform-prop" to change an existing versioned 
> property.
> There's "svndumptool.py edit --propdel" to delete a versioned property.
> There's "svndumptool.py eolfix" to set or change the svn:eol-style property 
> and rewrite files' contents accordingly.
>
> What I'd sure like is "svndumptool.py set-prop" with which I could set a 
> property on files by regex, regardless of whether the property was already 
> set or not.
>
> Or maybe even better, a way for svndumptool.py to use the autoprops section 
> of my config file and rewrite history as if I'd had that config file in place 
> when adding every file.
>
>
> [1] http://svn.borg.ch/svndumptool/
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org