Allow callers to pass in the dirstate lock in most localrepo.py funcs.
This makes it possible to take the lock once and commit a large number of
patches, without having to read and write the dirstate for each patch.
%% Should show unknown
? unknown
%% Should show unknown and b removed
! b
? unknown
%% Should show a and unknown
a
unknown