# HG changeset patch # User Brendan Cully # Date 1181787080 25200 # Node ID 4500fbe3a432c52276f1d7a2f8287ab26cc693bc # Parent b1716a8b32d3daa2798cdf72178baa2633520ec1# Parent e7d4ed543de5371fdbb889588e9612bded595cc1 Merge with crew diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -438,11 +438,14 @@ class queue: def apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, wlock=None, all_files={}): + if not wlock: + wlock = repo.wlock() + lock = repo.lock() tr = repo.transaction() try: ret = self._apply(tr, repo, series, list, update_status, strict, patchdir, merge, wlock, - all_files=all_files) + lock=lock, all_files=all_files) tr.close() self.save_dirty() return ret @@ -456,14 +459,11 @@ class queue: def _apply(self, tr, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, wlock=None, - all_files={}): + lock=None, all_files={}): # TODO unify with commands.py if not patchdir: patchdir = self.path err = 0 - if not wlock: - wlock = repo.wlock() - lock = repo.lock() n = None for patchname in series: pushable, reason = self.pushable(patchname) @@ -1057,9 +1057,11 @@ class queue: aaa = aa[:] if opts.get('short'): filelist = mm + aa + dd + match = dict.fromkeys(filelist).__contains__ else: filelist = None - m, a, r, d, u = repo.status(files=filelist)[:5] + match = util.always + m, a, r, d, u = repo.status(files=filelist, match=match)[:5] # we might end up with files that were added between tip and # the dirstate parent, but then changed in the local dirstate. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -574,9 +574,7 @@ def addremove(repo, pats=[], opts={}, wl mapping[abs] = rel, exact if repo.ui.verbose or not exact: repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) - islink = os.path.islink(target) - if (repo.dirstate.state(abs) != 'r' and not islink - and not os.path.exists(target)): + if repo.dirstate.state(abs) != 'r' and not util.lexists(target): remove.append(abs) mapping[abs] = rel, exact if repo.ui.verbose or not exact: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -404,8 +404,6 @@ def commit(ui, repo, *pats, **opts): continue if f not in files: rf = repo.wjoin(f) - if f in unknown: - raise util.Abort(_("file %s not tracked!") % rf) try: mode = os.lstat(rf)[stat.ST_MODE] except OSError: @@ -419,9 +417,11 @@ def commit(ui, repo, *pats, **opts): if i >= len(slist) or not slist[i].startswith(name): raise util.Abort(_("no match under directory %s!") % rf) - elif not stat.S_ISREG(mode): + elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)): raise util.Abort(_("can't commit %s: " "unsupported file type!") % rf) + elif repo.dirstate.state(f) == '?': + raise util.Abort(_("file %s not tracked!") % rf) else: files = [] try: @@ -2099,7 +2099,7 @@ def remove(ui, repo, *pats, **opts): forget.append(abs) continue reason = _('has been marked for add (use -f to force removal)') - elif abs in unknown: + elif repo.dirstate.state(abs) == '?': reason = _('is not managed') elif opts['after'] and not exact and abs not in deleted: continue @@ -2261,8 +2261,7 @@ def revert(ui, repo, *pats, **opts): def handle(xlist, dobackup): xlist[0].append(abs) update[abs] = 1 - if (dobackup and not opts['no_backup'] and - (os.path.islink(target) or os.path.exists(target))): + if dobackup and not opts['no_backup'] and util.lexists(target): bakname = "%s.orig" % rel ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -951,7 +951,8 @@ class localrepository(repo.repository): if fcmp(f, getnode): modified.append(f) else: - clean.append(f) + if list_clean: + clean.append(f) if not wlock and not mywlock: mywlock = True try: @@ -1013,16 +1014,17 @@ class localrepository(repo.repository): wlock = self.wlock() for f in list: p = self.wjoin(f) - islink = os.path.islink(p) - size = os.lstat(p).st_size - if size > 10000000: + try: + st = os.lstat(p) + except: + self.ui.warn(_("%s does not exist!\n") % f) + continue + if st.st_size > 10000000: self.ui.warn(_("%s: files over 10MB may cause memory and" " performance problems\n" "(use 'hg revert %s' to unadd the file)\n") % (f, f)) - if not islink and not os.path.exists(p): - self.ui.warn(_("%s does not exist!\n") % f) - elif not islink and not os.path.isfile(p): + if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): self.ui.warn(_("%s not added: only files and symlinks " "supported currently\n") % f) elif self.dirstate.state(f) in 'an': diff --git a/tests/test-symlink-basic b/tests/test-symlink-basic --- a/tests/test-symlink-basic +++ b/tests/test-symlink-basic @@ -1,5 +1,10 @@ #!/bin/sh +cleanpath() +{ + sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" +} + cat >> readlink.py <&1 | cleanpath hg add dangling hg commit -m 'add symlink' -d '0 0' diff --git a/tests/test-symlink-basic.out b/tests/test-symlink-basic.out --- a/tests/test-symlink-basic.out +++ b/tests/test-symlink-basic.out @@ -1,3 +1,4 @@ +abort: file .../test-symlink-basic/a/dangling not tracked! changeset: 0:cabd88b706fc tag: tip user: test