##// END OF EJS Templates
cmdutil.commit: use relative paths in the error messages...
Alexis S. L. Carvalho -
r6112:5ffa9627 default
parent child Browse files
Show More
@@ -1133,10 +1133,11 b' def commit(ui, repo, commitfunc, pats, o'
1133 continue
1133 continue
1134 if f not in files:
1134 if f not in files:
1135 rf = repo.wjoin(f)
1135 rf = repo.wjoin(f)
1136 rel = repo.pathto(f)
1136 try:
1137 try:
1137 mode = os.lstat(rf)[stat.ST_MODE]
1138 mode = os.lstat(rf)[stat.ST_MODE]
1138 except OSError:
1139 except OSError:
1139 raise util.Abort(_("file %s not found!") % rf)
1140 raise util.Abort(_("file %s not found!") % rel)
1140 if stat.S_ISDIR(mode):
1141 if stat.S_ISDIR(mode):
1141 name = f + '/'
1142 name = f + '/'
1142 if slist is None:
1143 if slist is None:
@@ -1145,12 +1146,12 b' def commit(ui, repo, commitfunc, pats, o'
1145 i = bisect.bisect(slist, name)
1146 i = bisect.bisect(slist, name)
1146 if i >= len(slist) or not slist[i].startswith(name):
1147 if i >= len(slist) or not slist[i].startswith(name):
1147 raise util.Abort(_("no match under directory %s!")
1148 raise util.Abort(_("no match under directory %s!")
1148 % rf)
1149 % rel)
1149 elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)):
1150 elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)):
1150 raise util.Abort(_("can't commit %s: "
1151 raise util.Abort(_("can't commit %s: "
1151 "unsupported file type!") % rf)
1152 "unsupported file type!") % rel)
1152 elif f not in repo.dirstate:
1153 elif f not in repo.dirstate:
1153 raise util.Abort(_("file %s not tracked!") % rf)
1154 raise util.Abort(_("file %s not tracked!") % rel)
1154 else:
1155 else:
1155 files = []
1156 files = []
1156 try:
1157 try:
@@ -1,10 +1,5 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cleanpath()
4 {
5 sed -e "s:/.*\(/test/.*\):...\1:"
6 }
7
8 echo % commit date test
3 echo % commit date test
9 hg init test
4 hg init test
10 cd test
5 cd test
@@ -23,8 +18,8 b' echo % commit added file that has been d'
23 echo bar > bar
18 echo bar > bar
24 hg add bar
19 hg add bar
25 rm bar
20 rm bar
26 hg commit -d "1000000 0" -m commit-8 2>&1 | cleanpath
21 hg commit -d "1000000 0" -m commit-8
27 hg commit -d "1000000 0" -m commit-8 bar 2>&1 | cleanpath
22 hg commit -d "1000000 0" -m commit-8-2 bar
28
23
29 hg -q revert -a --no-backup
24 hg -q revert -a --no-backup
30
25
@@ -35,22 +30,22 b" hg -v commit -d '0 0' -m commit-9 dir"
35
30
36 echo > dir.file
31 echo > dir.file
37 hg add
32 hg add
38 hg commit -d '0 0' -m commit-10 dir dir.file 2>&1 | cleanpath
33 hg commit -d '0 0' -m commit-10 dir dir.file
39
34
40 echo >> dir/file
35 echo >> dir/file
41 mkdir bleh
36 mkdir bleh
42 mkdir dir2
37 mkdir dir2
43 cd bleh
38 cd bleh
44 hg commit -d '0 0' -m commit-11 . 2>&1 | cleanpath
39 hg commit -d '0 0' -m commit-11 .
45 hg commit -d '0 0' -m commit-12 ../dir ../dir2 2>&1 | cleanpath
40 hg commit -d '0 0' -m commit-12 ../dir ../dir2
46 hg -v commit -d '0 0' -m commit-13 ../dir
41 hg -v commit -d '0 0' -m commit-13 ../dir
47 cd ..
42 cd ..
48
43
49 hg commit -d '0 0' -m commit-14 does-not-exist 2>&1 | cleanpath
44 hg commit -d '0 0' -m commit-14 does-not-exist
50 ln -s foo baz
45 ln -s foo baz
51 hg commit -d '0 0' -m commit-15 baz 2>&1 | cleanpath
46 hg commit -d '0 0' -m commit-15 baz
52 touch quux
47 touch quux
53 hg commit -d '0 0' -m commit-16 quux 2>&1 | cleanpath
48 hg commit -d '0 0' -m commit-16 quux
54 echo >> dir/file
49 echo >> dir/file
55 hg -v commit -d '0 0' -m commit-17 dir/file
50 hg -v commit -d '0 0' -m commit-17 dir/file
56 cd ..
51 cd ..
@@ -14,18 +14,18 b" abort: invalid date: 'foo bar'"
14 nothing changed
14 nothing changed
15 % commit added file that has been deleted
15 % commit added file that has been deleted
16 nothing changed
16 nothing changed
17 abort: file .../test/bar not found!
17 abort: file bar not found!
18 adding dir/file
18 adding dir/file
19 dir/file
19 dir/file
20 adding dir.file
20 adding dir.file
21 abort: no match under directory .../test/dir!
21 abort: no match under directory dir!
22 abort: no match under directory .../test/bleh!
22 abort: no match under directory .!
23 abort: no match under directory .../test/dir2!
23 abort: no match under directory ../dir2!
24 dir/file
24 dir/file
25 does-not-exist: No such file or directory
25 does-not-exist: No such file or directory
26 abort: file .../test/does-not-exist not found!
26 abort: file does-not-exist not found!
27 abort: file .../test/baz not tracked!
27 abort: file baz not tracked!
28 abort: file .../test/quux not tracked!
28 abort: file quux not tracked!
29 dir/file
29 dir/file
30 % partial subdir commit test
30 % partial subdir commit test
31 adding bar/bar
31 adding bar/bar
General Comments 0
You need to be logged in to leave comments. Login now