I made to changes to my code that are next to each other and part of the same
patch, but should be distinct:
void
ASTparameterList::entropy(Modification& mod) const
{
for (unsigned i = 0; i < mParameters.size(); ++i)
mod.mRand48Seed ^= mParameters[i].mMod.modData.mRand48Seed;
}
ASTparameterList::~ASTparameterList()
{
for (std::vector<ASTparameter>::iterator it = mParameters.begin();
it != mParameters.end(); ++it)
{
delete (*it).mExpression;
for (ASTexpArray::iterator it2 = (*it).mMod.modExp.begin(); it2 !=
(*it).mMod.modExp.end(); ++it2)
delete (*it2);
(*it).mMod.modExp.clear();
}
}
became
void
ASTparameterList::entropy(Modification& mod) const
{
for (ASTparameters::const_iterator it = mParameters.begin();
it != mParameters.end(); ++it)
{
mod.mRand48Seed ^= (*it).mMod.modData.mRand48Seed;
}
}
ASTparameter::~ASTparameter()
{
delete mExpression;
}
So I changed the loop in the entropy method and replaced the ASTparameterList
destructor with an ASTparameter destructor. Darcs mixes together all of these
changes into three hunks:
hunk ./src-common/astreplacement.cpp 124
- for (unsigned i = 0; i < mParameters.size(); ++i)
- mod.mRand48Seed ^= mParameters[i].mMod.modData.mRand48Seed;
- }
- $
- ASTparameterList::~ASTparameterList()
- {
- for (std::vector<ASTparameter>::iterator it = mParameters.begin();
+ for (ASTparameters::const_iterator it = mParameters.begin(); $
Shall I record this change? (8/495) [ynWesfvplxdaqjk], or ? for help: y
hunk ./src-common/astreplacement.cpp 127
- delete (*it).mExpression;
- for (ASTexpArray::iterator it2 = (*it).mMod.modExp.begin(); it2 !=
(*it).mMod.modExp.end(); ++it2)
- delete (*it2);
- (*it).mMod.modExp.clear();
+ mod.mRand48Seed ^= (*it).mMod.modData.mRand48Seed;
Shall I record this change? (9/495) [ynWesfvplxdaqjk], or ? for help: y
hunk ./src-common/astreplacement.cpp 131
+ ASTparameter::~ASTparameter()
+ {
+ delete mExpression;
+ }
+ $
Shall I record this change? (10/495) [ynWesfvplxdaqjk], or ? for help: y
Which is a mess. The hunks I would like to record are:
- for (unsigned i = 0; i < mParameters.size(); ++i)
- mod.mRand48Seed ^= mParameters[i].mMod.modData.mRand48Seed;
+ for (ASTparameters::const_iterator it = mParameters.begin();
+ it != mParameters.end(); ++it)
+ {
+ mod.mRand48Seed ^= (*it).mMod.modData.mRand48Seed;
+ }
and
- ASTparameterList::~ASTparameterList()
- {
- for (std::vector<ASTparameter>::iterator it = mParameters.begin();
- it != mParameters.end(); ++it)
- {
- delete (*it).mExpression;
- for (ASTexpArray::iterator it2 = (*it).mMod.modExp.begin(); it2 !=
(*it).mMod.modExp.end(); ++it2)
- delete (*it2);
- (*it).mMod.modExp.clear();
- }
+ ASTparameter::~ASTparameter()
+ {
+ delete mExpression;
I tried various things with the hunk editor to get darcs to reduce the scope of
the first hunk but to no avail. This isn't a case of splitting an add or a
delete. Darcs sees the lines
it != mParameters.end(); ++it)
{
in pristine and working and came up with hunks that preserved those lines. This
is pretty cool behavior, but it does not really represent the change that I
made. I want darcs to rethink the hunk based on a smaller piece of the pristine
file. In the end, I changed the name of the loop variable so that the spurious
common lines between pristine and working went away. Am I expecting too much
from hunk editing? Is there some way to get darcs to ignore spurious common
lines between pristine and working?
-- john
_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users