[PATCH] subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)

Mads Kiilerich mads at kiilerich.com
Fri Dec 17 05:18:06 CST 2010


On 12/17/2010 11:53 AM, Erik Zielke wrote:
> fre, 17 12 2010 kl. 11:18 +0100, skrev Mads Kiilerich:
>> It seems to me like a proper fix requires some refactoring of the commit
>> function. We basically don't know the state of the outer repo before we
>> have done the recursive commit, so we have to do the recursive commit
>> before we can create the commit context (which we however use for the
>> recursive commit).
>>
>
> So you think that it should just be backed out for now and then prevent
> such empty commits somewhat differently, right?

I worked enough with this issue to know what didn't work for me, but I 
gave up because I couldn't see any good solutions.

But it seems like the annoyance fix introduced a more serious bug, so I 
think it either should be fixed or backed out.

> Although something like the following will fix the issue you pointed
> out:
>
>                       for newstate in state:
>                           if state[newstate][1] != pstate[newstate]:
>                               changed = True
> -                if changed:
> -                    subrepo.writestate(self, state)
> -                elif (changes[0] == ['.hgsubstate'] and changes[1] ==
> [] and
> +                subrepo.writestate(self, state)
> +                if (not changed and changes[0] == ['.hgsubstate']
> +                    and changes[1] == [] and
>                        changes[2] == []):
>                       return None

That would bring us back to still making empty substate commits when 
there are other changes, right?

I guess a good fix in this direction should remove .hgsubstate from 
changes[0] if it is unchanged, and _then_ we can try to abort the commit 
if there is nothing left to commit ... unless we are in one of the 
situations where we really want to make an empty commit.

/Mads


More information about the Mercurial-devel mailing list