Commits on Source (26)
-
Pierre-Yves David authored
Otherwise the transaction will properly clean up its mess on abort… deleting the backup in the process. This break with dirstate-v2 that has more file than just the dirstate. The dirstate itself is full of various exception and is "fine" when using dirstate-v1.
f0a3aaa07d6a -
Matt Harbison authored
This assumes implementation details, but I don't see any other way than to check the environment variables ourselves (which would miss out on any future enhancements that Python may make). This was originally reported as mercurial/tortoisehg/thg#5835.
805419729e11 -
Arseniy Alekseyev authored
By making the computation of [has_ignored_ancestor] lazy we're eliding its computation in the common case when none of its descendants have changed on disk. On a ~400k files repo, with a cached status, we saw a ~64% reduction in CPU time, resulting in a speedup of ~10-15% (on ZFS), and a speedup of ~38% of XFS (XFS has faster stat operations for some reason).
eb02decdf0ab -
Matt Harbison authored
The revlog and LFS modules use various `&` and `&=` operations with this value, which no longer treats `None` as 0. Since nothing cares if it was actually set in the config or not, just default to 0 for simplicity.
a5f551f8b723 -
Jason R. Coombs authoredf599a946181d
-
Jason R. Coombs authored52dd7a43ad5c
-
Anton Shestakov authored45268599f55e
-
Anton Shestakov authoredc7c437f35687
-
Matt Harbison authored
Seen in the wild in a server log when MS antivirus was quarantining a file on the client side.
192949b68159 -
Raphaël Gomès authored
This marks the feature freeze for the 6.3 release
a3356ab610fc -
Raphaël Gomès authoredf68d285158b2
-
Matt Harbison authored
The message about the server crash originated in 0ee0a3f6a990 (after support for serving blobs was added), but was copied from the Facebook repo that forked prior to server side support. Therefore, this message only displayed in their client, so it was safe to assume the server crashed. But that was never the case for vanilla Mercurial, as I saw this in a server log. Also, display the blob reference so that it's easier to figure out where the problem was when a bunch of blobs are transferred at once.
250d9c8aaf10 -
Matt Harbison authored
It's assigned again 2 lines later.
8d6c8a9a91f8 -
Matt Harbison authored
I had trouble isolating some LFS blob corruption detected by `hg verify` because the traceback referenced a file, but with the `data/` prefix in the `.hg/store` path, so it couldn't be located with the `file()` revset: ``` Traceback (most recent call last): File "/mnt/d/mercurial/mercurial/revlog.py", line 3209, in verifyintegrity _verify_revision(self, skipflags, state, node) File "/mnt/d/mercurial/hgext/lfs/wrapper.py", line 246, in _verify_revision orig(rl, skipflags, state, node) File "/mnt/d/mercurial/mercurial/revlog.py", line 158, in _verify_revision rl.revision(node) File "/mnt/d/mercurial/mercurial/revlog.py", line 1816, in revision return self._revisiondata(nodeorrev, _df) File "/mnt/d/mercurial/mercurial/revlog.py", line 1870, in _revisiondata self.checkhash(text, node, rev=rev) File "/mnt/d/mercurial/mercurial/revlog.py", line 1996, in checkhash % (self.display_id, pycompat.bytestr(revornode)) mercurial.error.RevlogError: integrity check failed on data/EXE/PPC/shrinksrec.exe:0 ``` (I'm a little surprised it resulted in a stacktrace instead of just a message, but that's a different issue. I'm also not sure how to trigger the simplestore case, since IIUC, it's also a revlog based store.) It's not clear how to handle the changelog and manifest (because the user doesn't interact with them as a file), so those cases are left alone. The other thing that would be nice to improve somehow is to indicate that the ":0" is a revlog revision, not the changeset revision that users are used to. I'm not sure how to handle the "or node" part though.
92892dff03f3 -
Matt Harbison authored
At least in preview mode, this hides the text so the user doesn't have to delete it. It's still visible in edit mode, so the user sees it.
7b6d3a9bd7be -
Anton Shestakov authored
See 6000f5b25c9b.
87516dd774d0 -
Anton Shestakov authored
See 6000f5b25c9b.
f58f955adad4 -
Pierre-Yves David authored
We don't support Python2 anymore
976648e20856 -
Raphaël Gomès authored6b32d39e9a67
-
Raphaël Gomès authored
Currently, any time the status algorithm needs to read a directory from the filesystem (because the stat-only optimization is not available), it also stats each directory entry eagerly. Stat'ing the entries is only needed in a few cases (like when checking the mtime of a directory for caching): this patch creates a wrapper struct `DirEntry` that only stats the directory entry it represents when needed. Excerpt of an `strace` before this change on Mozilla Central: ``` openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3 newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=3540, ...}, AT_EMPTY_PATH) = 0 getdents64(3, 0x55dc970bd440 /* 139 entries */, 32768) = 5072 statx(3, ".hg", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=772, ...}) = 0 [... 135 other successful `statx` calls] getdents64(3, 0x55dc970bd440 /* 0 entries */, 32768) = 0 close(3) = 0 ``` After this change: ``` openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3 newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=3540, ...}, AT_EMPTY_PATH) = 0 getdents64(3, 0x561567c10190 /* 139 entries */, 32768) = 5072 getdents64(3, 0x561567c10190 /* 0 entries */, 32768) = 0 close(3) = 0 ```
da48f170d203 -
Matt Harbison authored
This check flags py3 annotations of named parameters, because `black` adds spaces around the assignment in this case. Since the chosen formatter has opinions (and pylint also wants the space in the case of annotations), drop the check so we can use py3 annotations.
3a2b6158374a -
Matt Harbison authored
There's a lot more that could be done, but this sticks to the obviously correct stuff that is either related to existing imports or primitives. Hopefully this helps smoke out more path related bytes vs str issues in TortoiseHg. I'm avoiding the interfaces for now, because they seem to confuse pytype and/or PyCharm. It might be worth typing the return of `makelocalrepository` to `localrepository`, but that leaks an implementation detail, so that can be revisited later.
8fa3f7c3a9ad -
Matt Harbison authored
With typehints on the vfs objects, pytype will flag this: FAILED: /mnt/c/Users/Matt/hg/.pytype/pyi/mercurial/patch.pyi /usr/bin/python3.8 -m pytype.single --imports_info /mnt/c/Users/Matt/hg/.pytype/imports/mercurial.patch.imports --module-name mercurial.patch -V 3.7 -o /mnt/c/Users/Matt/hg/.pytype/pyi/mercurial/patch.pyi --analyze-annotated --nofail --quick /mnt/c/Users/Matt/hg/mercurial/patch.py File "/mnt/c/Users/Matt/hg/mercurial/patch.py", line 535, in writerej: No attribute 'writelines' on mercurial.util.atomictempfile [attribute-error] In Union[ mercurial.util.atomictempfile, mercurial.vfs.checkambigatclosing, mercurial.vfs.delayclosedfile, mercurial.windows.fdproxy, mercurial.windows.mixedfilemodewrapper ] It's not a real problem there (atomictempfile is only created by passing different args), but it's reasonable for this to implement the function and behave like a normal file. There are other functions missing that can be added if/when needed.
c4f07a011714 -
Matt Harbison authored
Again, there's a lot more that could be done, but this sticks to the obviously correct stuff that is related to primitives or `vfs` objects. Hopefully this helps smoke out more path related bytes vs str issues in TortoiseHg. PyCharm seems smart enough to apply hints from annotated superclass functions, but pytype isn't (according to the *.pyi file generated), so those are annotated too. There was some discussion about changing the default path arg from `None` to `b''` in order to avoid the more verbose `Optional` declarations. This would be more in line with `os.path.join()` (which rejects `None`, but ignores empty strings), and still not change the behavior for callers still passing `None` (because the check is `if path` instead of an explicit check for `None`). But I didn't want to hold this up while discussing that, so this documents what _is_.
cc9a60050a07 -
Matt Harbison authored
The default was already binary for `abstractvfs`, and the `vfs` implementation adds binary mode if the caller didn't supply it. Therefore, it should be safe for all vfs objects (and I don't think we want text reads anyway).
2506c3ac73f4 -
Matt Harbison authoredbbbb5213d043
Showing
- .gitlab/merge_request_templates/Default.md 5 additions, 0 deletions.gitlab/merge_request_templates/Default.md
- contrib/check-code.py 0 additions, 4 deletionscontrib/check-code.py
- hgdemandimport/demandimportpy3.py 0 additions, 2 deletionshgdemandimport/demandimportpy3.py
- hgext/fsmonitor/pywatchman/__init__.py 0 additions, 2 deletionshgext/fsmonitor/pywatchman/__init__.py
- hgext/fsmonitor/pywatchman/capabilities.py 0 additions, 2 deletionshgext/fsmonitor/pywatchman/capabilities.py
- hgext/fsmonitor/pywatchman/compat.py 0 additions, 2 deletionshgext/fsmonitor/pywatchman/compat.py
- hgext/fsmonitor/pywatchman/encoding.py 0 additions, 2 deletionshgext/fsmonitor/pywatchman/encoding.py
- hgext/fsmonitor/pywatchman/load.py 0 additions, 2 deletionshgext/fsmonitor/pywatchman/load.py
- hgext/fsmonitor/pywatchman/pybser.py 0 additions, 2 deletionshgext/fsmonitor/pywatchman/pybser.py
- hgext/lfs/blobstore.py 7 additions, 3 deletionshgext/lfs/blobstore.py
- mercurial/configitems.py 1 addition, 1 deletionmercurial/configitems.py
- mercurial/localrepo.py 40 additions, 23 deletionsmercurial/localrepo.py
- mercurial/revlog.py 7 additions, 4 deletionsmercurial/revlog.py
- mercurial/shelve.py 2 additions, 5 deletionsmercurial/shelve.py
- mercurial/util.py 1 addition, 0 deletionsmercurial/util.py
- mercurial/utils/stringutil.py 42 additions, 23 deletionsmercurial/utils/stringutil.py
- mercurial/vfs.py 78 additions, 58 deletionsmercurial/vfs.py
- mercurial/windows.py 7 additions, 1 deletionmercurial/windows.py
- rust/Cargo.lock 7 additions, 0 deletionsrust/Cargo.lock
- rust/hg-core/Cargo.toml 3 additions, 0 deletionsrust/hg-core/Cargo.toml