diff --git a/svn/local.py b/svn/local.py index 686063b..fd31f43 100644 --- a/svn/local.py +++ b/svn/local.py @@ -13,6 +13,7 @@ 'type_raw_name', 'type', 'revision', + 'changelist', ]) @@ -77,7 +78,7 @@ def status(self, rel_path=None): root = xml.etree.ElementTree.fromstring(raw) list_ = root.findall('target/entry') - for entry in list_: + def make_status(entry, changelist): entry_attr = entry.attrib name = entry_attr['path'] @@ -93,12 +94,20 @@ def status(self, rel_path=None): if revision is not None: revision = int(revision) - yield _STATUS_ENTRY( + return _STATUS_ENTRY( name=name, type_raw_name=change_type_raw, type=change_type, - revision=revision + revision=revision, + changelist=changelist, ) + for entry in list_: + yield make_status(entry, None) + changes = root.findall('changelist') + for c in changes: + cl_name = c.attrib['name'] + for entry in c: + yield make_status(entry, cl_name) def remove(self, rel_path, do_keep_local=False, do_force=False): args = [] diff --git a/tests/test_local.py b/tests/test_local.py index 445f4b8..83e4a26 100644 --- a/tests/test_local.py +++ b/tests/test_local.py @@ -8,19 +8,35 @@ class TestLocalClient(unittest.TestCase): def test_status(self): with svn.test_support.temp_repo(): - with svn.test_support.temp_checkout() as (_, lc): + with svn.test_support.temp_checkout() as (wc, lc): svn.test_support.populate_bigger_file_changes1() + file_in_cl = 'file_in_cl' + with open(file_in_cl, 'w') as f: + f.write("data") + + lc.add(file_in_cl) + lc.run_command('changelist', ['test-cl', file_in_cl]) + status = {} for s in lc.status(): filename = os.path.basename(s.name) status[filename] = s added = status['added'] - self.assertTrue(added is not None and added.type == svn.constants.ST_ADDED) + self.assertIsNotNone(added) + self.assertTrue(added.type, svn.constants.ST_ADDED) + self.assertEqual(added.changelist, None) committed_deleted = status['committed_deleted'] - self.assertTrue(committed_deleted is not None and committed_deleted.type == svn.constants.ST_MISSING) + self.assertIsNotNone(committed_deleted) + self.assertEqual(committed_deleted.type, svn.constants.ST_MISSING) + self.assertEqual(added.changelist, None) + + in_cl = status[file_in_cl] + self.assertIsNotNone(in_cl) + self.assertEqual(in_cl.changelist, 'test-cl') + def test_remove(self): with svn.test_support.temp_repo():