# HG changeset patch
# User Antonio Muci <
a....@inwind.it>
# Date 1775574055 -7200
# Tue Apr 07 17:00:55 2026 +0200
# Branch stable
# Node ID 859b2f861a78ebda5687ac5f445feb59af7e72a2
# Parent c92cd00dbfe34302c6ea6824a2636b28c92adcbc
repotreeitem: replace commonprefix() with commonpath(), due to a DeprecationWarning
Found while running Tortoisehg under Python 3.15.0a7 in strict mode:
```
$ python3.15 -Wall -Werror thg
Traceback (most recent call last):
...
File "<BASE>/tortoisehg/hgqt/repotreemodel.py", line 412, in updateCommonPaths
grp.updateCommonPath()
~~~~~~~~~~~~~~~~~~~~^^
File "<BASE>/tortoisehg/hgqt/repotreeitem.py", line 699, in updateCommonPath
self._commonpath = os.path.dirname(os.path.commonprefix(childs))
~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "<frozen genericpath>", line 109, in commonprefix
DeprecationWarning: os.path.commonprefix() is deprecated. Use os.path.commonpath() for longest path prefix.
```
The context is the following: os.path.commonprefix() has been known to be buggy
since python 3.5 and has been deprecated since python 3.10. Link to the current
documentation:
https://docs.python.org/3.15/library/os.path.html#os.path.commonprefix
diff --git a/tortoisehg/hgqt/repotreeitem.py b/tortoisehg/hgqt/repotreeitem.py
--- a/tortoisehg/hgqt/repotreeitem.py
+++ b/tortoisehg/hgqt/repotreeitem.py
@@ -696,7 +696,7 @@ class RepoGroupItem(RepoTreeItem):
childs = [os.path.normcase(child.rootpath())
for child in self.childs
if not isinstance(child, RepoGroupItem)]
- self._commonpath = os.path.dirname(os.path.commonprefix(childs))
+ self._commonpath = os.path.dirname(os.path.commonpath(childs))
def getCommonPath(self) -> str:
return self._commonpath