Commits

Christoph Mewes  committed 9871ac0

finished `hg remove`

  • Participants
  • Parent commits 83bbd58

Comments (0)

Files changed (2)

File libhg/Command/Remove/Cmd.php

 	 * @return libhg_Command_Remove_Result
 	 */
 	public function evaluate(libhg_Stream_Readable $reader, libhg_Stream_Writable $writer, libhg_Repository_Interface $repo) {
-		$output = trim($reader->readString(libhg_Stream::CHANNEL_OUTPUT));
-		$code   = $reader->readReturnValue();
+		$files = trim($reader->readString(libhg_Stream::CHANNEL_OUTPUT));
+		$files = empty($files) ? array() : explode("\n", $files);
+		$code  = $reader->readReturnValue();
 
-		return new libhg_Command_Remove_Result($output, $code);
+		// cut off the 'removing ' prefix
+		foreach ($files as $idx => $file) {
+			if (substr($file, 0, 9) === 'removing ') {
+				$files[$idx] = substr($file, 9);
+			}
+		}
+
+		return new libhg_Command_Remove_Result($files, $code);
 	}
 }

File libhg/Command/Remove/Result.php

  */
 
 /**
- * Generated result class for `hg remove`
+ * Result class for `hg remove`
  *
- * @generated
  * @see     http://selenic.com/hg/help/remove
  * @package libhg.Command.Remove
  */
-class libhg_Command_Remove_Result {
+class libhg_Command_Remove_Result extends libhg_Command_BaseResult {
 	/**
-	 * command output
+	 * removed files
 	 *
-	 * @var string
+	 * @var array
 	 */
-	public $output;
-
-	/**
-	 * command return code
-	 *
-	 * @var int
-	 */
-	public $code;
+	public $files;
 
 	/**
 	 * Constructor
 	 *
-	 * @param string $output  command's output
-	 * @param int    $code    command's return code
+	 * @param array $files  list of removed files
+	 * @param int   $code   command's return code
 	 */
-	public function __construct($output, $code) {
-		$this->output = $output;
-		$this->code   = $code;
+	public function __construct(array $files, $code) {
+		parent::__construct($code);
+		$this->files = $files;
 	}
 }