Mercurial > hg-stable
changeset 6112:5ffa962783c4
cmdutil.commit: use relative paths in the error messages
This is more consistent with other error messages and requires
less makeup in test-commit and test-symlink-basic.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 15 Feb 2008 10:38:37 -0200 |
parents | 213ea6eed412 |
children | 8ca25589e960 |
files | mercurial/cmdutil.py tests/test-commit tests/test-commit.out tests/test-symlink-basic tests/test-symlink-basic.out |
diffstat | 5 files changed, 23 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Fri Feb 15 10:38:37 2008 -0200 +++ b/mercurial/cmdutil.py Fri Feb 15 10:38:37 2008 -0200 @@ -1133,10 +1133,11 @@ continue if f not in files: rf = repo.wjoin(f) + rel = repo.pathto(f) try: mode = os.lstat(rf)[stat.ST_MODE] except OSError: - raise util.Abort(_("file %s not found!") % rf) + raise util.Abort(_("file %s not found!") % rel) if stat.S_ISDIR(mode): name = f + '/' if slist is None: @@ -1145,12 +1146,12 @@ i = bisect.bisect(slist, name) if i >= len(slist) or not slist[i].startswith(name): raise util.Abort(_("no match under directory %s!") - % rf) + % rel) elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)): raise util.Abort(_("can't commit %s: " - "unsupported file type!") % rf) + "unsupported file type!") % rel) elif f not in repo.dirstate: - raise util.Abort(_("file %s not tracked!") % rf) + raise util.Abort(_("file %s not tracked!") % rel) else: files = [] try:
--- a/tests/test-commit Fri Feb 15 10:38:37 2008 -0200 +++ b/tests/test-commit Fri Feb 15 10:38:37 2008 -0200 @@ -1,10 +1,5 @@ #!/bin/sh -cleanpath() -{ - sed -e "s:/.*\(/test/.*\):...\1:" -} - echo % commit date test hg init test cd test @@ -23,8 +18,8 @@ echo bar > bar hg add bar rm bar -hg commit -d "1000000 0" -m commit-8 2>&1 | cleanpath -hg commit -d "1000000 0" -m commit-8 bar 2>&1 | cleanpath +hg commit -d "1000000 0" -m commit-8 +hg commit -d "1000000 0" -m commit-8-2 bar hg -q revert -a --no-backup @@ -35,22 +30,22 @@ echo > dir.file hg add -hg commit -d '0 0' -m commit-10 dir dir.file 2>&1 | cleanpath +hg commit -d '0 0' -m commit-10 dir dir.file echo >> dir/file mkdir bleh mkdir dir2 cd bleh -hg commit -d '0 0' -m commit-11 . 2>&1 | cleanpath -hg commit -d '0 0' -m commit-12 ../dir ../dir2 2>&1 | cleanpath +hg commit -d '0 0' -m commit-11 . +hg commit -d '0 0' -m commit-12 ../dir ../dir2 hg -v commit -d '0 0' -m commit-13 ../dir cd .. -hg commit -d '0 0' -m commit-14 does-not-exist 2>&1 | cleanpath +hg commit -d '0 0' -m commit-14 does-not-exist ln -s foo baz -hg commit -d '0 0' -m commit-15 baz 2>&1 | cleanpath +hg commit -d '0 0' -m commit-15 baz touch quux -hg commit -d '0 0' -m commit-16 quux 2>&1 | cleanpath +hg commit -d '0 0' -m commit-16 quux echo >> dir/file hg -v commit -d '0 0' -m commit-17 dir/file cd ..
--- a/tests/test-commit.out Fri Feb 15 10:38:37 2008 -0200 +++ b/tests/test-commit.out Fri Feb 15 10:38:37 2008 -0200 @@ -14,18 +14,18 @@ nothing changed % commit added file that has been deleted nothing changed -abort: file .../test/bar not found! +abort: file bar not found! adding dir/file dir/file adding dir.file -abort: no match under directory .../test/dir! -abort: no match under directory .../test/bleh! -abort: no match under directory .../test/dir2! +abort: no match under directory dir! +abort: no match under directory .! +abort: no match under directory ../dir2! dir/file does-not-exist: No such file or directory -abort: file .../test/does-not-exist not found! -abort: file .../test/baz not tracked! -abort: file .../test/quux not tracked! +abort: file does-not-exist not found! +abort: file baz not tracked! +abort: file quux not tracked! dir/file % partial subdir commit test adding bar/bar
--- a/tests/test-symlink-basic Fri Feb 15 10:38:37 2008 -0200 +++ b/tests/test-symlink-basic Fri Feb 15 10:38:37 2008 -0200 @@ -2,17 +2,12 @@ "$TESTDIR/hghave" symlink || exit 80 -cleanpath() -{ - sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" -} - hg init a cd a ln -s nothing dangling -hg commit -m 'commit symlink without adding' -d '0 0' dangling 2>&1 | cleanpath +hg commit -m 'commit symlink without adding' dangling hg add dangling -hg commit -m 'add symlink' -d '0 0' +hg commit -m 'add symlink' hg tip -v hg manifest --debug