Index: P4Label.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java,v
retrieving revision 1.2
diff -u -r1.2 P4Label.java
--- P4Label.java	2001/01/12 15:28:35	1.2
+++ P4Label.java	2001/05/14 08:39:29
@@ -79,6 +79,7 @@
 
     protected String name;
     protected String desc;
+    protected String lock;
     
     public void setName(String name) {
         this.name = name;
@@ -87,7 +88,11 @@
     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 @@
             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 @@
         }
         
         
+        //We have to create a unlocked label first
         String newLabel = 
             "Label: "+name+"\n"+
             "Description: "+desc+"\n"+
@@ -134,6 +143,46 @@
         
         
         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);
+        }
+        
         
     }
 
