Show More
@@ -8,7 +8,7 b'' | |||
|
8 | 8 | from demandload import demandload |
|
9 | 9 | from node import * |
|
10 | 10 | from i18n import gettext as _ |
|
11 | demandload(globals(), "os re sys signal imp urllib pdb shlex") | |
|
11 | demandload(globals(), "bisect os re sys signal imp urllib pdb shlex stat") | |
|
12 | 12 | demandload(globals(), "fancyopts ui hg util lock revlog bundlerepo") |
|
13 | 13 | demandload(globals(), "difflib patch time") |
|
14 | 14 | demandload(globals(), "traceback errno version atexit") |
@@ -423,12 +423,28 b' def commit(ui, repo, *pats, **opts):' | |||
|
423 | 423 | status = repo.status(files=fns, match=match) |
|
424 | 424 | modified, added, removed, deleted, unknown = status[:5] |
|
425 | 425 | files = modified + added + removed |
|
426 | slist = None | |
|
426 | 427 | for f in fns: |
|
427 |
if f not in |
|
|
428 | if f not in files: | |
|
429 | rf = repo.wjoin(f) | |
|
428 | 430 | if f in unknown: |
|
429 | raise util.Abort(_("file %s not tracked!") % f) | |
|
430 |
|
|
|
431 | raise util.Abort(_("file %s not found!") % f) | |
|
431 | raise util.Abort(_("file %s not tracked!") % rf) | |
|
432 | try: | |
|
433 | mode = os.lstat(rf)[stat.ST_MODE] | |
|
434 | except OSError: | |
|
435 | raise util.Abort(_("file %s not found!") % rf) | |
|
436 | if stat.S_ISDIR(mode): | |
|
437 | name = f + '/' | |
|
438 | if slist is None: | |
|
439 | slist = list(files) | |
|
440 | slist.sort() | |
|
441 | i = bisect.bisect(slist, name) | |
|
442 | if i >= len(slist) or not slist[i].startswith(name): | |
|
443 | raise util.Abort(_("no match under directory %s!") | |
|
444 | % rf) | |
|
445 | elif not stat.S_ISREG(mode): | |
|
446 | raise util.Abort(_("can't commit %s: " | |
|
447 | "unsupported file type!") % rf) | |
|
432 | 448 | else: |
|
433 | 449 | files = [] |
|
434 | 450 | try: |
@@ -1,5 +1,10 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | cleanpath() | |
|
4 | { | |
|
5 | sed -e "s:/.*\(/test/.*\):...\1:" | |
|
6 | } | |
|
7 | ||
|
3 | 8 | echo % commit date test |
|
4 | 9 | hg init test |
|
5 | 10 | cd test |
@@ -17,7 +22,35 b' echo % partial commit test' | |||
|
17 | 22 | echo bar > bar |
|
18 | 23 | hg add bar |
|
19 | 24 | rm bar |
|
20 |
hg commit -d "1000000 0" -m commit-8 2>&1 | |
|
|
25 | hg commit -d "1000000 0" -m commit-8 2>&1 | cleanpath | |
|
26 | ||
|
27 | hg -q revert -a --no-backup | |
|
28 | ||
|
29 | mkdir dir | |
|
30 | echo boo > dir/file | |
|
31 | hg add | |
|
32 | hg -v commit -d '0 0' -m commit-9 dir | |
|
33 | ||
|
34 | echo > dir.file | |
|
35 | hg add | |
|
36 | hg commit -d '0 0' -m commit-10 dir dir.file 2>&1 | cleanpath | |
|
37 | ||
|
38 | echo >> dir/file | |
|
39 | mkdir bleh | |
|
40 | mkdir dir2 | |
|
41 | cd bleh | |
|
42 | hg commit -d '0 0' -m commit-11 . 2>&1 | cleanpath | |
|
43 | hg commit -d '0 0' -m commit-12 ../dir ../dir2 2>&1 | cleanpath | |
|
44 | hg -v commit -d '0 0' -m commit-13 ../dir | |
|
45 | cd .. | |
|
46 | ||
|
47 | hg commit -d '0 0' -m commit-14 does-not-exist 2>&1 | cleanpath | |
|
48 | ln -s foo baz | |
|
49 | hg commit -d '0 0' -m commit-15 baz 2>&1 | cleanpath | |
|
50 | touch quux | |
|
51 | hg commit -d '0 0' -m commit-16 quux 2>&1 | cleanpath | |
|
52 | echo >> dir/file | |
|
53 | hg -v commit -d '0 0' -m commit-17 dir/file | |
|
21 | 54 | cd .. |
|
22 | 55 | |
|
23 | 56 | echo % partial subdir commit test |
@@ -17,6 +17,19 b' rollback completed' | |||
|
17 | 17 | % partial commit test |
|
18 | 18 | trouble committing bar! |
|
19 | 19 | abort: No such file or directory: .../test/bar |
|
20 | adding dir/file | |
|
21 | dir/file | |
|
22 | adding dir.file | |
|
23 | abort: no match under directory .../test/dir! | |
|
24 | abort: no match under directory .../test/bleh! | |
|
25 | abort: no match under directory .../test/dir2! | |
|
26 | dir/file | |
|
27 | does-not-exist: No such file or directory | |
|
28 | abort: file .../test/does-not-exist not found! | |
|
29 | baz: unsupported file type (type is symbolic link) | |
|
30 | abort: can't commit .../test/baz: unsupported file type! | |
|
31 | abort: file .../test/quux not tracked! | |
|
32 | dir/file | |
|
20 | 33 | % partial subdir commit test |
|
21 | 34 | adding bar/bar |
|
22 | 35 | adding foo/foo |
General Comments 0
You need to be logged in to leave comments.
Login now