244
244
return self.control_files.get_physical_lock_status()
247
def gather_stats(self, revid=None, committers=None):
248
"""Gather statistics from a revision id.
250
:param revid: The revision id to gather statistics from, if None, then
251
no revision specific statistics are gathered.
252
:param committers: Optional parameter controlling whether to grab
253
a count of committers from the revision specific statistics.
254
:return: A dictionary of statistics. Currently this contains:
255
committers: The number of committers if requested.
256
firstrev: A tuple with timestamp, timezone for the penultimate left
257
most ancestor of revid, if revid is not the NULL_REVISION.
258
latestrev: A tuple with timestamp, timezone for revid, if revid is
259
not the NULL_REVISION.
260
revisions: The total revision count in the repository.
261
size: An estimate disk size of the repository in bytes.
264
if revid and committers:
265
result['committers'] = 0
266
if revid and revid != _mod_revision.NULL_REVISION:
268
all_committers = set()
269
revisions = self.get_ancestry(revid)
270
# pop the leading None
272
first_revision = None
274
# ignore the revisions in the middle - just grab first and last
275
revisions = revisions[0], revisions[-1]
276
for revision in self.get_revisions(revisions):
277
if not first_revision:
278
first_revision = revision
280
all_committers.add(revision.committer)
281
last_revision = revision
283
result['committers'] = len(all_committers)
284
result['firstrev'] = (first_revision.timestamp,
285
first_revision.timezone)
286
result['latestrev'] = (last_revision.timestamp,
287
last_revision.timezone)
289
# now gather global repository information
290
if self.bzrdir.root_transport.listable():
291
c, t = self._revision_store.total_size(self.get_transaction())
292
result['revisions'] = c
247
297
def missing_revision_ids(self, other, revision_id=None):
248
298
"""Return the revision ids that other has that this does not.
1200
1250
raise errors.UnknownFormatError(format=format_string)
1203
@deprecated_method(symbol_versioning.zero_fourteen)
1204
def set_default_format(klass, format):
1205
klass._set_default_format(format)
1208
def _set_default_format(klass, format):
1209
"""Set the default format for new Repository creation.
1211
The format must already be registered.
1213
format_registry.default_key = format.get_format_string()
1216
1253
def register_format(klass, format):
1217
1254
format_registry.register(format.get_format_string(), format)
1224
1261
def get_default_format(klass):
1225
1262
"""Return the current default format."""
1226
return format_registry.get(format_registry.default_key)
1263
from bzrlib import bzrdir
1264
return bzrdir.format_registry.make_bzrdir('default').repository_format
1228
1266
def _get_control_store(self, repo_transport, control_files):
1229
1267
"""Return the control store for this repository."""
1871
1909
# formats which have no format string are not discoverable
1872
1910
# and not independently creatable, so are not registered.
1873
1911
RepositoryFormat.register_format(RepositoryFormat7())
1874
# KEEP in sync with bzrdir.format_registry default, which controls the overall
1875
# default control directory format
1876
_default_format = RepositoryFormatKnit1()
1877
RepositoryFormat.register_format(_default_format)
1912
# KEEP in sync with bzrdir.format_registry default
1913
RepositoryFormat.register_format(RepositoryFormatKnit1())
1878
1914
RepositoryFormat.register_format(RepositoryFormatKnit2())
1879
1915
RepositoryFormat.register_format(RepositoryFormatKnit3())
1880
RepositoryFormat._set_default_format(_default_format)
1881
1916
_legacy_formats = [RepositoryFormat4(),
1882
1917
RepositoryFormat5(),
1883
1918
RepositoryFormat6()]