##// END OF EJS Templates
dirstate: add a comment about a racy piece of code during updates...
marmoute -
r49200:c655483e default
parent child Browse files
Show More
@@ -1404,6 +1404,34 b' def batchget(repo, mctx, wctx, wantfiled'
1404 atomictemp=atomictemp,
1404 atomictemp=atomictemp,
1405 )
1405 )
1406 if wantfiledata:
1406 if wantfiledata:
1407 # XXX note that there is a race window between the time we
1408 # write the clean data into the file and we stats it. So another
1409 # writing process meddling with the file content right after we
1410 # wrote it could cause bad stat data to be gathered.
1411 #
1412 # They are 2 data we gather here
1413 # - the mode:
1414 # That we actually just wrote, we should not need to read
1415 # it from disk, (except not all mode might have survived
1416 # the disk round-trip, which is another issue: we should
1417 # not depends on this)
1418 # - the mtime,
1419 # On system that support nanosecond precision, the mtime
1420 # could be accurate enough to tell the two writes appart.
1421 # However gathering it in a racy way make the mtime we
1422 # gather "unreliable".
1423 #
1424 # (note: we get the size from the data we write, which is sane)
1425 #
1426 # So in theory the data returned here are fully racy, but in
1427 # practice "it works mostly fine".
1428 #
1429 # Do not be surprised if you end up reading this while looking
1430 # for the causes of some buggy status. Feel free to improve
1431 # this in the future, but we cannot simply stop gathering
1432 # information. Otherwise `hg status` call made after a large `hg
1433 # update` runs would have to redo a similar amount of work to
1434 # restore and compare all files content.
1407 s = wfctx.lstat()
1435 s = wfctx.lstat()
1408 mode = s.st_mode
1436 mode = s.st_mode
1409 mtime = timestamp.mtime_of(s)
1437 mtime = timestamp.mtime_of(s)
General Comments 0
You need to be logged in to leave comments. Login now