Commit f1aeb015 authored by Jelmer Vernooij's avatar Jelmer Vernooij

Add a (inefficient) --dry-run option. Closes: #915977

parent e0a960a7
lintian-brush (0.10) UNRELEASED; urgency=medium
* Add a (inefficient) --dry-run option. Closes: #915977
-- Jelmer Vernooij <jelmer@debian.org> Sat, 15 Dec 2018 17:18:50 +0000
lintian-brush (0.9) unstable; urgency=medium
* Add CI configuration for Salsa.
......
......@@ -16,7 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import argparse
import atexit
import shutil
import sys
import tempfile
from breezy.branch import Branch
from breezy.workingtree import WorkingTree
import locale
locale.setlocale(locale.LC_ALL, '')
......@@ -68,6 +73,11 @@ def main(argv=None):
type=str, default='.')
parser.add_argument(
'--diff', help='Print resulting diff afterwards.', action='store_true')
parser.add_argument(
'--dry-run', help=(
'Do not make any changes to the current repository. '
'Note: currently creates a temporary clone of the repository.'),
action='store_true')
parser.add_argument(
'fixers', metavar='FIXER', nargs='*',
help='specific fixer to run')
......@@ -89,7 +99,18 @@ def main(argv=None):
note(tag)
else:
try:
wt = WorkingTree.open(args.directory)
if args.dry_run:
branch = Branch.open(args.directory)
td = tempfile.mkdtemp()
atexit.register(shutil.rmtree, td)
# TODO(jelmer): Make a slimmer copy
to_dir = branch.controldir.sprout(
td, None, create_tree_if_local=True,
source_branch=branch,
stacked=branch._format.supports_stacking())
wt = to_dir.open_workingtree()
else:
wt = WorkingTree.open(args.directory)
except NotBranchError:
note('No version control directory found (e.g. a .git directory).')
return 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment