##// END OF EJS Templates
dirstate: ignore symlinks when fs cannot handle them (issue1888)...
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%.

File last commit:

r11624:67260651 default
r11769:ca6cebd8 stable
Show More
streamclone.py
69 lines | 2.2 KiB | text/x-python | PythonLexer
Vadim Gelfer
add support for streaming clone....
r2612 # streamclone.py - streaming clone server support for mercurial
#
# Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
#
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
Vadim Gelfer
add support for streaming clone....
r2612
Matt Mackall
error: move lock errors...
r7640 import util, error
Vadim Gelfer
add support for streaming clone....
r2612
Benoit Boissinot
filelog encoding: move the encoding/decoding into store...
r8531 from mercurial import store
Dirkjan Ochtman
make streamclone.stream_out() a generator
r6925 class StreamException(Exception):
def __init__(self, code):
Exception.__init__(self)
self.code = code
def __str__(self):
return '%i\n' % self.code
Vadim Gelfer
add support for streaming clone....
r2612 # if server supports streaming clone, it advertises "stream"
# capability with value that is version+flags of repo it is serving.
# client only streams if it can read that repo format.
# stream file format is simple.
#
# server writes out line that says how many files, how many total
# bytes. separator is ascii space, byte counts are strings.
#
# then for each file:
#
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 # server writes out line that says filename, how many bytes in
Vadim Gelfer
add support for streaming clone....
r2612 # file. separator is ascii nul, byte count is string.
#
# server writes out raw file data.
Matt Mackall
streamclone: allow uncompressed clones by default
r10377 def allowed(ui):
Matt Mackall
streaming: actually change default
r10414 return ui.configbool('server', 'uncompressed', True, untrusted=True)
Matt Mackall
streamclone: allow uncompressed clones by default
r10377
def stream_out(repo):
Vadim Gelfer
add support for streaming clone....
r2612 '''stream out all metadata files in repository.
writes to file-like object, must support write() and optional flush().'''
Vadim Gelfer
clone: disable stream support on server side by default....
r2621
Matt Mackall
streamclone: allow uncompressed clones by default
r10377 if not allowed(repo.ui):
Dirkjan Ochtman
make streamclone.stream_out() a generator
r6925 raise StreamException(1)
Vadim Gelfer
clone: disable stream support on server side by default....
r2621
Matt Mackall
streamclone: fold in localrepo.storefiles
r6901 entries = []
total_bytes = 0
Thomas Arendsen Hein
Handle locking exceptions if streaming clone can't lock the repo. (Issue324)
r3687 try:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 # get consistent snapshot of repo, lock during scan
lock = repo.lock()
Matt Mackall
streamclone: fold in localrepo.storefiles
r6901 try:
Martin Geisler
do not attempt to translate ui.debug output
r9467 repo.ui.debug('scanning\n')
Matt Mackall
streamclone: fold in localrepo.storefiles
r6901 for name, ename, size in repo.store.walk():
Greg Ward
streamclone: partially encode filename over the wire, not for local read (issue1847)...
r9506 entries.append((name, size))
Matt Mackall
streamclone: fold in localrepo.storefiles
r6901 total_bytes += size
finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 lock.release()
Matt Mackall
error: move lock errors...
r7640 except error.LockError:
Dirkjan Ochtman
make streamclone.stream_out() a generator
r6925 raise StreamException(2)
Thomas Arendsen Hein
Handle locking exceptions if streaming clone can't lock the repo. (Issue324)
r3687
Dirkjan Ochtman
make streamclone.stream_out() a generator
r6925 yield '0\n'
Martin Geisler
do not attempt to translate ui.debug output
r9467 repo.ui.debug('%d files, %d bytes to transfer\n' %
Vadim Gelfer
add support for streaming clone....
r2612 (len(entries), total_bytes))
Dirkjan Ochtman
make streamclone.stream_out() a generator
r6925 yield '%d %d\n' % (len(entries), total_bytes)
Vadim Gelfer
add support for streaming clone....
r2612 for name, size in entries:
Martin Geisler
do not attempt to translate ui.debug output
r9467 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
Greg Ward
streamclone: partially encode filename over the wire, not for local read (issue1847)...
r9506 # partially encode name over the wire for backwards compat
yield '%s\0%d\n' % (store.encodedir(name), size)
Benoit Boissinot
introduce localrepo.spath for the store path, sopener fixes
r3791 for chunk in util.filechunkiter(repo.sopener(name), limit=size):
Dirkjan Ochtman
make streamclone.stream_out() a generator
r6925 yield chunk