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