Mercurial > hg-stable
changeset 4581:4500fbe3a432
Merge with crew
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Wed, 13 Jun 2007 19:11:20 -0700 |
parents | b1716a8b32d3 (current diff) e7d4ed543de5 (diff) |
children | 7de7a80e7422 |
files | |
diffstat | 6 files changed, 30 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Wed Jun 13 19:05:20 2007 -0700 +++ b/hgext/mq.py Wed Jun 13 19:11:20 2007 -0700 @@ -438,11 +438,14 @@ 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 @@ 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 @@ 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.
--- a/mercurial/cmdutil.py Wed Jun 13 19:05:20 2007 -0700 +++ b/mercurial/cmdutil.py Wed Jun 13 19:11:20 2007 -0700 @@ -574,9 +574,7 @@ 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:
--- a/mercurial/commands.py Wed Jun 13 19:05:20 2007 -0700 +++ b/mercurial/commands.py Wed Jun 13 19:11:20 2007 -0700 @@ -404,8 +404,6 @@ 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 @@ 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 @@ 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 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))
--- a/mercurial/localrepo.py Wed Jun 13 19:05:20 2007 -0700 +++ b/mercurial/localrepo.py Wed Jun 13 19:11:20 2007 -0700 @@ -951,7 +951,8 @@ 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 @@ 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':
--- a/tests/test-symlink-basic Wed Jun 13 19:05:20 2007 -0700 +++ b/tests/test-symlink-basic Wed Jun 13 19:11:20 2007 -0700 @@ -1,5 +1,10 @@ #!/bin/sh +cleanpath() +{ + sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" +} + cat >> readlink.py <<EOF import os import sys @@ -11,6 +16,7 @@ hg init a cd a ln -s nothing dangling +hg commit -m 'commit symlink without adding' -d '0 0' dangling 2>&1 | cleanpath hg add dangling hg commit -m 'add symlink' -d '0 0'