1 11 package org.eclipse.team.internal.ccvs.core.client; 12 13 import java.util.Date ; 14 15 import org.eclipse.team.internal.ccvs.core.CVSTag; 16 17 20 public class RLog extends RemoteCommand { 21 22 23 public static final LocalOption NO_TAGS = new LocalOption("-N"); public static final LocalOption ONLY_INCLUDE_CHANGES = new LocalOption("-S"); public static final LocalOption REVISIONS_ON_DEFAULT_BRANCH = new LocalOption("-b"); public static final LocalOption LOCAL_DIRECTORY_ONLY = new LocalOption("-l"); 39 public static LocalOption makeTagOption(CVSTag tag1, CVSTag tag2) { 40 int type1 = tag1.getType(); 41 int type2 = tag2.getType(); 42 43 if(type1 == type2) { 44 switch (type1) { 45 case CVSTag.HEAD: 46 case CVSTag.BRANCH: 47 case CVSTag.VERSION: 49 return new LocalOption("-r" + tag1.getName() + ":" + tag2.getName(), null); case CVSTag.DATE: 52 Date date1 = tag1.asDate(); 54 Date date2 = tag2.asDate(); 55 String operator = "<"; if(date1.compareTo(date2) > 0) { 57 operator = ">"; } 59 return new LocalOption("-d", tag1.getName() + operator + tag2.getName()); default: 61 throw new IllegalArgumentException (); 63 } 64 } 65 66 if((type1 == CVSTag.BRANCH || type1 == CVSTag.HEAD) && type2 == CVSTag.DATE) { 67 return new LocalOption("-d", ">" + tag2.getName()); } 69 70 if((type1 == CVSTag.BRANCH || type1 == CVSTag.HEAD) && type2 == CVSTag.VERSION) { 71 return new LocalOption("-r" + tag2.getName() + ":", null); } 73 74 switch (type1) { 76 case CVSTag.HEAD: 77 case CVSTag.BRANCH: 78 case CVSTag.VERSION: 80 return new LocalOption("-r" + tag1.getName(), null); case CVSTag.DATE: 83 return new LocalOption("-d", tag1.getName()); default: 86 throw new IllegalArgumentException (); 88 } 89 } 90 91 98 public static LocalOption getCurrentTag(CVSTag tag1) { 99 100 int type = tag1.getType(); 101 102 switch (type){ 103 case CVSTag.HEAD: 104 return new LocalOption("-r"); 106 case CVSTag.BRANCH: 107 return new LocalOption("-r" + tag1.getName() + "."); 109 case CVSTag.VERSION: 110 return new LocalOption("-r" + tag1.getName()); 112 case CVSTag.DATE: 113 return new LocalOption("-d", tag1.asDate().toString()); default: 115 throw new IllegalArgumentException (); 117 } 118 119 } 120 121 124 protected String getRequestId() { 125 return "rlog"; } 127 } 128 | Popular Tags |