Repository: borgbackup/borg

Issue:
msgid for borg check doesn't match documentation
I'm writing a borg frontend using the JSON interface. According to [the docs](https://borgbackup.readthedocs.io/en/stable/internals/frontends.html#message-ids), I would expect borg to emit `progress_percent` messages with `msgid='repository.check_segments'`. However, it really yields `msgid='repository.check'` which is not mentioned in the docs. I don't really know which `msgid` is preferable, (maybe `check_segments` in case there are/will be other `msgid`s related to repository checks), but at least the documentation and code should  match.

Cf. https://github.com/borgbackup/borg/blob/2209f56cd53dcb47e8056c20e25968f1e402fa94/src/borg/repository.py#L962-L963

Thanks!

---

**EDIT:** `git grep` reveals a few more inconsistencies regarding message ids for progress indicators:

- no `msgid` at all for 
https://github.com/borgbackup/borg/blob/61b8234704b83ba946df20bf129d74f8ab7dd699/src/borg/archive.py#L599
https://github.com/borgbackup/borg/blob/61b8234704b83ba946df20bf129d74f8ab7dd699/src/borg/upgrader.py#L82
- further `msgid`s not mentioned in the docs: `prune` 
https://github.com/borgbackup/borg/blob/61b8234704b83ba946df20bf129d74f8ab7dd699/src/borg/archiver.py#L1448
and `check.rebuild_manifest`
https://github.com/borgbackup/borg/blob/61b8234704b83ba946df20bf129d74f8ab7dd699/src/borg/archive.py#L1556-L1557

---
**EDIT 2:** I just verified that all references to the documentation above (which I looked up in the stable docs) still apply to the 'latest' docs on readthedocs.


Discussion:
For the repository module, the msgids are like the method name. So the docs are wrong and it should be `repository.check` not `repository.check_segments`.


Resolving patch:
diff --git a/src/borg/archive.py b/src/borg/archive.py
--- a/src/borg/archive.py
+++ b/src/borg/archive.py
@@ -596,7 +596,8 @@ def add(id):
             archive_index = ChunkIndex()
             sync = CacheSynchronizer(archive_index)
             add(self.id)
-            pi = ProgressIndicatorPercent(total=len(self.metadata.items), msg='Calculating statistics... %3d%%')
+            pi = ProgressIndicatorPercent(total=len(self.metadata.items), msg='Calculating statistics... %3d%%',
+                                          msgid='archive.calc_stats')
             for id, chunk in zip(self.metadata.items, self.repository.get_many(self.metadata.items)):
                 pi.show(increase=1)
                 add(id)
diff --git a/src/borg/upgrader.py b/src/borg/upgrader.py
--- a/src/borg/upgrader.py
+++ b/src/borg/upgrader.py
@@ -79,7 +79,7 @@ def convert_segments(segments, dryrun=True, inplace=False, progress=False):
         replace the 8 first bytes of all regular files in there."""
         logger.info("converting %d segments..." % len(segments))
         segment_count = len(segments)
-        pi = ProgressIndicatorPercent(total=segment_count, msg="Converting segments %3.0f%%")
+        pi = ProgressIndicatorPercent(total=segment_count, msg="Converting segments %3.0f%%", msgid='upgrade.convert_segments')
         for i, filename in enumerate(segments):
             if progress:
                 pi.show(i)


Test patch: