Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 33098:eb4c49f55f1f
workingfilectx: add audit() as a wrapper for wvfs.audit()
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Sun, 25 Jun 2017 22:30:14 -0700 |
parents | 1e79c66d6b07 |
children | 9fc880dff5f3 |
comparison
equal
deleted
inserted
replaced
33097:1e79c66d6b07 | 33098:eb4c49f55f1f |
---|---|
1082 """apply removes to the working directory | 1082 """apply removes to the working directory |
1083 | 1083 |
1084 yields tuples for progress updates | 1084 yields tuples for progress updates |
1085 """ | 1085 """ |
1086 verbose = repo.ui.verbose | 1086 verbose = repo.ui.verbose |
1087 audit = repo.wvfs.audit | |
1088 try: | 1087 try: |
1089 cwd = pycompat.getcwd() | 1088 cwd = pycompat.getcwd() |
1090 except OSError as err: | 1089 except OSError as err: |
1091 if err.errno != errno.ENOENT: | 1090 if err.errno != errno.ENOENT: |
1092 raise | 1091 raise |
1094 i = 0 | 1093 i = 0 |
1095 for f, args, msg in actions: | 1094 for f, args, msg in actions: |
1096 repo.ui.debug(" %s: %s -> r\n" % (f, msg)) | 1095 repo.ui.debug(" %s: %s -> r\n" % (f, msg)) |
1097 if verbose: | 1096 if verbose: |
1098 repo.ui.note(_("removing %s\n") % f) | 1097 repo.ui.note(_("removing %s\n") % f) |
1099 audit(f) | 1098 wctx[f].audit() |
1100 try: | 1099 try: |
1101 wctx[f].remove(ignoremissing=True) | 1100 wctx[f].remove(ignoremissing=True) |
1102 except OSError as inst: | 1101 except OSError as inst: |
1103 repo.ui.warn(_("update failed to remove %s: %s!\n") % | 1102 repo.ui.warn(_("update failed to remove %s: %s!\n") % |
1104 (f, inst.strerror)) | 1103 (f, inst.strerror)) |
1199 fca = repo.filectx(f1, fileid=nullrev) | 1198 fca = repo.filectx(f1, fileid=nullrev) |
1200 ms.add(fcl, fco, fca, f) | 1199 ms.add(fcl, fco, fca, f) |
1201 if f1 != f and move: | 1200 if f1 != f and move: |
1202 moves.append(f1) | 1201 moves.append(f1) |
1203 | 1202 |
1204 audit = repo.wvfs.audit | |
1205 _updating = _('updating') | 1203 _updating = _('updating') |
1206 _files = _('files') | 1204 _files = _('files') |
1207 progress = repo.ui.progress | 1205 progress = repo.ui.progress |
1208 | 1206 |
1209 # remove renamed files after safely stored | 1207 # remove renamed files after safely stored |
1210 for f in moves: | 1208 for f in moves: |
1211 if os.path.lexists(repo.wjoin(f)): | 1209 if os.path.lexists(repo.wjoin(f)): |
1212 repo.ui.debug("removing %s\n" % f) | 1210 repo.ui.debug("removing %s\n" % f) |
1213 audit(f) | 1211 wctx[f].audit() |
1214 wctx[f].remove() | 1212 wctx[f].remove() |
1215 | 1213 |
1216 numupdates = sum(len(l) for m, l in actions.items() if m != 'k') | 1214 numupdates = sum(len(l) for m, l in actions.items() if m != 'k') |
1217 | 1215 |
1218 if [a for a in actions['r'] if a[0] == '.hgsubstate']: | 1216 if [a for a in actions['r'] if a[0] == '.hgsubstate']: |
1266 repo.ui.debug(" %s: %s -> dm\n" % (f, msg)) | 1264 repo.ui.debug(" %s: %s -> dm\n" % (f, msg)) |
1267 z += 1 | 1265 z += 1 |
1268 progress(_updating, z, item=f, total=numupdates, unit=_files) | 1266 progress(_updating, z, item=f, total=numupdates, unit=_files) |
1269 f0, flags = args | 1267 f0, flags = args |
1270 repo.ui.note(_("moving %s to %s\n") % (f0, f)) | 1268 repo.ui.note(_("moving %s to %s\n") % (f0, f)) |
1271 audit(f) | 1269 wctx[f].audit() |
1272 wctx[f].write(wctx.filectx(f0).data(), flags) | 1270 wctx[f].write(wctx.filectx(f0).data(), flags) |
1273 wctx[f0].remove() | 1271 wctx[f0].remove() |
1274 updated += 1 | 1272 updated += 1 |
1275 | 1273 |
1276 # local directory rename, get | 1274 # local directory rename, get |
1287 for f, args, msg in actions['e']: | 1285 for f, args, msg in actions['e']: |
1288 repo.ui.debug(" %s: %s -> e\n" % (f, msg)) | 1286 repo.ui.debug(" %s: %s -> e\n" % (f, msg)) |
1289 z += 1 | 1287 z += 1 |
1290 progress(_updating, z, item=f, total=numupdates, unit=_files) | 1288 progress(_updating, z, item=f, total=numupdates, unit=_files) |
1291 flags, = args | 1289 flags, = args |
1292 audit(f) | 1290 wctx[f].audit() |
1293 wctx[f].setflags('l' in flags, 'x' in flags) | 1291 wctx[f].setflags('l' in flags, 'x' in flags) |
1294 updated += 1 | 1292 updated += 1 |
1295 | 1293 |
1296 # the ordering is important here -- ms.mergedriver will raise if the merge | 1294 # the ordering is important here -- ms.mergedriver will raise if the merge |
1297 # driver has changed, and we want to be able to bypass it when overwrite is | 1295 # driver has changed, and we want to be able to bypass it when overwrite is |
1321 progress(_updating, z, item=f, total=numupdates, unit=_files) | 1319 progress(_updating, z, item=f, total=numupdates, unit=_files) |
1322 if f == '.hgsubstate': # subrepo states need updating | 1320 if f == '.hgsubstate': # subrepo states need updating |
1323 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), | 1321 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), |
1324 overwrite, labels) | 1322 overwrite, labels) |
1325 continue | 1323 continue |
1326 audit(f) | 1324 wctx[f].audit() |
1327 complete, r = ms.preresolve(f, wctx) | 1325 complete, r = ms.preresolve(f, wctx) |
1328 if not complete: | 1326 if not complete: |
1329 numupdates += 1 | 1327 numupdates += 1 |
1330 tocomplete.append((f, args, msg)) | 1328 tocomplete.append((f, args, msg)) |
1331 | 1329 |