aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/storage/vcs
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-27 12:47:37 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-27 12:47:37 -0500
commit9ad4b1cadfd0adf3fd359c274856a196019e913c (patch)
tree9b663970761e50838db3cfc4f6b293e2e2ec70ff /libbe/storage/vcs
parentda686174480de4cb3b881e3d42bbc8d68e9dfb43 (diff)
downloadbugseverywhere-9ad4b1cadfd0adf3fd359c274856a196019e913c.tar.gz
Implement Arch._vcs_changed().
Fixes VersionedStorage_changed_TestCase.test_changed failure.
Diffstat (limited to 'libbe/storage/vcs')
-rw-r--r--libbe/storage/vcs/arch.py48
1 files changed, 46 insertions, 2 deletions
diff --git a/libbe/storage/vcs/arch.py b/libbe/storage/vcs/arch.py
index bfccf59..2b305ea 100644
--- a/libbe/storage/vcs/arch.py
+++ b/libbe/storage/vcs/arch.py
@@ -357,9 +357,53 @@ class Arch(base.VCS):
return None
return '%s--%s' % (self._archive_project_name(), log)
+ def _diff(self, revision):
+ status,output,error = self._u_invoke_client(
+ 'diff', '--summary', revision, expect=(0,1))
+ return output
+
+ def _parse_diff(self, diff_text):
+ """
+ Example diff text:
+
+ * local directory is at ...
+ * build pristine tree for ...
+ * from import revision: ...
+ * patching for revision: ...
+ * comparing to ...
+ D .be/dir/bugs/.arch-ids/moved.id
+ D .be/dir/bugs/.arch-ids/removed.id
+ D .be/dir/bugs/moved
+ D .be/dir/bugs/removed
+ A .be/dir/bugs/.arch-ids/moved2.id
+ A .be/dir/bugs/.arch-ids/new.id
+ A .be/dir/bugs/moved2
+ A .be/dir/bugs/new
+ A {arch}/bugs-everywhere/bugs-everywhere--mainline/...
+ M .be/dir/bugs/modified
+ """
+ new = []
+ modified = []
+ removed = []
+ lines = diff_text.splitlines()
+ for i,line in enumerate(lines):
+ if line.startswith('* ') or '/.arch-ids/' in line:
+ continue
+ change,file = line.split(' ',1)
+ print '"%s" "%s"' % (change, file)
+ if file.startswith('{arch}/'):
+ continue
+ if change == 'A':
+ new.append(file)
+ elif change == 'M':
+ modified.append(file)
+ elif change == 'D':
+ removed.append(file)
+ print new, modified, removed
+ return (new,modified,removed)
+
def _vcs_changed(self, revision):
- raise NotImplementedError(
- 'Too little Arch understanding at the moment...')
+ return self._parse_diff(self._diff(revision))
if libbe.TESTING == True: