Commit Graph

11 Commits

Author SHA1 Message Date
Pierre-Yves David
ec7068f984 configitems: register the 'worker.backgroundcloseminfilecount' config 2017-06-30 03:45:59 +02:00
Pierre-Yves David
11b3c8d2af configitems: register the 'worker.backgroundclosemaxqueue' config 2017-06-30 03:45:58 +02:00
Siddharth Agarwal
e0e3b8e4ce filestat: move __init__ to frompath constructor
We're going to add a `fromfp` constructor soon, and this also allows a filestat
object for a non-existent file to be created.
2017-06-10 14:09:54 -07:00
FUJIWARA Katsunori
534d75d626 vfs: create copy at renaming to avoid file stat ambiguity if needed
In order to fix issue5418, 0d920bcb0fd1 made vfs.rename(checkambig=True)
omit advancing mtime of renamed file, if renamed file is owned by
another (EPERM is raised in this case).

But this omission causes rewinding mtime at restoration in such
situation, and makes avoiding file stat ambiguity difficult, because
ExactCacheValidationPlan assumes that mtime should be advanced, if a
file is changed in same ctime.

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan

Ambiguity of file stat also requires issue5584 to be fixed with other
than file stat, but "hash of file", "generation ID" and so on were
already rejected ideas (please see original RFC linked from "Outline
of issue" in ExactCacheValidationPlan page).

This omission occurs:

  - only for non append-only files (dirstate, bookmarks, and phaseroots), and
  - only if previous transaction is rollbacked by another user

The latter means "sharing a repository clone via group permission".
This is reasonable usecase, but not ordinary for many users, IMHO.
"hg rollback" itself has been deprecated since Mercurial 2.7, too.

Therefore, increasing the cost at rollbacking previous transaction
executed by another a little seems reasonable, for avoidance of file
stat ambiguity.

This patch does:

  - create copy of (already renamed) source file, if advancing mtime
    fails for EPERM
  - rename from copied file to destination file, and
  - advance mtime of renamed file, which is now owned by current user

This patch also factors "self.join(src)" out to reduce redundancy.
2017-06-09 12:58:18 +09:00
FUJIWARA Katsunori
f7f00ec91e vfs: factor out "rename and avoid ambiguity" to reuse
This makes subsequent patch simple.
2017-06-09 12:58:18 +09:00
Yuya Nishihara
cbe21a1cc9 osutil: proxy through util (and platform) modules (API)
See the previous commit for why. Marked as API change since osutil.listdir()
seems widely used in third-party extensions.

The win32mbcs extension is updated to wrap both util. and windows. aliases.
2017-04-26 22:26:28 +09:00
Yuya Nishihara
2a7deb97d4 py3: abuse r'' to preserve str-ness of literals passed to __setattr__() 2017-03-26 16:33:12 +09:00
Ryan McElroy
cb1115163c vfs: use tryunlink 2017-03-21 06:50:28 -07:00
Ryan McElroy
a75b679fd2 vfs: add tryunlink method
Thoughout hg code, we see a pattern of attempting to remove a file and then
catching and ignoring any errors due to a missing file in the calling code.
Let's unify this pattern in a single implementation in the vfs layer.
2017-03-21 06:50:28 -07:00
Mads Kiilerich
a936a7f3a7 vfs: use repo.wvfs.unlinkpath 2015-01-14 01:15:26 +01:00
Pierre-Yves David
12f94cda0a vfs: extract 'vfs' class and related code to a new 'vfs' module (API)
The 'scmutil' is growing large (1500+ lines) and 2/5 of it is related to vfs.
We extract the 'vfs' related code in its own module get both module back to a
better scale and clearer contents.

We keep all the references available in 'scmutil' for now as many reference
needs to be updated.
2017-03-01 11:00:12 +01:00