# HG changeset patch # User Sean Farley # Date 1394227957 28800 # Node ID a45af4da0421f83c8ae7ea40b9d7be1d348d7186 # Parent b1ce47dadbdfb1952a2af1a53b0a4b08b9cb0516 localrepo: move symlink logic to workingctx diff -r b1ce47dadbdf -r a45af4da0421 mercurial/context.py --- a/mercurial/context.py Fri May 09 12:01:56 2014 +0200 +++ b/mercurial/context.py Fri Mar 07 13:32:37 2014 -0800 @@ -1178,6 +1178,25 @@ finally: wlock.release() + def _filtersuspectsymlink(self, files): + if not files or self._repo.dirstate._checklink: + return files + + # Symlink placeholders may get non-symlink-like contents + # via user error or dereferencing by NFS or Samba servers, + # so we filter out any placeholders that don't look like a + # symlink + sane = [] + for f in files: + if self.flags(f) == 'l': + d = self[f].data() + if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d): + self._repo.ui.debug('ignoring suspect symlink placeholder' + ' "%s"\n' % f) + continue + sane.append(f) + return sane + class committablefilectx(basefilectx): """A committablefilectx provides common functionality for a file context that wants the ability to commit, e.g. workingfilectx or memfilectx.""" diff -r b1ce47dadbdf -r a45af4da0421 mercurial/localrepo.py --- a/mercurial/localrepo.py Fri May 09 12:01:56 2014 +0200 +++ b/mercurial/localrepo.py Fri Mar 07 13:32:37 2014 -0800 @@ -1609,21 +1609,8 @@ added.append(fn) removed = mf1.keys() - if working and modified and not self.dirstate._checklink: - # Symlink placeholders may get non-symlink-like contents - # via user error or dereferencing by NFS or Samba servers, - # so we filter out any placeholders that don't look like a - # symlink - sane = [] - for f in modified: - if ctx2.flags(f) == 'l': - d = ctx2[f].data() - if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d): - self.ui.debug('ignoring suspect symlink placeholder' - ' "%s"\n' % f) - continue - sane.append(f) - modified = sane + if working: + modified = ctx2._filtersuspectsymlink(modified) r = modified, added, removed, deleted, unknown, ignored, clean