comparison mercurial/context.py @ 21393:a45af4da0421

localrepo: move symlink logic to workingctx
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 07 Mar 2014 13:32:37 -0800
parents 25d6fdc0294a
children f251b92d9ed9
comparison
equal deleted inserted replaced
21392:b1ce47dadbdf 21393:a45af4da0421
1176 self._repo.dirstate.add(dest) 1176 self._repo.dirstate.add(dest)
1177 self._repo.dirstate.copy(source, dest) 1177 self._repo.dirstate.copy(source, dest)
1178 finally: 1178 finally:
1179 wlock.release() 1179 wlock.release()
1180 1180
1181 def _filtersuspectsymlink(self, files):
1182 if not files or self._repo.dirstate._checklink:
1183 return files
1184
1185 # Symlink placeholders may get non-symlink-like contents
1186 # via user error or dereferencing by NFS or Samba servers,
1187 # so we filter out any placeholders that don't look like a
1188 # symlink
1189 sane = []
1190 for f in files:
1191 if self.flags(f) == 'l':
1192 d = self[f].data()
1193 if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d):
1194 self._repo.ui.debug('ignoring suspect symlink placeholder'
1195 ' "%s"\n' % f)
1196 continue
1197 sane.append(f)
1198 return sane
1199
1181 class committablefilectx(basefilectx): 1200 class committablefilectx(basefilectx):
1182 """A committablefilectx provides common functionality for a file context 1201 """A committablefilectx provides common functionality for a file context
1183 that wants the ability to commit, e.g. workingfilectx or memfilectx.""" 1202 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
1184 def __init__(self, repo, path, filelog=None, ctx=None): 1203 def __init__(self, repo, path, filelog=None, ctx=None):
1185 self._repo = repo 1204 self._repo = repo