diff --git a/bin/microannotate-view.py b/bin/microannotate-view.py index 11f3fe0..4887cec 100644 --- a/bin/microannotate-view.py +++ b/bin/microannotate-view.py @@ -10,7 +10,14 @@ from microannotate import viewer if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument("repository_dir", help="Path to the repository", action="store") + parser.add_argument( + "repository_dir", help="Path to the input repository", action="store" + ) + parser.add_argument( + "microannotated_repository_dir", + help="Path to the microannotated repository", + action="store", + ) parser.add_argument( "path", help="Path to the file in the repository", action="store" ) @@ -19,4 +26,8 @@ if __name__ == "__main__": ) args = parser.parse_args() - print(viewer.html(args.repository_dir, args.rev, args.path)) + print( + viewer.html( + args.repository_dir, args.microannotated_repository_dir, args.rev, args.path + ) + ) diff --git a/microannotate/viewer.py b/microannotate/viewer.py index ccab28a..45aef2a 100644 --- a/microannotate/viewer.py +++ b/microannotate/viewer.py @@ -14,21 +14,21 @@ import pygit2 from microannotate import annotatehelper, utils -def html(repository_dir, rev, path): - repository_dir = os.path.realpath(repository_dir) +def html(repository_dir, microannotated_repository_dir, rev, path): + microannotated_repository_dir = os.path.realpath(microannotated_repository_dir) - repo = pygit2.Repository(repository_dir) + repo = pygit2.Repository(microannotated_repository_dir) proc = subprocess.run( ["git", "blame", "--porcelain", rev, path], - cwd=repository_dir, + cwd=microannotated_repository_dir, check=True, capture_output=True, ) blame_output = proc.stdout.decode("utf-8") original_commit_hash = utils.get_original_hash(repo, rev) - os.chdir("/home/marco/Documenti/FD/mozilla-central") + os.chdir(repository_dir) hg = hglib.open(".") original_file_content = hg.cat( [path.encode("ascii")], rev=original_commit_hash.encode("ascii")