Как вывести имя файла используя модуль pysvn под python?
Скрипт выводить номер ревизии, имя автора, коммит. Как еще вывести имя файла, необходимо для будушего поиска по имени файла за определенный интервал ревизий?
есть поле copyfrom_path, но я не пойму как к нему получить доступ?
log returns a list of log entries; each log entry is a dictionary. The dictionary contains:
author - string - the name of the author who committed the revision
date - float time - the date of the commit
message - string - the text of the log message for the commit
revision - pysvn.Revision - the revision of the commit
changed_paths - list of dictionaries. Each dictionary contains:
path - string - the path in the repository
action - string
copyfrom_path - string - if copied, the original path, else None
copyfrom_revision - pysvn.Revision - if copied, the revision of the original, else None
Код:
import pysvn
url = 'http://svn.code'
start_rev = 100
end_rev = 138
client = pysvn.Client()
revision_start = pysvn.Revision(pysvn.opt_revision_kind.number, start_rev)
revision_end = pysvn.Revision(pysvn.opt_revision_kind.number, end_rev)
for log in client.log(url, revision_start, revision_end):
print(log.revision.number, log["author"], log["message"])
Ответы (1 шт):
Автор решения: CrazyElf
→ Ссылка
changed_paths - list of dictionaries.
Соответственно, просто перебираете вложенные в список словари ещё одним циклом:
for log in client.log(url, revision_start, revision_end):
print(log.revision.number, log["author"], log["message"])
for chg_path in log["changed_paths"]:
print(chg_path["copyfrom_path"])