Coverage Report - com.aragost.javahg.merge.MergeConflict
 
Classes in this File Line Coverage Branch Coverage Complexity
MergeConflict
100%
11/11
100%
2/2
1
 
 1  
 package com.aragost.javahg.merge;
 2  
 
 3  
 import com.aragost.javahg.commands.ResolveCommand;
 4  
 
 5  
 public class MergeConflict extends MergeFile {
 6  
 
 7  7
     private boolean resolved = false;
 8  
 
 9  
     public MergeConflict(ConflictResolvingContext mergeState, String file) {
 10  7
         super(mergeState, file);
 11  7
     }
 12  
 
 13  
     public boolean isResolved() {
 14  4
         return resolved;
 15  
     }
 16  
 
 17  
     /**
 18  
      * Attempt to resolve conflict with Mercurial's internal merge
 19  
      * tool
 20  
      * 
 21  
      * @return true if the conflict was resolved, false otherwise
 22  
      */
 23  
     public boolean resolveWithInternalMerge() {
 24  2
         return resolveWith("internal:merge");
 25  
     }
 26  
 
 27  
     /**
 28  
      * Attempt to resolve conflict with the specified tool.
 29  
      * 
 30  
      * @return true if the conflict was resolved, false otherwise
 31  
      */
 32  
     public boolean resolveWith(String tool) {
 33  2
         ResolveCommand cmd = ResolveCommand.on(getRepository()).tool(tool);
 34  2
         cmd.execute(getFilename());
 35  2
         this.resolved = cmd.getReturnCode() == 0;
 36  2
         return this.resolved;
 37  
     }
 38  
 
 39  
     /**
 40  
      * Mark this merge conflict as resolved
 41  
      */
 42  
     public void markResolved() {
 43  1
         ResolveCommand.on(getRepository()).mark(getFilename());
 44  1
     }
 45  
 
 46  
 }