Using bzr with LaTeX

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Fri Dec 15 01:18:06 GMT 2006


On 12/15/06, t u <towsonu2003 at gmail.com> wrote:
> Ramon Diaz-Uriarte wrote:
> >> b) bzr makes collaboration
> >> very simple; it is as simple as saying "I worked on the paper last
> >> night; grab my latest changes from the repository"; c) being bzr
> >> distributed I can, say, edit and work while commuting, keeping all the
> >> history in my laptop, and then sync with my coauthors' changes when I
> >> get to work.
>
> Hi,
>
> Thanks for the suggestions so far (and if you have any more, pls keep
> them coming :) they are great)
>
> The collaboration seemed interesting. Of course, not knowing anyone who
> uses linux + latex + bzr in non-virtual world (eh), collaboration with
> others is kinda hard.
>
> But it still seems doable. For example, I give a copy of my paper to my
> advisor, who makes corretions. It seems like I can than copy my bzr'd
> source to another directory, make the advisor's changes to the source,
> than merge the two if there are no conflicts.
>

I am not sure why you'd want to copy your bzr there. If you and your
advisor are never editing at the same time, it is enough to just copy
your advisor-changed version on the directory where you have your
bzr-controlled sources.

Otherwise (if you and your advisor can be making changes) then, yes,
your scheme seems reasonable. Something like:

~/my-version
bzr checkout my-version my-advisors-version

and you edit under my-version, while incorporating your advisor's
changes under "my-advisors-version" directory, and then merge.

But I am sure there are much smart approaches, and someone here will
suggest better ways.



> From the documentation[1], the commands look something like this:
> $ cd /path/to/mysource
> $ cd ../      # sorry for the redundancy
> $ bzr branch mysource advisorchanges
> do the changes
> $ cd mysource
> $ bzr diff -r branch:../advisorchanges
> $ bzr merge ../advisorchanges/
>
> Does this look about right?
>

Yes.

> Also, do you use launchpad as your repository to sync your laptop and
> other computers?
>

Not really, and I don't think launchpad is supposed to be used for
that (though other people here really now a lot more than me).

For most projects, we have a machine where all my groups stores stuff;
this is like a "centralized-type" approach. We checkout from there, we
commit there, and we update from there. For other things (say, my
.emacs, .bashrc, etc files), I just have one "central repo" in
whichever machine (e.g., the workstation at work). So note that with
these files I am just replicating, at a smaller scale, a "centralized
type" workflow; this is just because its the first I learned with
other VCS, and bzr also supports this style just fine. But there are
completely non-centralized workflows, and you might want to learn
about them, because they might be better for some situations.

In general, if you have N machines, you can just use one as the
central repo, and still have N branches (i.e., you can have a branch
in the central machine, a branch that you have checked out from the
local machine), or else have N - 1 (all machines have checkout out,
except the central one). There are pros and cons to each.  I like the
idea of having a bunch of "equal status branches", and a central repo.
And that central repo can be (or not) on the same physical machine as
the "equal status branches".  But, as I said, I think there are more
"truly distributed workflows" that might adapt better to your needs.


> And 2 last questions:
> * how do you revert to an earlier revision (that is, you commited your
> 50th revision, and now you want to revert to your 5th revision)?

Suppose you want to see how "mypaper.tex" looked at the 5th revision

Do "bzr cat -r 5 mypaper.tex > mypaper.revision5.tex"

(Of course, whether you call it "mypaper.revision5.tex" or anything
else is your choice).

Now, you have "mypaper.tex" and "mypaper.revision5.tex". You can use
kdiff3 (which I heard about first in this email list, and is just a
fabulous tool), or whatever.


[One side comment: I find "bzr viz" extremely useful; it is part of
bzrtools. Easy to see what changed where and when].

> * can you revert that (ie do above, than go back from your 5th revision
> to your 50th revision etc)?

If you do the above, you are NOT changing your latest "mypaper.tex".
So, unless you directly edit/overwrite/etc mypaper.tex, there is no
need to undo anything.


That said, you can revert to a previous state, unrevert that, and this
will depend also on whether or not you have already commited your
changes. Take a look at the help for:
revert, shelve, unshelve, uncommit. (you can look at the help by
doint, e.g. "bzr help revert"). And notice that some of this might be
dangerous if not used carefully. (In contrast, the approach above of
creating a new file that contains a file from  a previous revision is
inocuous ---though, sure, it is very limited).


Best,

R.


>
> Thanks again :)
>
> [1] http://bazaar-vcs.org/TheIndependant
> --
> Please scan all attachments for viruses.
> Or (though you might like Rodin) you might as well avoid "The Gates of
> Hell" and use Linux.
>


-- 
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz




More information about the bazaar mailing list