Forum: Inkscape Improving the diff-ability of inkscape

Ac2a78f4c985b5d7e7780dcbae97b2fb?d=identicon&s=25 "Yannik Völker" <yannikv@yahoo.de> (Guest)
on 2013-05-08 15:43
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First of all: I am not exactly shure if this belongs into -user if it
should be put into the dev mailing list please tell me to do so

Today I ran some experiments on collaborative work Inkscape.
I put a file in a simple Hg-repository, created two branches, made
some changes to each of them and afterwards tried to merge them back
together.
while doing so I ran into 3 Problems:

The first one can't be changed by Inkscape: when you add objects to
the same layer in both branches you need to tell the diff tool to
insert them after each others so no big deal
The second one is that Inkscape saves the zoom and view position;
while its a bit annoying and i dont relay see the advantage of saving
those its easy to resolve.
The third one is the reason for this mail: the svg format was designed
not to waste too much bandwidth for path definitions
(http://www.w3.org/TR/SVG/paths.html#PathDataGenera...) so it
was allowed to put skip some whitespaces, have relative and absolute
formats and so on. While its not necessary to use it Inkscape actually
uses some of those optimizations for size. That is where it gets
problematic:
No line based diff algorithm will ever be able to understand

  d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C
322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l
44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
- -292.02038,376.68278 z"

it would be way better if Inkscape would save all the commands in
their own line with the correct command in front so you can put other
lines in between without breaking everything:

  d="M94.560583,882.94114
  M202.33942,447.30755
  M149.72092,186.54185
  C322.59461,172.3981
  C497.26518,91.769646
  C666.84911,199.34693
  l44.50099,59.86379
  l6.19919,124.61
  l-138.89214,182.52301
  l-292.02038,376.68278
  z"

would allow adding a point to the line by just adding a line without
creating a huge diff.
Additionally it would be good to never use relative coordinates (l) as
changing one point would change two lines otherwise
Please note that this suggestion is for the so-called Inkscape-SVG
only (as that is the one people will use to work ), it should
obviously be optimized as much as possible in the plain svg format.

- --
Yannik Vlker
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJRilZAAAoJEDqk81AiCyXKzNwQAJP2BwXDVJ0ASIc+0Pw6TjsW
yF3s6nGm4/5cWHbXXDUosCJNu4VH9bccFyEfwfoUHgPXoPWM7XQJWF+Imj+W5rTJ
XfrCEyrLC/8fcqZpS301vfjv0492J4UZi+mMuIVVQQwa3djCISDg3GQHkOgiEPxw
Gu7KJSDGvmct6sW+vKsErHLBgjh+NeE8d8ySEIXXryEi5boBO3+4Ai9IVEfkOCs7
qvDIXgmkePaLvFukLnAvOVJxSeXnTFRyQyozX5IQE+M7tTL6HQKf7qhDTXuJOkuJ
tSdoCIcTE4Ksy0h+7wRgvZ/+rMcle+cZg9gt8YzAypsdSewLYDLljM0geIAfkxvp
K8eVZs6f7Fmsqzb/hlVZrQLzb/oA+WR7iLcWuKGa3dtIYR1udvTA+UYzUNvjXn4t
p50eqZ4a4yreg34GsM9dOuvEcy2RrVzvRxX0+Y5whzvx1ndj+XJwmrudOykfyip6
Xg6o9wtqYN4FCnEPTwcixUSl3uyCUN0QnjJtZLwlL6wSvOTJyCedsGv5Sh3lrIMr
UUnK6kQoGKlmvWBdXB3eBqTJSUUC+NZdPZMCXD0TEm04SdaYS1901JpTyJMT0TXU
NFz42yVz/pbU5y/j/zMDLhrmdPeAmDMqazyqwEXRTBOaxFvec/upyixuwNRPqsDO
bpx80Tt5vkz4YA5+MT/W
=o356
-----END PGP SIGNATURE-----
Aefd46e73e6b7449c5ce1ce0156797d2?d=identicon&s=25 ~suv (Guest)
on 2013-05-08 16:57
(Received via mailing list)
On 2013-05-08 15:42 +0100, Yannik Völker wrote:
> First of all: I am not exactly shure if this belongs into -user if it
> should be put into the dev mailing list please tell me to do so
>
> Today I ran some experiments on collaborative work Inkscape.
> I put a file in a simple Hg-repository, created two branches, made
> some changes to each of them and afterwards tried to merge them back
> together.
> while doing so I ran into 3 Problems:


> The first one can't be changed by Inkscape: when you add objects to
> the same layer in both branches you need to tell the diff tool to
> insert them after each others so no big deal

> The second one is that Inkscape saves the zoom and view position;
> while its a bit annoying and i don’t relay see the advantage of saving
> those its easy to resolve.

Already adressed in current trunk:

- Bug #928205 “Do not save viewport metadata option”
  <https://bugs.launchpad.net/inkscape/+bug/928205>

> 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l
>   C322.59461,172.3981
>   C497.26518,91.769646
>   C666.84911,199.34693
>   l44.50099,59.86379
>   l6.19919,124.61
>   l-138.89214,182.52301
>   l-292.02038,376.68278
>   z"
>
> would allow adding a point to the line by just adding a line without
> creating a huge diff.

> Additionally it would be good to never use relative coordinates (l) as
> changing one point would change two lines otherwise

See
Inkscape Preferences > SVG output > Path data:
[ ] Allow relative coordinates

Note: changing this setting will affect newly created  or modified
objects. For existing objects/paths a rewrite of the path data needs to
be triggered manually (e.g. by nudging a selection with the arrow keys a
tick up and back down).
827edb15a6cb37b669fddc2008150102?d=identicon&s=25 Auguste Pop (Guest)
on 2013-05-10 05:06
(Received via mailing list)
i am a user, not a developer of inkscape. and i think i can share some
information with you.

1. you can get rid of the view point thing by saving your file into
plain
svg format. however, doing this loses information, for instance, rx, ry,
cx, cy in circles.
2. you can find an option in configuration that forces inkscape to save
path in absolute coordinates. that means, all the m, c, a commands in
path
will be converted into M, C, A commands. of course this list is not
exhaustive.

as for the one line per command, or coordinate pair, thing in path, i
have
no idea at all.

regards,
8b3c344f0adba6016612e05447039f44?d=identicon&s=25 john Culleton (Guest)
on 2013-05-12 16:51
(Received via mailing list)
On Wed, 08 May 2013 15:42:24 +0200
Yannik Vlker <yannikv@yahoo.de> wrote:

> while doing so I ran into 3 Problems:
> was allowed to put skip some whitespaces, have relative and absolute
> it would be way better if Inkscape would save all the commands in
>   l6.19919,124.61
> obviously be optimized as much as possible in the plain svg format.
>
> - --
> Yannik Vlker
If you edit the svg file in gvim, select the range of lines
you want to clarify, and within that range replace the space with
a space carriage return as apppropriate for your OS then that
might do the trick. Hven't tested it yet, time to go to church
followed by Mother's Day brunch. I'll try tomorrow.

Gvim runs on all three common OS. go to http://www.vim.org to
download/install.
--
John Culleton
Wexford Press
Free list of books for self-publishers:
http://wexfordpress.net/shortlist.html
PDF e-book: "Create Book Covers with Scribus"
available at http://www.booklocker.com/books/4055.html
C9af522fc39d5de90f21119543c2b9ab?d=identicon&s=25 Steve Litt (Guest)
on 2013-05-12 20:34
(Received via mailing list)
On Wed, 08 May 2013 15:42:24 +0200
Yannik Völker <yannikv@yahoo.de> wrote:


> The first one can't be changed by Inkscape: when you add objects to
> the same layer in both branches you need to tell the diff tool to
> insert them after each others so no big deal

I don't understand the preceding, but since you seem to have a handle
on it, let's move on.

> No line based diff algorithm will ever be able to understand
>
>   d="M 94.560583,882.94114 202.33942,447.30755 149.72092,186.54185 C
> 322.59461,172.3981 497.26518,91.769646 666.84911,199.34693 l
> 44.50099,59.86379 6.19919,124.61 -138.89214,182.52301
> - -292.02038,376.68278 z"
>
> it would be way better if Inkscape would save all the commands in
> their own line with the correct command in front so you can put other
> lines in between without breaking everything

If I were going to diff two Inscape files, I think what I would do is
get my hands on an XML parser for my computer language of choice, and
write myself a generic XML writer to write the elements back. For the
most part, they'd simply be written, but in the case of a path, my
writer would intervene to put every command at the beginning of the
line, while removing all other newlines and finding a uniform space
treatment. Somebody else mentioned you can turn off relative
coordinates in Inkscape.

This is a lot of work, but sometimes, when I just can't do something in
Inkscape, I'll try to do it in the XML itself, and it often helps to
add or change something in a diagram and then diff it against the
pre-change version.

Please let us all know what you come up with.

Thanks,

SteveT

Steve Litt                *  http://www.troubleshooters.com/
Troubleshooting Training  *  Human Performance
Af72fd325f1efb916131f41c0aff2a18?d=identicon&s=25 Ricardo Lafuente (Guest)
on 2013-05-12 22:26
(Received via mailing list)
This thread reminded me of a project that was created to address the
issue of SVG diffs:

https://github.com/pghpy/diffsvg

The last commit was 2 years ago, but the general design looks sound:

* it's better to use a XML-aware diff tool than the usual line-based
approach
* it could also conceivably be enhanced to parse the path data
differences properly

This approach does away with the huge and improbable task of asking
authors of SVG editing software to change their SVG output.

Also, see this promising proposal regarding the visual display of diffs
on SVG files:

About: http://w.xuv.be/projects/design_with_git
Demo:  http://xuv.github.io/design-with-git/static-svg-diff/

:r
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.