Show More
@@ -438,11 +438,14 b' class queue:' | |||
|
438 | 438 | def apply(self, repo, series, list=False, update_status=True, |
|
439 | 439 | strict=False, patchdir=None, merge=None, wlock=None, |
|
440 | 440 | all_files={}): |
|
441 | if not wlock: | |
|
442 | wlock = repo.wlock() | |
|
443 | lock = repo.lock() | |
|
441 | 444 | tr = repo.transaction() |
|
442 | 445 | try: |
|
443 | 446 | ret = self._apply(tr, repo, series, list, update_status, |
|
444 | 447 | strict, patchdir, merge, wlock, |
|
445 | all_files=all_files) | |
|
448 | lock=lock, all_files=all_files) | |
|
446 | 449 | tr.close() |
|
447 | 450 | self.save_dirty() |
|
448 | 451 | return ret |
@@ -456,14 +459,11 b' class queue:' | |||
|
456 | 459 | |
|
457 | 460 | def _apply(self, tr, repo, series, list=False, update_status=True, |
|
458 | 461 | strict=False, patchdir=None, merge=None, wlock=None, |
|
459 | all_files={}): | |
|
462 | lock=None, all_files={}): | |
|
460 | 463 | # TODO unify with commands.py |
|
461 | 464 | if not patchdir: |
|
462 | 465 | patchdir = self.path |
|
463 | 466 | err = 0 |
|
464 | if not wlock: | |
|
465 | wlock = repo.wlock() | |
|
466 | lock = repo.lock() | |
|
467 | 467 | n = None |
|
468 | 468 | for patchname in series: |
|
469 | 469 | pushable, reason = self.pushable(patchname) |
@@ -1057,9 +1057,11 b' class queue:' | |||
|
1057 | 1057 | aaa = aa[:] |
|
1058 | 1058 | if opts.get('short'): |
|
1059 | 1059 | filelist = mm + aa + dd |
|
1060 | match = dict.fromkeys(filelist).__contains__ | |
|
1060 | 1061 | else: |
|
1061 | 1062 | filelist = None |
|
1062 | m, a, r, d, u = repo.status(files=filelist)[:5] | |
|
1063 | match = util.always | |
|
1064 | m, a, r, d, u = repo.status(files=filelist, match=match)[:5] | |
|
1063 | 1065 | |
|
1064 | 1066 | # we might end up with files that were added between tip and |
|
1065 | 1067 | # the dirstate parent, but then changed in the local dirstate. |
@@ -574,9 +574,7 b' def addremove(repo, pats=[], opts={}, wl' | |||
|
574 | 574 | mapping[abs] = rel, exact |
|
575 | 575 | if repo.ui.verbose or not exact: |
|
576 | 576 | repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
|
577 | islink = os.path.islink(target) | |
|
578 | if (repo.dirstate.state(abs) != 'r' and not islink | |
|
579 | and not os.path.exists(target)): | |
|
577 | if repo.dirstate.state(abs) != 'r' and not util.lexists(target): | |
|
580 | 578 | remove.append(abs) |
|
581 | 579 | mapping[abs] = rel, exact |
|
582 | 580 | if repo.ui.verbose or not exact: |
@@ -404,8 +404,6 b' def commit(ui, repo, *pats, **opts):' | |||
|
404 | 404 | continue |
|
405 | 405 | if f not in files: |
|
406 | 406 | rf = repo.wjoin(f) |
|
407 | if f in unknown: | |
|
408 | raise util.Abort(_("file %s not tracked!") % rf) | |
|
409 | 407 | try: |
|
410 | 408 | mode = os.lstat(rf)[stat.ST_MODE] |
|
411 | 409 | except OSError: |
@@ -419,9 +417,11 b' def commit(ui, repo, *pats, **opts):' | |||
|
419 | 417 | if i >= len(slist) or not slist[i].startswith(name): |
|
420 | 418 | raise util.Abort(_("no match under directory %s!") |
|
421 | 419 | % rf) |
|
422 | elif not stat.S_ISREG(mode): | |
|
420 | elif not (stat.S_ISREG(mode) or stat.S_ISLNK(mode)): | |
|
423 | 421 | raise util.Abort(_("can't commit %s: " |
|
424 | 422 | "unsupported file type!") % rf) |
|
423 | elif repo.dirstate.state(f) == '?': | |
|
424 | raise util.Abort(_("file %s not tracked!") % rf) | |
|
425 | 425 | else: |
|
426 | 426 | files = [] |
|
427 | 427 | try: |
@@ -2099,7 +2099,7 b' def remove(ui, repo, *pats, **opts):' | |||
|
2099 | 2099 | forget.append(abs) |
|
2100 | 2100 | continue |
|
2101 | 2101 | reason = _('has been marked for add (use -f to force removal)') |
|
2102 | elif abs in unknown: | |
|
2102 | elif repo.dirstate.state(abs) == '?': | |
|
2103 | 2103 | reason = _('is not managed') |
|
2104 | 2104 | elif opts['after'] and not exact and abs not in deleted: |
|
2105 | 2105 | continue |
@@ -2261,8 +2261,7 b' def revert(ui, repo, *pats, **opts):' | |||
|
2261 | 2261 | def handle(xlist, dobackup): |
|
2262 | 2262 | xlist[0].append(abs) |
|
2263 | 2263 | update[abs] = 1 |
|
2264 |
if |
|
|
2265 | (os.path.islink(target) or os.path.exists(target))): | |
|
2264 | if dobackup and not opts['no_backup'] and util.lexists(target): | |
|
2266 | 2265 | bakname = "%s.orig" % rel |
|
2267 | 2266 | ui.note(_('saving current version of %s as %s\n') % |
|
2268 | 2267 | (rel, bakname)) |
@@ -951,6 +951,7 b' class localrepository(repo.repository):' | |||
|
951 | 951 | if fcmp(f, getnode): |
|
952 | 952 | modified.append(f) |
|
953 | 953 | else: |
|
954 | if list_clean: | |
|
954 | 955 | clean.append(f) |
|
955 | 956 | if not wlock and not mywlock: |
|
956 | 957 | mywlock = True |
@@ -1013,16 +1014,17 b' class localrepository(repo.repository):' | |||
|
1013 | 1014 | wlock = self.wlock() |
|
1014 | 1015 | for f in list: |
|
1015 | 1016 | p = self.wjoin(f) |
|
1016 | islink = os.path.islink(p) | |
|
1017 |
|
|
|
1018 | if size > 10000000: | |
|
1017 | try: | |
|
1018 | st = os.lstat(p) | |
|
1019 | except: | |
|
1020 | self.ui.warn(_("%s does not exist!\n") % f) | |
|
1021 | continue | |
|
1022 | if st.st_size > 10000000: | |
|
1019 | 1023 | self.ui.warn(_("%s: files over 10MB may cause memory and" |
|
1020 | 1024 | " performance problems\n" |
|
1021 | 1025 | "(use 'hg revert %s' to unadd the file)\n") |
|
1022 | 1026 | % (f, f)) |
|
1023 | if not islink and not os.path.exists(p): | |
|
1024 | self.ui.warn(_("%s does not exist!\n") % f) | |
|
1025 | elif not islink and not os.path.isfile(p): | |
|
1027 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): | |
|
1026 | 1028 | self.ui.warn(_("%s not added: only files and symlinks " |
|
1027 | 1029 | "supported currently\n") % f) |
|
1028 | 1030 | elif self.dirstate.state(f) in 'an': |
@@ -1,5 +1,10 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | cleanpath() | |
|
4 | { | |
|
5 | sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" | |
|
6 | } | |
|
7 | ||
|
3 | 8 | cat >> readlink.py <<EOF |
|
4 | 9 | import os |
|
5 | 10 | import sys |
@@ -11,6 +16,7 b' EOF' | |||
|
11 | 16 | hg init a |
|
12 | 17 | cd a |
|
13 | 18 | ln -s nothing dangling |
|
19 | hg commit -m 'commit symlink without adding' -d '0 0' dangling 2>&1 | cleanpath | |
|
14 | 20 | hg add dangling |
|
15 | 21 | hg commit -m 'add symlink' -d '0 0' |
|
16 | 22 |
General Comments 0
You need to be logged in to leave comments.
Login now