not merging dependent files, but versioning them anyway

Arne Babenhauserheide arne_bab at web.de
Wed Jun 24 02:26:38 CDT 2009


Am Mittwoch, 24. Juni 2009 02:29:08 schrieb David Frey:
> >1) pdfs are ignored for merging, if there is a conflict the pdf can be
> >deleted, because neither of them is valid anyway. It can be recreated
> > easily from the .tex after it has been merged.
> >2) pdfs are versioned, i.e. I can immediately go back to any version.

I see two ways: One doing exactly what you requested and one which keeps your 
sources cleaner. 

1. Not merging pdfs (UNTESTED): 

For this you just choose a merge tool for pdfs which simply keeps either your 
or the other version. 

 Edit your .hg/hgrc to include the following section: 

[merge-patterns]
**.pdf = internal:local #keep my files
**.pdf = internal:other #keep their files

(you should only use one of the lines)

This way all PDFs will always be either at your revision or the other revision 
and you won't have (real) merges. 

- http://mercurial.selenic.com/wiki/MergeToolConfiguration


2. Creating pdfs on the fly

This assumes that you always want to have the PDFs you can use, but that you 
don't need to versiontrack tham - only their contents (and those are defined 
in the tex files). 

For this you add an update hook which crates the pdf whenever you update to a 
revision. 

Edit your .hg/hgrc to include the hooks section with an update hook: 

[hooks]
update.create_pdfs = latex your_tex_file.tex

To make this still a bit easier, you can use a versioned script which creates 
all pdf. that way you can just call the script and don't need to worry about 
editing the .hg/hgrc when you add text files or change the call. 

I use a python script for platform compatability: 

--- parse_latex.py ---
#!/usr/bin/env python
from subprocess import call
for i in ["file1.tex", "file2.tex"]: 
  call(["latex", i])
--- --- --- --- --- --- --- --- 

.hg/hgrc: 
[hooks]
update.create = ./parse_latex.py

- http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html

> The question you should be asking is not "how can I do this?", but
> "should I do this?" and the answer is no.

Except if there are good reasons, and I can imagine that there are - even one 
member who is not comfortable with not having PDFs inv ersion control (and who 
doesn't want to reason about that) is a good reason. 

If need be, you can convert the repo to remove the pdfs later.

Best wishes, 
Arne

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Ein Mann wird auf der Straße mit einem Messer bedroht. 
Zwei Polizisten sind sofort da und halten ein Transparent davor. 

	"Illegale Szene. Niemand darf das sehen."

Der Mann wird ausgeraubt, erstochen und verblutet, 
denn die Polizisten haben beide Hände voll zu tun. 

Willkommen in Deutschland. Zensur ist schön. 
                      (http://draketo.de)
--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://selenic.com/pipermail/mercurial/attachments/20090624/99c659cf/attachment.pgp 


More information about the Mercurial mailing list