[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Alphe-checklist comments

From: Tripp Lilley <tlilley_at_perspex.com>
Date: 2001-04-19 02:20:30 CEST

On Thu, 19 Apr 2001, Branko [ISO-8859-2] �ibej wrote:

> Apart from the basic semantics (text vs. binary), there's an extra that
> omitting line conversion won't give you: you avoid ever having
> mixed-style line endings because of editing on different platforms.
> That's not very hard to fix, but I've often wished the repository could
> do it for me automagically.
>
> Besides, there's hardly any extra work involved: we'll have the
> newline-scanning and -conversion logic in the code in any case.

To me, the "right" solution to this is to store the files as text/plain,
with a way of annotating what their "native" platform is.

        - When I intend to manipulate the file, I check it out "normally",
          so that line-endings are transformed to my system's form.

        - When I've finished manipulating the file I check it in, and
          line-endings are transformed into SVN's internal form.

        - When I intend to transport the file (either by copying it to a
          floppy, or building a distro tarball, or what have you), I check
          it out in its "native" form.

I see storing the "native" form as allowing you to do something
"automatic" where you refresh your entire local workspace (or a subtree,
or a file), translating everything into its "native" form.

Furthermore, you ought to be able to explicitly refresh some subset of
your local workspace, specifying a native form (e.g., "check out
everything in Mac format so I can build a Mac archive, even though I'm on
a Unix box"), and overriding whatever the individual files might have set
as their "native" form.

Of course, the default would always be to just store text/plain in its
canonical, internal representation, with no "native" form specified.

I feel I've confused myself enough that I should explain with a simple
contrived example:

        myworkspace/
                dosfile.txt native: dos (\r\n)
                unixfile.txt native: unix (\n)
                macfile.txt native: mac (\n\r) # pretend that's right.
                anyfile.txt native: none (default)

I don't know command-line args, so pretend I do and translate
appropriately:

        ## to do normal work on my Unix box
        svn -co myworkspace/...

        myworkspace/
                dosfile.txt current: unix (\n)
                unixfile.txt current: unix (\n)
                macfile.txt current: unix (\n)
                anyfile.txt current: unix (\n)

        ## to build a generic tarball from my UNIX box
        svn -lf=native -co myworkspace/...

        myworkspace/
                dosfile.txt current: dos (\r\n)
                unixfile.txt current: unix (\n)
                macfile.txt current: mac (\n\r)
                anyfile.txt current: unix (\n)

        ## to build a tarball for DOS boxes from my UNIX box
        svn -lf=dos -co myworkspace/...

        myworkspace/
                dosfile.txt current: dos (\r\n)
                unixfile.txt current: dos (\r\n)
                macfile.txt current: dos (\r\n)
                anyfile.txt current: dos (\r\n)

        ## to build a tarball for Unix, preserving native DOS files
        ## (from my Unix box):
        svn -lf="native:dos" -co myworkspace/...

        myworkspace/
                dosfile.txt current: dos (\r\n)
                unixfile.txt current: unix (\n)
                macfile.txt current: unix (\n)
                anyfile.txt current: unix (\n)

With something like this, you ought to be able to handle just about any
situation that folks would demand, without necessary causing line
headaches when they weren't specifically requested by the user :)

-- 
   Tripp Lilley  *  http://stargate.eheart.sg505.net/~tlilley/
--------------------------------------------------------------------------
  "If people would stop behaving like greedy idiots, I'd be sweetness
   and light every fucking day." - Dave Winer, Scripting News, 2001-04-11
Received on Sat Oct 21 14:36:29 2006

This is an archived mail posted to the Subversion Dev mailing list.