[PATCH] merge: call update hook afer writing dirstate

Adrian Buehlmann adrian at cadifra.com
Wed May 27 10:24:18 CDT 2009


On 27.05.2009 17:14, Adrian Buehlmann wrote:
> On 27.05.2009 14:20, Simon Heimberg wrote:
>> # HG changeset patch
>> # User Simon Heimberg <simohe at besonet.ch>
>> # Date 1243412546 -7200
>> # Node ID 672ab0cc22d3cab65c3143df38b976a6c1a32abb
>> # Parent  ff313d68dccff72e8a36999a08492adccdfe9ddf
>> merge: call update hook afer writing dirstate
>>
>> this is what is documented in hgrc.5.txt
> 
> Unfortunately, hgrc.5.txt only says "Run after updating the working directory".
> As it currently is, the hook *is* run after the working directory has
> been updated -- that is the files *have* been written (just not the dirstate yet)
> 
>> diff -r ff313d68dccf -r 672ab0cc22d3 mercurial/merge.py
>> --- a/mercurial/merge.py	Mit Mai 13 19:47:34 2009 +0200
>> +++ b/mercurial/merge.py	Mit Mai 27 10:22:26 2009 +0200
>> @@ -497,8 +497,11 @@
>>              repo.dirstate.setparents(fp1, fp2)
>>              if not branchmerge and not fastforward:
>>                  repo.dirstate.setbranch(p2.branch())
>> -            repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
>>  
>> -        return stats
>>      finally:
>>          wlock.release()
>> +
>> +    if not partial:
>> +        repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
>> +
>> +    return stats
> 
> I've been thinking about doing this as well, but...
> 
> The problem with this patch is, that it breaks current users of the
> update hook. If someone currently uses the 'update' hook, they currently
> get the files that were modified by that update when they use
> repo.status() inside their hook (which might be useful).

And maybe even more important: current users of the 'update'
hook get their hook called while the wlock is held.


More information about the Mercurial-devel mailing list