Opened 11 years ago

Closed 11 years ago

#518 closed task (fixed)

svncopyright character based (rather than line based)

Reported by: Peter Johansson Owned by: Peter Johansson
Priority: major Milestone: svndigest 0.11
Component: svncopyright Version: trunk
Keywords: Cc:

Description

Also stats in svndigest is currently line based as it is based on 'svn blame'. This implies that if we have a changeset

- Hello World!
+ Hello World

svncopyright sees that as one line added (and one deleted) and adds the committer into the set of authors. If we increase the resolution to charcters, we would notice that we delete one character and add none. Based on that one can have a rule that you have copyright if you have added a character in the file (excluding white-spaces and copyright statements).

Note, it's not necessary to make full blown diff for this, because we only need to know whether there was any character added. This is almost as easy as checking if two string are equal and can be done in linear time.

This is related to #102

Change History (12)

comment:1 Changed 11 years ago by Peter Johansson

Ticket #514 was marked as related.

comment:2 Changed 11 years ago by Peter Johansson

Status: newassigned

comment:3 Changed 11 years ago by Peter Johansson

(In [1540]) change file names from diff to cat for files related to class SVNdiff (not used). refs #518

comment:4 Changed 11 years ago by Peter Johansson

(In [1541]) change interface from SVNdiff to SVNcat. refs #518

comment:5 Changed 11 years ago by Peter Johansson

(In [1542]) test for SVNcat. refs #518

comment:6 Changed 11 years ago by Peter Johansson

A speed bump. My planned path was to use svn_client_cat to retrieve the file content of specific revisions, massage the content (e.g. remove Copyright lines and white-spaces), and then check if anything was added in the changeset in question. The speed bump is that svn_client_cat expands svn::key_words such as $ID$.

comment:7 Changed 11 years ago by Peter Johansson

It wouldn't be too complicated to de-expand svn::keywords: check the properties and if keywords is set and e.g. contain Id, look for '$Id*$' and replace it with '$Id$'. I hope there is no case this could bite us *you know where*, is there?

comment:8 Changed 11 years ago by Peter Johansson

I asked users @ subversion if there is a way to turn off keywords expansion and got this answer:

No. But you could use svn_client_export5() instead which can ignore keywords as of Subversion 1.7.

I quickly looked into svn_client_export5 and there are two annoying things: 1) it requires 1.7 2) can not write to a string but must write on file. The latter is annoying and requiring 1.7 is - I guess - a killer.

comment:9 Changed 11 years ago by Peter Johansson

Looking at the implementation of svn_client_cat2, it seems svn_ra_get_file should do what we need (without expanding keywords).

comment:10 Changed 11 years ago by Peter Johansson

(In [1547]) refs #518. Implement SVNcat using 'svn_ra_get_file' which does not expand svn:keywords.

comment:11 Changed 11 years ago by Peter Johansson

(In [1549]) new class: a string iterator that skips/ignores white-spaces in the string it walks. refs #518

comment:12 Changed 11 years ago by Peter Johansson

Resolution: fixed
Status: assignedclosed

(In [1551]) closes #518. svncopyright now works on characters rather than lines. That implies old cache files are obsolete and will be ignored from this revision.

Note: See TracTickets for help on using tickets.