diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1133,10 +1133,11 @@ def commit(ui, repo, commitfunc, pats, o 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 @@ def commit(ui, repo, commitfunc, pats, o 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: diff --git a/tests/test-commit b/tests/test-commit --- a/tests/test-commit +++ b/tests/test-commit @@ -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 % commit added file that has been d 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 @@ hg -v commit -d '0 0' -m commit-9 dir 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 .. diff --git a/tests/test-commit.out b/tests/test-commit.out --- a/tests/test-commit.out +++ b/tests/test-commit.out @@ -14,18 +14,18 @@ abort: invalid date: 'foo bar' 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 diff --git a/tests/test-symlink-basic b/tests/test-symlink-basic --- a/tests/test-symlink-basic +++ b/tests/test-symlink-basic @@ -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 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,4 +1,4 @@ -abort: file .../test-symlink-basic/a/dangling not tracked! +abort: file dangling not tracked! changeset: 0:cabd88b706fc tag: tip user: test