# HG changeset patch # User Anton Shestakov # Date 1709143672 10800 # Node ID c2a4e21f4aaf2456d1f09ea7a856610fb7e01ac2 # Parent 5b20bc704577d4634f39df070bc9544a5d116d47 topic: move .hg/topic-namespace file removal to a separate method diff -r 5b20bc704577 -r c2a4e21f4aaf hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sun Mar 03 14:40:01 2024 -0300 +++ b/hgext3rd/topic/__init__.py Wed Feb 28 15:07:52 2024 -0300 @@ -715,12 +715,8 @@ self._topic_namespaces = namespaces return namespaces - @property - def currenttns(self): + def _cleanup_tns_file(self): tns = self.vfs.tryread(b'topic-namespace') - # we should definitely drop this at some point, but it depends on - # our own release schedule, not core's, so here's hg 1.0 - # hg <= 1.0 (cfa08c88a5c4) if tns == b'none': try: with self.wlock(wait=False): @@ -735,11 +731,14 @@ # if we cannot acquire wdir lock, then we shouldn't do # anything at all, since it'd be unsafe to modify wdir pass - elif tns == b'': - # technically, if user creates an empty file, it should be - # handled differently than non-existing file, but the - # distinction is probably not that important - tns = b'none' + + @property + def currenttns(self): + # we should definitely drop this at some point, but it depends on + # our own release schedule, not core's, so here's hg 1.0 + # hg <= 1.0 (cfa08c88a5c4) + self._cleanup_tns_file() + tns = self.vfs.tryread(b'topic-namespace') or b'none' return encoding.tolocal(tns) @util.propertycache