Skip to content

Commit

Permalink
Merge 197359b into c0878be
Browse files Browse the repository at this point in the history
  • Loading branch information
idbrii committed Nov 24, 2020
2 parents c0878be + 197359b commit 341d556
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
15 changes: 12 additions & 3 deletions svn/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'type_raw_name',
'type',
'revision',
'changelist',
])


Expand Down Expand Up @@ -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']

Expand All @@ -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 = []
Expand Down
22 changes: 19 additions & 3 deletions tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 341d556

Please sign in to comment.