Show More
@@ -1038,6 +1038,12 b' def batchremove(repo, actions):' | |||
|
1038 | 1038 | unlink = util.unlinkpath |
|
1039 | 1039 | wjoin = repo.wjoin |
|
1040 | 1040 | audit = repo.wvfs.audit |
|
1041 | try: | |
|
1042 | cwd = os.getcwd() | |
|
1043 | except OSError as err: | |
|
1044 | if err.errno != errno.ENOENT: | |
|
1045 | raise | |
|
1046 | cwd = None | |
|
1041 | 1047 | i = 0 |
|
1042 | 1048 | for f, args, msg in actions: |
|
1043 | 1049 | repo.ui.debug(" %s: %s -> r\n" % (f, msg)) |
@@ -1055,6 +1061,18 b' def batchremove(repo, actions):' | |||
|
1055 | 1061 | i += 1 |
|
1056 | 1062 | if i > 0: |
|
1057 | 1063 | yield i, f |
|
1064 | if cwd: | |
|
1065 | # cwd was present before we started to remove files | |
|
1066 | # let's check if it is present after we removed them | |
|
1067 | try: | |
|
1068 | os.getcwd() | |
|
1069 | except OSError as err: | |
|
1070 | if err.errno != errno.ENOENT: | |
|
1071 | raise | |
|
1072 | # Print a warning if cwd was deleted | |
|
1073 | repo.ui.warn(_("current directory was removed\n" | |
|
1074 | "(consider changing to repo root: %s)\n") % | |
|
1075 | repo.root) | |
|
1058 | 1076 | |
|
1059 | 1077 | def batchget(repo, mctx, actions): |
|
1060 | 1078 | """apply gets to the working directory |
@@ -758,6 +758,8 b' Test that rebase is not confused by $CWD' | |||
|
758 | 758 | $ hg commit -m 'second source with subdir' |
|
759 | 759 | $ hg rebase -b . -d 1 --traceback |
|
760 | 760 | rebasing 2:779a07b1b7a0 "first source commit" |
|
761 | current directory was removed | |
|
762 | (consider changing to repo root: $TESTTMP/cwd-vanish) | |
|
761 | 763 | rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip) |
|
762 | 764 | saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob) |
|
763 | 765 |
@@ -72,3 +72,15 b' Test update when two commits have symlin' | |||
|
72 | 72 | $ cd .. |
|
73 | 73 | |
|
74 | 74 | #endif |
|
75 | ||
|
76 | Test that warning is printed if cwd is deleted during update | |
|
77 | $ hg init r4 && cd r4 | |
|
78 | $ mkdir dir | |
|
79 | $ cd dir | |
|
80 | $ echo a > a | |
|
81 | $ echo b > b | |
|
82 | $ hg add a b | |
|
83 | $ hg ci -m "file and dir" | |
|
84 | $ hg up -q null | |
|
85 | current directory was removed | |
|
86 | (consider changing to repo root: $TESTTMP/r1/r4) |
General Comments 0
You need to be logged in to leave comments.
Login now