On Wed, Mar 17, 2010 at 2:07 AM, Rik <[hidden email]> wrote:
>> What happened to the plan (or was it a plan already?) to move the ChangeLog
>> entries into the mercurial commit messages?
> This seems like a very good idea.
Well, as has been pointed out previously, it has some negative
effects. In particular we'd lose the advantage of having the related
changelogs grouped per directory.
> One of the current complications with
> using a non-linear commit strategy is that everyone touches the same file,
> ChangeLog, on every commit. This leads Mercurial into attempting an
> unnecessary 3-way merge of that file whenever a personal repository is
> pushed back to the main repository.
I made the following modification to my Mercurial to combat this
problem (may require a trivial merge in the import section if the
parent is outdated):
# HG changeset patch
# User Jaroslav Hajek <[hidden email]>
# Date 1264432918 -3600
# Node ID 436f14ca18e80ba8c72a22a106eccdc366782d61
# Parent f68eaaf6891032750d26ea989607983a297806c3
allow smart treatment of GNU-style ChangeLog files
def updatedir(ui, repo, patches, similarity=0):
@@ -1415,6 +1416,19 @@
if dodiff == 'binary':
text = b85diff(to, tn)
+ # check whether this can be a ChangeLog entry
+ ischangelogentry = False
+ if (a == b and opts.changelogmask
+ and fnmatch.fnmatch(a, opts.changelogmask)):
+ lto = len(to)
+ ltn = len(tn)
+ if ltn > lto and tn[-lto:] == to and tn[-lto-1] == '\n':
+ ischangelogentry = True
+ # if so, strip the rest of the file to get only the prepended
+ # lines dumped
+ if ischangelogentry:
+ tn = tn[:-lto]
+ to = ''
text = mdiff.unidiff(to, date1,
# ctx2 date may be dynamic
with this patch, I can set
in my .hgrc to force mercurial generate a context-free diff for
ChangeLogs, if a hunk of text is only prepended to them. Together with
the mq extension, this eliminates 99% of problems with ChangeLogs,
because the context-free diffs re-apply smoothly in any order. This
also works well for transplanting (which was actually the reason I did
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
Jaroslav Hajek wrote:
> On Wed, Mar 17, 2010 at 2:07 AM, Rik <[hidden email]> wrote:
>>> What happened to the plan (or was it a plan already?) to move the ChangeLog
>>> entries into the mercurial commit messages?
>> This seems like a very good idea.
> Well, as has been pointed out previously, it has some negative
> effects. In particular we'd lose the advantage of having the related
> changelogs grouped per directory.
I think an important question to consider is how coders will interact with
the code base. If a bug comes up in a script .m file I imagine a debug
flow that looks like this. I would start by going to the scripts/ChangeLog
file, searching there for every occurrence of the script file name in
question, examining the log note and deciding whether I think it is
related, and then taking action. If all of the changes were in a single
ChangeLog this wouldn't affect the workflow, only the regular expression
used to search for the file name.
If I were working in a purely Mercurial flow I would just find the file in
the source tree and run 'hg log suspected_file.m' to see the changes.
I'm wary of the ChangeLogs because they require human intervention. What
if someone forgets to mention a file they changed? The debug search above
would fail. On the other hand, Mercurial knows definitively which files
As an aside, if per-directory ChangeLogs are a requirement then it would be
a trivial Perl script to parse the output of 'hg log --stytle changelog'
and group the changes based on directory.
> I made the following modification to my Mercurial to combat this
> problem (may require a trivial merge in the import section if the
> parent is outdated):
This looks like a nice addition. I would still prefer to run a vanilla
Mercurial and make the ChangeLogs derived files from the Mercurial logs.
But, if we don't go that direction I will definitely be patching my local
sources with this.