This is an archive of the discontinued Mercurial Phabricator instance.

blackbox: do not prevent 'chg init' from working
ClosedPublic

Authored by quark on Sep 21 2017, 2:13 PM.

Details

Summary

Previously, blackbox always appends to blackbox.log and creates the
directory for that file on demand. That could be an issue if:

  1. chg starts from $REPO directory, so ui._bbrepo is set.
  2. rm -rf $REPO.
  3. chg init $REPO, blackbox writes something and init will fail because $REPO directory is non-empty.

This patch fixes that by verifying whether vfs exists before re-using it.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Sep 21 2017, 2:13 PM
akushner added inline comments.
tests/test-blackbox.t
299

Is 'repo2' needed here?

quark added inline comments.Sep 21 2017, 4:50 PM
tests/test-blackbox.t
299

Nope. Good catch. I was using hg clone in test and then simplified it to init.

quark marked an inline comment as done.Sep 21 2017, 4:52 PM
quark updated this revision to Diff 1974.
akushner accepted this revision.Sep 21 2017, 5:15 PM
quark updated this revision to Diff 1975.Sep 21 2017, 5:49 PM
This revision was automatically updated to reflect the committed changes.