<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// stable 15095:ec222a29bdf0 (inactive)
//
// See the unit tests for more examples.
- $regexp = '/^([^ ]+)\s+(\d+):([a-f0-9]+)(\s|$)/';
+ $regexp = '/^(\S+(?:\s+\S+)*)\s+(\d+):([a-f0-9]+)(\s+\\(inactive\\))?$/';
if (!preg_match($regexp, $line, $matches)) {
throw new Exception("Failed to parse 'hg branches' output: {$line}");
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
array('a21ccf4412d5', 'ec222a29bdf0'),
array_values(ipull($output, 'rev')));
break;
+ case 'branches-with-spaces.txt':
+ $output = ArcanistMercurialParser::parseMercurialBranches($data);
+ $this->assertEqual(
+ array(
+ 'm m m m m 2:ffffffffffff (inactive)',
+ 'xxx yyy zzz',
+ 'default',
+ "'",
+ ),
+ array_keys($output));
+ $this->assertEqual(
+ array('0b9d8290c4e0', '78963faacfc7', '5db03c5500c6', 'ffffffffffff'),
+ array_values(ipull($output, 'rev')));
+ break;
case 'log-basic.txt':
$output = ArcanistMercurialParser::parseMercurialLog($data);
$this->assertEqual(
--- /dev/null
+m m m m m 2:ffffffffffff (inactive) 8:0b9d8290c4e0
+xxx yyy zzz 7:78963faacfc7 (inactive)
+default 6:5db03c5500c6 (inactive)
+' 9:ffffffffffff (inactive)
\ No newline at end of file