diff cmdline/org/tmatesoft/hg/console/Annotate.java @ 569:c4fd1037bc6f

Support for copy/rename follow/no-follow for annotate
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 10 Apr 2013 20:04:54 +0200
parents 32453f30de07
children 1c49c0cee540
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Annotate.java	Wed Apr 10 15:45:53 2013 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Annotate.java	Wed Apr 10 20:04:54 2013 +0200
@@ -16,14 +16,15 @@
  */
 package org.tmatesoft.hg.console;
 
+import static java.util.Arrays.asList;
 import static org.tmatesoft.hg.repo.HgRepository.TIP;
 
-import java.util.Collections;
+import java.util.TreeSet;
 
 import org.tmatesoft.hg.core.HgAnnotateCommand;
 import org.tmatesoft.hg.core.HgAnnotateCommand.LineInfo;
 import org.tmatesoft.hg.core.HgRepoFacade;
-import org.tmatesoft.hg.repo.HgDataFile;
+import org.tmatesoft.hg.util.Path;
 
 /**
  * 
@@ -33,7 +34,8 @@
 public class Annotate {
 
 	public static void main(String[] args) throws Exception {
-		Options cmdLineOpts = Options.parse(args, Collections.<String>emptySet());
+		String[] boolOpts = new String[] {"-l", "--line-number" };
+		Options cmdLineOpts = Options.parse(args, new TreeSet<String>(asList(boolOpts)));
 		HgRepoFacade repo = new HgRepoFacade();
 		if (!repo.init(cmdLineOpts.findRepository())) {
 			System.err.printf("Can't find repository in: %s\n", repo.getRepository().getLocation());
@@ -44,8 +46,7 @@
 		AnnotateDumpInspector insp = new AnnotateDumpInspector(cmdLineOpts.getBoolean(false, "-l", "--line-number"));
 		cmd.changeset(rev);
 		for (String fname : cmdLineOpts.getList("")) {
-			HgDataFile fn = repo.getRepository().getFileNode(fname);
-			cmd.file(fn);
+			cmd.file(Path.create(fname));
 			cmd.execute(insp);
 		}
 	}
@@ -59,9 +60,9 @@
 
 		public void next(LineInfo lineInfo) {
 			if (lineNumbers) {
-				System.out.printf("%3d:%3d:%s", lineInfo.getChangesetIndex(), lineInfo.getLineNumber(), new String(lineInfo.getContent()));
+				System.out.printf("%3d:%3d: %s", lineInfo.getChangesetIndex(), lineInfo.getLineNumber(), new String(lineInfo.getContent()));
 			} else {
-				System.out.printf("%3d:%s", lineInfo.getChangesetIndex(), new String(lineInfo.getContent()));
+				System.out.printf("%3d: %s", lineInfo.getChangesetIndex(), new String(lineInfo.getContent()));
 			}
 		}
 	}