cancellation.checkCancelled();
progress.start(2 + toAdd.size() + toRemove.size());
Internals implRepo = Internals.getInstance(repo);
final DirstateBuilder dirstateBuilder = new DirstateBuilder(implRepo);
dirstateBuilder.fillFrom(new DirstateReader(implRepo, new Path.SimpleSource()));
progress.worked(1);
cancellation.checkCancelled();
for (Path p : toAdd) {
dirstateBuilder.recordAdded(p, Flags.RegularFile, -1);
progress.worked(1);
cancellation.checkCancelled();