Changeset 457
- Timestamp:
- 29-12-09 21:21:52 (3 years ago)
- bzr:base-revision:
- svn-v4:375192ae-a00c-0410-900a-bafd95fcb19a:trunk:456
- bzr:committer:
- Jelmer Vernooij <jelmer@samba.org>
- bzr:file-ids:
moap/test/test_vcs_bzr.py 258@375192ae-a00c-0410-900a-bafd95fcb19a:trunk%2Fmoap%2Ftest%2Ftest_vcs_bzr.py
moap/vcs/bzr.py 256@375192ae-a00c-0410-900a-bafd95fcb19a:trunk%2Fmoap%2Fvcs%2Fbzr.py- bzr:mapping-version:
- v4
- bzr:repository-uuid:
- 375192ae-a00c-0410-900a-bafd95fcb19a
- bzr:revision-id:
- jelmer@samba.org-20091229163546-ybnssv2k37df4bgj
- bzr:revno:
- 441
- bzr:revprop:branch-nick:
- trunk
- bzr:revprop:bugs:
- http://thomas.apestaart.org/moap/trac/ticket/296 fixed
- bzr:root:
- trunk
- bzr:text-parents:
moap/test/test_vcs_bzr.py svn-v4:375192ae-a00c-0410-900a-bafd95fcb19a:trunk:402
moap/vcs/bzr.py svn-v4:375192ae-a00c-0410-900a-bafd95fcb19a:trunk:419- bzr:timestamp:
- 2009-12-29 17:35:46.413000107 +0100
- bzr:user-agent:
- bzr2.0.3+bzr-svn1.0.2dev0
- svn:original-date:
- 2009-12-29T16:35:46.413000Z
- Location:
- trunk/moap
- Files:
-
- 2 edited
-
test/test_vcs_bzr.py (modified) (1 diff)
-
vcs/bzr.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/moap/test/test_vcs_bzr.py
r402 r457 90 90 v.ignore(['test', ]) 91 91 92 self.assertEquals(v.getIgnored(v.path), ["test"]) 92 93 self.assertEquals(v.getUnknown(v.path), []) 93 94 -
trunk/moap/vcs/bzr.py
r419 r457 6 6 """ 7 7 8 import os 9 import commands 8 from cStringIO import StringIO 10 9 import re 11 10 … … 19 18 @return: True if the given path looks like a Bazaar tree. 20 19 """ 21 while path and path != '/':22 if (os.path.exists(os.path.join(path, '.bzr'))23 and os.path.exists(os.path.join(path, '.bzr', 'checkout'))):24 return True25 path = os.path.dirname(path)26 return False20 from bzrlib.bzrdir import BzrDir 21 from bzrlib.errors import NotBranchError 22 try: 23 return BzrDir.open(path).has_workingtree() 24 except NotBranchError: 25 return False 27 26 28 27 … … 31 30 32 31 def getUnknown(self, path): 33 oldPath = os.getcwd()34 os.chdir(path)32 wt, _ = self._get_workingtree() 33 return list(wt.unknowns()) 35 34 36 result = commands.getoutput("bzr unknowns").split('\n')37 # one empty line does not a return value make38 if result and result == ['']:39 result = []40 41 os.chdir(oldPath)42 return result35 def getIgnored(self, path): 36 wt, _ = self._get_workingtree() 37 wt.lock_read() 38 try: 39 return [path for path, pattern in wt.ignored_files()] 40 finally: 41 wt.unlock() 43 42 44 43 def ignore(self, paths, commit=True): … … 46 45 return 47 46 48 oldPath = os.getcwd()49 os.chdir(self.path)50 51 47 self.debug("Ignoring %d paths" % len(paths)) 52 48 53 cmd = "bzr ignore %s" % " ".join(paths) 54 self.debug("Running %s" % cmd) 55 os.system(cmd) 49 wt, _ = self._get_workingtree() 56 50 57 if commit: 58 self.commit([os.path.join(self.path, '.bzrignore'), ], 59 'moap ignore') 51 from bzrlib.ignores import tree_ignores_add_patterns 60 52 61 os.chdir(oldPath) 53 tree_ignores_add_patterns(wt, paths) 54 55 wt.commit(message="moap ignore", specific_files=['.bzrignore']) 56 57 def _get_workingtree(self): 58 from bzrlib.workingtree import WorkingTree 59 return WorkingTree.open_containing(self.path) 62 60 63 61 def commit(self, paths, message): 64 try: 65 oldPath = os.getcwd() 66 os.chdir(self.path) 67 temp = util.writeTemp([message, ]) 68 os.system("bzr commit --file %s %s" % (temp, " ".join(paths))) 69 os.unlink(temp) 70 finally: 71 os.chdir(oldPath) 62 wt, _ = self._get_workingtree() 63 wt.commit(message=message, specific_files=paths) 72 64 73 65 def diff(self, path, revision1=None, revision2=None): 74 output = commands.getoutput("bzr diff %s" % path) 75 76 return output 66 from bzrlib.diff import show_diff_trees 67 wt, _ = self._get_workingtree() 68 outf = StringIO() 69 show_diff_trees(wt.basis_tree(), wt, outf, [wt.relpath(path)], 70 old_label="", new_label="") 71 outf.seek(0) 72 return outf.read() 77 73 78 74 def getFileMatcher(self): … … 80 76 81 77 def update(self, path, revision=None): 82 # FIXME: No way to pull just updates to the given path 83 status, output = commands.getstatusoutput("bzr pull") 84 if status != 0: 85 raise vcs.VCSException(output) 86 87 return output 78 wt, _ = self._get_workingtree() 79 wt.pull() 80 return "" 88 81 89 82 VCSClass = Bzr
Note: See TracChangeset
for help on using the changeset viewer.
