<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 30, 2015 at 8:50 AM FUJIWARA Katsunori <<a href="mailto:foozy@lares.dti.ne.jp">foozy@lares.dti.ne.jp</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">At Mon, 29 Jun 2015 04:23:47 +0000,<br>
Martin von Zweigbergk wrote:<br>
><br>
> [1  <text/plain; UTF-8 (7bit)>]<br>
> On Sun, Jun 28, 2015 at 9:07 AM FUJIWARA Katsunori <<a href="mailto:foozy@lares.dti.ne.jp" target="_blank">foozy@lares.dti.ne.jp</a>><br>
> wrote:<br>
><br>
> ><br>
> > OK, I'll try to fix problems by invoking `dirstate.write()` at (*1) !<br>
><br>
><br>
> Great! I wasn't sure if I was missing something and wasting everyone's<br>
> time. I'm glad it now seems it was worthwhile. And thanks for working on<br>
> this! I'm pretty sure I've been bitten at least twice by this while<br>
> rebasing (dirty file appeared clean).<br>
<br>
Thanks for your many suggestions, too !<br>
<br>
<br>
> Just a reminder that adding a check for dirty dirstate in<br>
> localrepo.wwrite() seems like a good way to find the places to fix (and<br>
> perhaps for printing a warning after we've fixed the known buggy callers).<br>
<br>
You mean steps like below, or others ?<br></blockquote><div><br></div><div>I meant that something as simple as adding the following two lines to the top of localrepo.wwrite() seems helpful for finding bugs:</div><div><br></div><div><div>  if self.dirstate._dirty:</div><div>      util.dst("BUG: writing file to disk while dirstate is dirty")</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
  - `localrepo.wwrite()` tells dirstate that the file is "updated"<br>
<br>
  - dirstate clears "updated" mark of files, on which `normal`,<br>
    `normallookup` and so on are applied<br>
<br>
  - `dirstate.write()` warns (with `ui.develwarn`) if there are files<br>
    still marked as "updated"<br>
<br>
<br>
BTW, as Pierre-Yves pointed out before, `merge.update` may invoke<br>
`localrepo.wwrite` on forked worker processes, and marking in<br>
`localrepo.wwrite` doesn't work well in such case :-<<br>
<br>
<br>
> Does it make sense for workingctx._dirstatestatus() to do the writing? Or<br>
> maybe it needs to be done at a higher level that's aware of any running<br>
> transaction?<br>
<br>
I'm putting `dirstate.write()` into `workingctx._checklookup()` at<br>
first, because occasional test failure for "unexpected status"<br>
prevents any subsequent development :-)<br>
<br>
Then, explicit `dirstate.write()` invocations will be replaced by<br>
another one if needed, while making in-memory dirstate changes visible<br>
to external process.<br>
<br>
<br>
----------------------------------------------------------------------<br>
[FUJIWARA Katsunori]                             <a href="mailto:foozy@lares.dti.ne.jp" target="_blank">foozy@lares.dti.ne.jp</a><br>
</blockquote></div></div>