Show More
@@ -1084,18 +1084,21 b' def calculateupdates(repo, wctx, mctx, a' | |||||
1084 |
|
1084 | |||
1085 | return prunedactions, diverge, renamedelete |
|
1085 | return prunedactions, diverge, renamedelete | |
1086 |
|
1086 | |||
|
1087 | def _getcwd(): | |||
|
1088 | try: | |||
|
1089 | return pycompat.getcwd() | |||
|
1090 | except OSError as err: | |||
|
1091 | if err.errno == errno.ENOENT: | |||
|
1092 | return None | |||
|
1093 | raise | |||
|
1094 | ||||
1087 | def batchremove(repo, wctx, actions): |
|
1095 | def batchremove(repo, wctx, actions): | |
1088 | """apply removes to the working directory |
|
1096 | """apply removes to the working directory | |
1089 |
|
1097 | |||
1090 | yields tuples for progress updates |
|
1098 | yields tuples for progress updates | |
1091 | """ |
|
1099 | """ | |
1092 | verbose = repo.ui.verbose |
|
1100 | verbose = repo.ui.verbose | |
1093 | try: |
|
1101 | cwd = _getcwd() | |
1094 | cwd = pycompat.getcwd() |
|
|||
1095 | except OSError as err: |
|
|||
1096 | if err.errno != errno.ENOENT: |
|
|||
1097 | raise |
|
|||
1098 | cwd = None |
|
|||
1099 | i = 0 |
|
1102 | i = 0 | |
1100 | for f, args, msg in actions: |
|
1103 | for f, args, msg in actions: | |
1101 | repo.ui.debug(" %s: %s -> r\n" % (f, msg)) |
|
1104 | repo.ui.debug(" %s: %s -> r\n" % (f, msg)) | |
@@ -1113,18 +1116,12 b' def batchremove(repo, wctx, actions):' | |||||
1113 | i += 1 |
|
1116 | i += 1 | |
1114 | if i > 0: |
|
1117 | if i > 0: | |
1115 | yield i, f |
|
1118 | yield i, f | |
1116 | if cwd: |
|
1119 | ||
1117 | # cwd was present before we started to remove files |
|
1120 | if cwd and not _getcwd(): | |
1118 | # let's check if it is present after we removed them |
|
1121 | # cwd was removed in the course of removing files; print a helpful | |
1119 |
|
|
1122 | # warning. | |
1120 | pycompat.getcwd() |
|
1123 | repo.ui.warn(_("current directory was removed\n" | |
1121 | except OSError as err: |
|
1124 | "(consider changing to repo root: %s)\n") % repo.root) | |
1122 | if err.errno != errno.ENOENT: |
|
|||
1123 | raise |
|
|||
1124 | # Print a warning if cwd was deleted |
|
|||
1125 | repo.ui.warn(_("current directory was removed\n" |
|
|||
1126 | "(consider changing to repo root: %s)\n") % |
|
|||
1127 | repo.root) |
|
|||
1128 |
|
1125 | |||
1129 | # It's necessary to flush here in case we're inside a worker fork and will |
|
1126 | # It's necessary to flush here in case we're inside a worker fork and will | |
1130 | # quit after this function. |
|
1127 | # quit after this function. |
General Comments 0
You need to be logged in to leave comments.
Login now