Mercurial > hg
comparison mercurial/scmutil.py @ 33252:53b3a1968aa6
obsolete: reports the number of local changeset obsoleted when unbundling
This is a first basic visible usage of the changes tracking in the transaction.
We adds a new function computing the pre-existing changesets obsoleted by a
transaction and a transaction call back displaying this information.
Example output:
added 1 changesets with 1 changes to 1 files (+1 heads)
3 new obsolescence markers
obsoleted 1 changesets
The goal is to evolve the transaction summary into something bigger, gathering
existing output there and adding new useful one. This patch is a good first step
on this road. The new output is basic but give a user to the content of
tr.changes['obsmarkers'] and give an idea of the new options we haves. I expect
to revisit the message soon.
The caller recording the transaction summary should also be moved into a more
generic location but further refactoring is needed before it can happen.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 28 Jun 2017 03:54:19 +0200 |
parents | 4d9458e06ef0 |
children | ba43e5ee9c6d |
comparison
equal
deleted
inserted
replaced
33251:a5cb2e4460de | 33252:53b3a1968aa6 |
---|---|
11 import glob | 11 import glob |
12 import hashlib | 12 import hashlib |
13 import os | 13 import os |
14 import re | 14 import re |
15 import socket | 15 import socket |
16 import weakref | |
16 | 17 |
17 from .i18n import _ | 18 from .i18n import _ |
18 from .node import ( | 19 from .node import ( |
19 hex, | 20 hex, |
20 nullid, | 21 nullid, |
21 wdirid, | 22 wdirid, |
22 wdirrev, | 23 wdirrev, |
23 ) | 24 ) |
24 | 25 |
26 from .i18n import _ | |
25 from . import ( | 27 from . import ( |
26 encoding, | 28 encoding, |
27 error, | 29 error, |
28 match as matchmod, | 30 match as matchmod, |
29 obsolete, | 31 obsolete, |
32 obsutil, | |
30 pathutil, | 33 pathutil, |
31 phases, | 34 phases, |
32 pycompat, | 35 pycompat, |
33 revsetlang, | 36 revsetlang, |
34 similar, | 37 similar, |
1057 e = "invalid value in a simple key-value file" | 1060 e = "invalid value in a simple key-value file" |
1058 raise error.ProgrammingError(e) | 1061 raise error.ProgrammingError(e) |
1059 lines.append("%s=%s\n" % (k, v)) | 1062 lines.append("%s=%s\n" % (k, v)) |
1060 with self.vfs(self.path, mode='wb', atomictemp=True) as fp: | 1063 with self.vfs(self.path, mode='wb', atomictemp=True) as fp: |
1061 fp.write(''.join(lines)) | 1064 fp.write(''.join(lines)) |
1065 | |
1066 def registersummarycallback(repo, otr): | |
1067 """register a callback to issue a summary after the transaction is closed | |
1068 """ | |
1069 reporef = weakref.ref(repo) | |
1070 def reportsummary(tr): | |
1071 """the actual callback reporting the summary""" | |
1072 repo = reporef() | |
1073 obsoleted = obsutil.getobsoleted(repo, tr) | |
1074 if obsoleted: | |
1075 repo.ui.status(_('obsoleted %i changesets\n') % len(obsoleted)) | |
1076 otr.addpostclose('00-txnreport', reportsummary) |