monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Commit without working copy


From: Nathaniel Smith
Subject: Re: [Monotone-devel] Commit without working copy
Date: Fri, 3 Dec 2004 05:41:30 -0800
User-agent: Mutt/1.5.6i

On Fri, Dec 03, 2004 at 09:10:17PM +0800, Grzegorz Jakacki wrote:
> Nathaniel Smith wrote:
> >On Thu, Dec 02, 2004 at 10:24:43PM +0800, Grzegorz Jakacki wrote:
> >
> >>I would like a webserver to checkout/checkin files from/to monotone 
> >>database without actually creating a working copy. Is that possible with 
> >>current CLI? If not, then how much work it is to add it and where should 
> >>I begin?
> >
> >It doesn't make a lot of sense with Monotone, since checkin/checkout
> >always apply to the whole working copy, not to individual files.
>
> If you use monotone to store source code, then perhaps yes.

No, this is always true, it's a basic part of Monotone's data model.
Storing source code is why it works that way, but that doesn't change
_that_ it works that way.

> >(With the .restrictions branch, this becomes some virtual working copy
> >with some changes masked out, but this doesn't change things
> >conceptually --- conceptually, we always commit a complete snapshot.)
> 
> OK. Assume my repo has just one file.
>
> >So what you're asking for seems to be of very limited utility,
> 
> Not to me.

Well, obviously it's useful to you :-).  What I meant was, you have to
assume that your repo has only one file, etc., for it to be useful,
which makes it unlikely to be useful to most other people.

> >and
> >semantically weird --- neither really good bets for getting it folded
> >in upstream, at least at first blush :-)
> 
> I am not requesting a new feature. I am asking how difficult it
> is to add it and where should I look first if I wanted to add it myself.

Okay.  But, I'm also guessing, part of being "useful to you" is
probably that it works with standard Monotone, i.e. you don't have to
maintain your own fork of Monotone itself just to accomplish your
goals.

> >What are you really trying to do?
> 
> I am trying to prototype distributed Wiki system.  A peer of such system
> is a repo and webserver. PHP interpreter working on the webserver
> checkouts webpage from the repo and serves it to the webclient. If user
> edits the page, php script commits the page back to the repo and merges.
> From time to time state of repos is propagated among peers and merged
> wherever possible.

Huh, neat idea.  How are you planning to handle merge conflicts?  I'm
curious too what benefits you expect from having multiple peers?

> AFAIU from reading docs it is doable with monotone. I just wanted to
> know if there is a way to commit/checkout directly to/from the webclient
> (via webserver running, say, PHP).

It should indeed be doable with Monotone.  What I'd recommend would be
just to do a checkout.  The PHP equivalent of the shell:
  DIR=`mktemp -d $TMPDIR/mywiki-checkout.XXXXXX`
  trap "rm -rf $DIR" EXIT
  monotone checkout --branch=$BRANCH $DIR
  cat newfile > $DIR/file
  (cd $DIR; monotone commit $MSG)

A little annoying to create the temp dir, yeah, but it's not really
that hard to do safely...

Also, note that you need some locking to make sure that only one
'monotone' subprocesses runs at the same time to access the same
database; Monotone won't corrupt your data in any case, but will error
out rather than blocking and waiting for the DB to become available.

-- Nathaniel

-- 
"But suppose I am not willing to claim that.  For in fact pianos
are heavy, and very few persons can carry a piano all by themselves."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]