Issue931

Title hg log, showing copies: inside a --template
Priority urgent Status chatting
Superseder Nosy List ThomasAH, bastiand, jmr, marcdownie, mpm, pmezard
Assigned To Topics

Created on 2008-01-17.00:06:57 by marcdownie, last changed 2008-06-16.11:20:02 by bastiand.

Messages
msg6291 (view) Author: bastiand Date: 2008-06-16.11:20:01
@JMR: For the Eclipse plug-in we're putting style files into the
MercurialEclipse JAR and copy them on first usage as temporary files to a
location which can be used by hg. This also solves the problem with spaces in
filenames and templates.

Btw., IMHO hg cat offers a similar problem - no templating available and (AFAIK)
it doesn't follow renames. This is unfortunate as it breaks comparing of renamed
files to older versions :-(. We still haven't figured out how to solve this problem.
msg4993 (view) Author: pmezard Date: 2008-01-26.19:53:40
I am not sure you can get this information reliably with templates only, you
probably need a style file. Digging in the templating code and tests, copies can
be displayed with --template using the embedded style "filecopy" like:

hg log -vfC --template "{file_copies%filecopy}\n"

But the "source(copy)" format is probably not reliable enough for what you need.
I don't know any way to define styles within a --template but I am not
knowledgeable in this area either.

Adding mpm and ThomasAH to nosy list.

Couldn't you use a style file instead ?
msg4985 (view) Author: marcdownie Date: 2008-01-25.18:19:21
This bug is also stopping us providing copy history in our tools (albeit, much 
less significant than NetBeans!). I don't understand the intent / philosophy of cmdutil.py/changeset_templater/showlist enough to submit the patch myself.
msg4982 (view) Author: jmr Date: 2008-01-25.17:40:20
This bug is blocking us from getting at copy information when processing Search
History information in the netBeans IDE Mercurial plugin. Pretty much everything
else is working.
msg4943 (view) Author: jmr Date: 2008-01-21.14:27:52
We are trying to implement a Search History in the Mercurial NetBeans IDE
support and also need the ability to get at copied file info in a template, we
are seeing similar problem with file_copies in tempalte:

$ hg --debug log -l 1 -C --template="rev: {rev}\\ndesc: {desc}\\ndate:
{date|hgdate}\\nid: {node|short}\\nfiles: {files}\\n file_adds: {file_adds}\\n
file_dels: {file_dels}\\n file_copies: {file_copies}\\n\\n" --repository
/export/home/NetBeansProjects/JavaApplication36_clone1
/export/home/NetBeansProjects/JavaApplication36_clone1
rev: 7
desc: copied
date: 1200923834 0
id: 16ca42ddff3c
files: 
 file_adds: src/javaapplication36/Main2222.java
src/javaapplication36/NewClass3111111111.java
 file_dels: src/javaapplication36/Main.java src/javaapplication36/NewClass31.java
 file_copies:
filesnodetagsdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsfile_delsparentsfile_copiesfilesnodetagsdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsfile_delsparentsfile_copies

$ hg --version
Mercurial Distributed SCM (version 0.9.5)
msg4899 (view) Author: marcdownie Date: 2008-01-17.00:06:51
Using --template that tries to show the copies associated with a changeset 
doesn't work as expected, 
while hg log -vfC filename works fine.

For example (please excuse the odd filenames):

marc$ hg log -vfC python_source_v.property
changeset:   1512:60c1189d3152
user:        marc@f1.local
date:        Wed Jan 16 14:40:52 2008 -0600
files:       saveTarget4.field/__-4354d5:117843d713e:-
7fe1/python_source_v.property 
saveTarget4.field/__-e73f109:117843b48dc:-7fbc/python_source_v.property 
saveTarget4.field/__3b6f6a98:1178444f7e2:-7fea/python_source_v.property 
saveTarget4.field/__79cac2e6:117843fcd12:-7ff1/python_source_v.property 
saveTarget4.field/__7d1c59c0:117845389de:-7fe6/python_source_v.property 
saveTarget4.field/sheet.xml
copies:      saveTarget4.field/__-4354d5:117843d713e:-
7fe1/python_source_v.property 
(saveSource.field/__-4354d5:117843d713e:-7fe1/python_source_v.property) 
saveTarget4.field/__-
e73f109:117843b48dc:-7fbc/python_source_v.property (saveSource.field/__-
e73f109:117843b48dc:-
7fbc/python_source_v.property) saveTarget4.field/__3b6f6a98:1178444f7e2:-
7fea/python_source_v.property 
(saveSource.field/__3b6f6a98:1178444f7e2:-7fea/python_source_v.property) 
saveTarget4.field/__79cac2e6:117843fcd12:-7ff1/python_source_v.property 
(saveSource.field/__79cac2e6:117843fcd12:-7ff1/python_source_v.property) 
saveTarget4.field/__7d1c59c0:117845389de:-7fe6/python_source_v.property 
(saveSource.field/__7d1c59c0:117845389de:-7fe6/python_source_v.property) 
saveTarget4.field/sheet.xml 
(saveSource.field/sheet.xml)
description:
"(no message)"


changeset:   1500:6248674bbb47
user:        marc@f1.local
date:        Wed Jan 16 14:29:40 2008 -0600
files:       saveSource.field/__3b6f6a98:1178444f7e2:-
7fea/python_source_v.property
description:
"(no message)"


changeset:   1498:ac40a6485eb2
user:        marc@f1.local
date:        Wed Jan 16 14:23:56 2008 -0600
files:       saveSource.field/__3b6f6a98:1178444f7e2:-
7fea/python_source_v.property 
saveSource.field/__79cac2e6:117843fcd12:-7ff1/python_source_v.property 
saveSource.field/sheet.xml
description:
"(no message)"


this is as expected, in particular the "copies:" for rev 1512 are correct.

However with a template that contains {file_copies} (which I'm guessing is the 
correct keyword):

marc$ hg log -v -f -C --template 
"rev<<{rev}>>\ndate<<{date|isodate}>>\ndesc<<{desc}>>files\n<<{files}>>\ncopies<
<{file_copies}>>-----
\n\n\n" python_source_v.property 

rev<<1512>>
date<<2008-01-16 14:40 -0600>>
desc<<"(no message)">>files
<<saveTarget4.field/__-4354d5:117843d713e:-7fe1/python_source_v.property 
saveTarget4.field/__-
e73f109:117843b48dc:-7fbc/python_source_v.property 
saveTarget4.field/__3b6f6a98:1178444f7e2:-
7fea/python_source_v.property saveTarget4.field/__79cac2e6:117843fcd12:-
7ff1/python_source_v.property 
saveTarget4.field/__7d1c59c0:117845389de:-7fe6/python_source_v.property 
saveTarget4.field/sheet.xml>>
copies<<filesnodetagsdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsf
ile_delsparentsfile_cop
iesfilesnodetagsdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsfile_d
elsparentsfile_copiesfi
lesnodetagsdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsfile_delspa
rentsfile_copiesfilesno
detagsdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsfile_delsparents
file_copiesfilesnodetag
sdatedescbranchesnameauthorrevmanifestsourceextrasfile_addsfile_delsparentsfile_
copiesfilesnodetagsdate
descbranchesnameauthorrevmanifestsourceextrasfile_addsfile_delsparentsfile_copie
s>>-----


rev<<1500>>
date<<2008-01-16 14:29 -0600>>
desc<<"(no message)">>files
<<saveSource.field/__3b6f6a98:1178444f7e2:-7fea/python_source_v.property>>
copies<<>>-----


rev<<1498>>
date<<2008-01-16 14:23 -0600>>
desc<<"(no message)">>files
<<saveSource.field/__3b6f6a98:1178444f7e2:-7fea/python_source_v.property 
saveSource.field/__79cac2e6:117843fcd12:-7ff1/python_source_v.property 
saveSource.field/sheet.xml>>
copies<<>>-----


In this case the copies<< ... >> contains text that's formatted badly by 
cmdutil.py/changeset_templater/showlist (the material is in the "values" passed 
into this function, as 
an array of dicts, it just doesn't make it out the other side.

marc$ hg --version
Mercurial Distributed SCM (version 0.9.5)
History
Date User Action Args
2008-06-16 11:20:02bastiandsetnosy: + bastiand
messages: + msg6291
2008-01-26 19:53:40pmezardsetnosy: + ThomasAH, mpm, pmezard
messages: + msg4993
2008-01-25 18:19:22marcdowniesetmessages: + msg4985
2008-01-25 17:40:22jmrsetpriority: bug -> urgent
messages: + msg4982
2008-01-21 14:27:52jmrsetstatus: unread -> chatting
nosy: + jmr
messages: + msg4943
2008-01-17 00:06:57marcdowniecreate