Commit Graph

11 Commits

Author SHA1 Message Date
Yuya Nishihara
1d44bd2bbb ui: factor out ui.load() to create a ui without loading configs (API)
This allows us to write doctests depending on a ui object, but not on global
configs.

ui.load() is a class method so we can do wsgiui.load(). All ui() calls but
for doctests are replaced with ui.load(). Some of them could be changed to
not load configs later.
2016-10-22 14:35:10 +09:00
Mads Kiilerich
155cddd3c3 posix: give checklink a fast path that cache the check file and is read only
util.checklink would create a symlink and remove it again. That would sometimes
happen multiple times. Write operations are relatively expensive and give disk
tear and noise for applications monitoring file system activity.

Instead of creating a symlink and deleting it again, just create it once and
leave it in .hg/cache/check-link . If the file exists, just verify that
os.islink reports true. We will assume that this check is as good as symlink
creation not failing.

Note: The symlink left in .hg/cache has to resolve to a file - otherwise 'make
dist' will fail ...

test-symlink-os-yes-fs-no.py does some monkey patching to simulate a platform
without symlink support. The slightly different testing method requires
additional monkeying.
2015-01-14 01:15:26 +01:00
Pulkit Goyal
d06862e5b0 tests: make test-symlink-os-yes-fs-no use absolute_import 2016-04-14 00:58:31 +05:30
Augie Fackler
807e21c5e0 test-symlink-os-yes-fs-no.py: clean up use of two-argument raise
This makes any attempt to port to Python 3 harder, and the new syntax
is supported in 2.4 already.
2013-01-01 13:21:15 -06:00
Mads Kiilerich
ccfffc07ba tests: add missing no-outer-repo requirements
Outer repos (if any) will now never be touched by the tests. But it is better
to run without any repos around the tmp directory.
2012-06-20 23:41:21 +02:00
Augie Fackler
dfe2a9638f tests: use getattr instead of hasattr 2011-07-25 16:37:18 -05:00
Peter Arrenbrecht
d836ee3cea hg: add opts argument to clone for internal remoteui 2011-06-08 18:24:33 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Nicolas Dumazet
274ada7d8c tests: move test bundles in a bundles/ subdirectory 2011-04-30 17:38:06 +02:00
Martin Geisler
797369393f dirstate: ignore symlinks when fs cannot handle them (issue1888)
When the filesystem cannot handle the executable bit, we currently
ignore it completely when looking for modified files. Similarly, it is
impossible to set or clear the bit when the filesystem ignores it.

This patch makes Mercurial treat symbolic links the same way.

Symlinks are a little different since they manifest themselves as
small files containing a filename (the symlink target). On Windows,
these files show up as regular files, and on Linux and Mac they show
up as real symlinks.

Issue1888 presents a case where the symlink files are better ignored
from the Windows side. A Linux client creates symlinks in a working
copy which is shared over a network between Linux and Windows clients.

The Samba server is helpful and defererences the symlink when the
Windows client looks at it. This means that Mercurial on the Windows
side sees file content instead of a file name in the symlink, and
hence flags the link as modified. Ignoring the change would be much
more helpful, similarly to how Mercurial does not report any changes
when executable bits are ignored in a checkout on Windows.

An initial checkout of a symbolic link on a file system that cannot
handle symbolic links will still result in a regular file containing
the target file name as its content. Sharing such a checkout with a
Linux client will not turn the file into a symlink automatically, but
'hg revert' can fix that. After the revert, the Windows client will
see the correct file content (provided by the Samba server when it
follows the link on the Linux side) and otherwise ignore the change.

Running 'hg perfstatus' 10 times gives these results:

  Before:          After:
  min: 0.544703    min: 0.546549
  med: 0.547592    med: 0.548881
  avg: 0.549146    avg: 0.548549
  max: 0.564112    max: 0.551504

The median time is increased about 0.24%.
2010-08-09 15:31:56 +02:00
Dov Feldstern
7805ceec07 test symlinks on symlink-capable os but non-capable filesystem (issue1149)
The "real" way to test this is to mount a non-symlink-capable filesystem, and
try working on it; however, I don't know how to mount filesystems as a
non-priveleged user from within the testing framework. So instead, os.symlink
is overridden to raise the exception that would be raised on such a filesystem.
2008-07-31 22:41:19 +03:00