On Fri, Jul 20, 2012 at 3:56 PM, Andy Gibbs <andyg1...@hotmail.co.uk> wrote:

> Is there a fossil "copy" command?  There's add, mv, rm but no cp?
>

the closest thing it has is:

cp foo bar
fossil add bar

since those artifacts will have the same contents, i believe fossil will
use the same underlying blob (if i'm not sorely mistaken).


> It's a neat feature of subversion that you can copy a file either from the
> current checked-out tree or from somewhere else in time and space from the
> repository, thereby keeping a tracable history intact.
>

But of course the above loses history.


> At the moment, please forgive me if I've overlooked it, when a file is
> copied its link to its previous versions is lost and therefore diffs are
> not easily available, unless the user knows where the previous version is.
>

Right.


> Would this be a feature worth considering?
> ...
> where OPTIONS can be:
>   --from REVISION  = copy from the specified check-in
>
> Good idea / bad idea?
>


Generally sounds like a good idea, but what happens to the copy? Fossil
doesn't have the concept of "sub-repos" like /branches, /trunk, etc. Each
branch is its own namespace overlaid on a single top-level checkout. i
don't know if fossil can make much use of a cp as it exists in svn.


> I'm happy to have a go at patching fossil to support this, if someone can
> give me an quick overview of how to go about it in the correct way since
> I'm not to familiar with fossil's internals yet.
>

The easiest way to get started writing a new command is to:

grep "COMMAND:" src/*.c

find one which is relatively trivial, preferably close to what you need
(e.g. similar permissions checks and what not, though permissions are not
really checked in CLI mode because local users get full access). The ones
in zip.c seem to be pretty straightforward. Others (timeline.c) are often
extremely intricate.

When you build, fossil reads the "COMMAND: xxxx" comments and builds 2
things:

a) a mapping of command name to function
b) the help text (any comment text following the COMMAND: line).

So after adding your own function, a simple rebuild is all that's needed.
Adding a new file is a bit more involved, and requires editing
src/makemake.tcl, then running (tclsh makemake.tcl) in order to re-generate
the various platform-specific makefiles. For starters, just add your
command to one of the existing C files and you won't have to fight with
that part yet.

Feel free to post questions and whatnot.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to