|
|
@@ -79,6 +79,7 @@ public class P4Label extends P4Base { |
|
|
|
|
|
|
|
protected String name; |
|
|
|
protected String desc; |
|
|
|
protected String lock; |
|
|
|
|
|
|
|
public void setName(String name) { |
|
|
|
this.name = name; |
|
|
@@ -87,7 +88,11 @@ public class P4Label extends P4Base { |
|
|
|
public void setDesc(String desc) { |
|
|
|
this.desc = desc; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setLock(String lock) { |
|
|
|
this.lock = lock; |
|
|
|
} |
|
|
|
|
|
|
|
public void execute() throws BuildException { |
|
|
|
log("P4Label exec:",Project.MSG_INFO); |
|
|
|
|
|
|
@@ -101,7 +106,10 @@ public class P4Label extends P4Base { |
|
|
|
desc = "AntLabel"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(lock != null && !lock.equalsIgnoreCase("locked")) { |
|
|
|
log("lock attribute invalid - ignoring",Project.MSG_WARN); |
|
|
|
} |
|
|
|
|
|
|
|
if(name == null || name.length() < 1) { |
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy.MM.dd-hh:mm"); |
|
|
|
Date now = new Date(); |
|
|
@@ -110,6 +118,7 @@ public class P4Label extends P4Base { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//We have to create a unlocked label first |
|
|
|
String newLabel = |
|
|
|
"Label: "+name+"\n"+ |
|
|
|
"Description: "+desc+"\n"+ |
|
|
@@ -134,6 +143,46 @@ public class P4Label extends P4Base { |
|
|
|
|
|
|
|
|
|
|
|
log("Created Label "+name+" ("+desc+")", Project.MSG_INFO); |
|
|
|
|
|
|
|
//Now lock if required |
|
|
|
if (lock != null && lock.equalsIgnoreCase("locked")) { |
|
|
|
|
|
|
|
log("Modifying lock status to 'locked'",Project.MSG_INFO); |
|
|
|
|
|
|
|
final StringBuffer labelSpec = new StringBuffer(); |
|
|
|
|
|
|
|
//Read back the label spec from perforce, |
|
|
|
//Replace Options |
|
|
|
//Submit back to Perforce |
|
|
|
|
|
|
|
handler = new P4HandlerAdapter() { |
|
|
|
public void process(String line) { |
|
|
|
log(line, Project.MSG_VERBOSE); |
|
|
|
|
|
|
|
if(util.match("/^Options:/",line)) { |
|
|
|
line = "Options: "+lock; |
|
|
|
} |
|
|
|
|
|
|
|
labelSpec.append(line+"\n"); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
execP4Command("label -o "+name, handler); |
|
|
|
log(labelSpec.toString(),Project.MSG_DEBUG); |
|
|
|
|
|
|
|
log("Now locking label...",Project.MSG_VERBOSE); |
|
|
|
handler = new P4HandlerAdapter() { |
|
|
|
public void process(String line) { |
|
|
|
log(line, Project.MSG_VERBOSE); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
handler.setOutput(labelSpec.toString()); |
|
|
|
execP4Command("label -i", handler); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|