View Javadoc

1   package com.aragost.javahg.internals;
2   
3   import com.aragost.javahg.Repository;
4   import com.aragost.javahg.commands.LogCommand;
5   
6   /**
7    * A generic log command where the client is responsible to consume
8    * the output from the command server.
9    */
10  public class GenericLogCommand extends LogCommand {
11  
12      public GenericLogCommand(Repository repository) {
13          super(repository, null);
14      }
15  
16      /**
17       * Specify style to use
18       * 
19       * @param style
20       * @return this instance
21       */
22      public GenericLogCommand style(String style) {
23          cmdAppend("--style", pathToStyle(style));
24          return this;
25      }
26  
27      /**
28       * Specify template to use
29       * 
30       * @param template
31       * @return this instance
32       */
33      public GenericLogCommand template(String template) {
34          cmdAppend("--template", template);
35          return this;
36      }
37  
38      private String pathToStyle(String style) {
39          return Utils.resourceAsFile("/styles/" + style + ".style").getAbsolutePath();
40      }
41  
42      public HgInputStream stream(String... args) {
43          return launchStream(args);
44      }
45  
46  }