small medium large xlarge

Generic-user-small
28 Jan 2016, 06:50
Stefan Seegers (6 posts)

Hi,

I just want to share some problems I encountered and how I solved it.

1. Python Scripts do not run successfully

The provided python script csv_as_enclosure_json.py expects data to be written in UTF-8. I had a problem on windows with files containing german umlauts in their name. This caused the python script to break because of the cloc analysis file.

Solution 1: Using a text editor, open cloc analysis file, save with encoding UTF-8. Or just rename the file in the repository if you can.

Solution 2: in order to automate this, use iconv in a shell (I’m using babun shell):
iconv -f CP1252 -t UTF8 cloc_analysis_file.csv >cloc_analysis_file_freqs.csv

2. Strange output on mercurial repositories on windows

According to codemaat documentation, a logfile should be created by
hg log --template "rev: {rev} author: {author} date: {date|shortdate} files:\n{files %'{file}\n'}\n" --date ">YYYY-MM-DD"

This works when I directly enter this into commandline (DOS Prompt or Unix Shell like cygwin/babun shell). But when I tried to automate it, I received strange results like this:

rev: 47298 author: johnedoe date: 2015-01-26 files:
src/some/package/name/Classname.java
‘}

This “’}” in a new line only appears when calling hg log through a batch-file. I could work around this by providing an alias in .hg/hgrc

[alias]
clog = log –template “rev: {rev} author: {author} date: {date|shortdate} files:\n{files %’{file}\n’}\n”

Now I can use it this way:

hg clog --date ">YYYY-MM-DD"

(I’ve chosen clog for codemaat-log)

You must be logged in to comment