Rev 2820: Quicker commit in quiet mode (Ian Clatworthy) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Sep 14 03:06:32 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2820
revision-id: pqm at pqm.ubuntu.com-20070914020622-8ebz7llponlts1na
parent: pqm at pqm.ubuntu.com-20070914004213-xraql0v7q1p63j81
parent: ian.clatworthy at internode.on.net-20070914004746-momfl0f8ojpgx4wd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-09-14 03:06:22 +0100
message:
Quicker commit in quiet mode (Ian Clatworthy)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/tests/test_commit.py test_commit.py-20050914060732-279f057f8c295434
------------------------------------------------------------
revno: 2819.1.1
merged: ian.clatworthy at internode.on.net-20070914004746-momfl0f8ojpgx4wd
parent: pqm at pqm.ubuntu.com-20070914004213-xraql0v7q1p63j81
parent: ian.clatworthy at internode.on.net-20070914001304-1wmnwgv03gs8jaup
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: ianc-integration
timestamp: Fri 2007-09-14 10:47:46 +1000
message:
Quicker commit in quiet mode (Ian Clatworthy)
------------------------------------------------------------
revno: 2789.2.15
merged: ian.clatworthy at internode.on.net-20070914001304-1wmnwgv03gs8jaup
parent: ian.clatworthy at internode.on.net-20070913064004-stcfprwpmilbbn6w
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Fri 2007-09-14 10:13:04 +1000
message:
review feedback from lifeless
------------------------------------------------------------
revno: 2789.2.14
merged: ian.clatworthy at internode.on.net-20070913064004-stcfprwpmilbbn6w
parent: ian.clatworthy at internode.on.net-20070913063840-l3adetq3a1ux5ilb
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-13 16:40:04 +1000
message:
Update NEWS
------------------------------------------------------------
revno: 2789.2.13
merged: ian.clatworthy at internode.on.net-20070913063840-l3adetq3a1ux5ilb
parent: ian.clatworthy at internode.on.net-20070913060924-xjmvkr3f64dd7kzd
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-13 16:38:40 +1000
message:
Update NEWS
------------------------------------------------------------
revno: 2789.2.12
merged: ian.clatworthy at internode.on.net-20070913060924-xjmvkr3f64dd7kzd
parent: ian.clatworthy at internode.on.net-20070913053627-7pyodcq5oe2qdhhn
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-13 16:09:24 +1000
message:
reduce conditionals
------------------------------------------------------------
revno: 2789.2.11
merged: ian.clatworthy at internode.on.net-20070913053627-7pyodcq5oe2qdhhn
parent: ian.clatworthy at internode.on.net-20070913050216-yi2jip6ztyeff28u
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-13 15:36:27 +1000
message:
remove more reporting stuff
------------------------------------------------------------
revno: 2789.2.10
merged: ian.clatworthy at internode.on.net-20070913050216-yi2jip6ztyeff28u
parent: ian.clatworthy at internode.on.net-20070913042856-d67uq0wj4g5t7w74
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-13 15:02:16 +1000
message:
focus on performance gains, not better reporting
------------------------------------------------------------
revno: 2789.2.9
merged: ian.clatworthy at internode.on.net-20070913042856-d67uq0wj4g5t7w74
parent: ian.clatworthy at internode.on.net-20070910033531-0rttlqdlqm4hm4l7
parent: pqm at pqm.ubuntu.com-20070912222627-zvqit350mf6gvrbh
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-13 14:28:56 +1000
message:
merge bzr.dev
------------------------------------------------------------
revno: 2789.2.8
merged: ian.clatworthy at internode.on.net-20070910033531-0rttlqdlqm4hm4l7
parent: ian.clatworthy at internode.on.net-20070906072444-yn7zm81vb1ubrp82
parent: pqm at pqm.ubuntu.com-20070907145828-hjh5941jv7y8d9z8
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Mon 2007-09-10 13:35:31 +1000
message:
merge bzr.dev
------------------------------------------------------------
revno: 2789.2.7
merged: ian.clatworthy at internode.on.net-20070906072444-yn7zm81vb1ubrp82
parent: ian.clatworthy at internode.on.net-20070904080841-yp1yysxknknmhkzd
parent: pqm at pqm.ubuntu.com-20070906050530-q58gvki4dedc4i6e
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Thu 2007-09-06 17:24:44 +1000
message:
merge bzr.dev including updates to test_commit
------------------------------------------------------------
revno: 2789.2.6
merged: ian.clatworthy at internode.on.net-20070904080841-yp1yysxknknmhkzd
parent: ian.clatworthy at internode.on.net-20070904075925-l3c1jw2rzuut89zb
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Tue 2007-09-04 18:08:41 +1000
message:
Update NEWS
------------------------------------------------------------
revno: 2789.2.5
merged: ian.clatworthy at internode.on.net-20070904075925-l3c1jw2rzuut89zb
parent: ian.clatworthy at internode.on.net-20070904064951-t4833s0vn5hfq1qu
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Tue 2007-09-04 17:59:25 +1000
message:
Upgrade commit tests to reflect new reporting formats
------------------------------------------------------------
revno: 2789.2.4
merged: ian.clatworthy at internode.on.net-20070904064951-t4833s0vn5hfq1qu
parent: ian.clatworthy at internode.on.net-20070904044759-rlb8qd7xpwa99r37
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Tue 2007-09-04 16:49:51 +1000
message:
make change reporting smarter for initial commit
------------------------------------------------------------
revno: 2789.2.3
merged: ian.clatworthy at internode.on.net-20070904044759-rlb8qd7xpwa99r37
parent: ian.clatworthy at internode.on.net-20070903132434-z3fw269kp97l9355
parent: pqm at pqm.ubuntu.com-20070904035759-iv4xl6d7ez69txba
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Tue 2007-09-04 14:47:59 +1000
message:
merge bzr.dev
------------------------------------------------------------
revno: 2789.2.2
merged: ian.clatworthy at internode.on.net-20070903132434-z3fw269kp97l9355
parent: ian.clatworthy at internode.on.net-20070903131752-va6227ax1vj8b9pb
parent: pqm at pqm.ubuntu.com-20070903130729-qdcrag0a7vcpzfgm
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Mon 2007-09-03 23:24:34 +1000
message:
Merge bzr.dev
------------------------------------------------------------
revno: 2789.2.1
merged: ian.clatworthy at internode.on.net-20070903131752-va6227ax1vj8b9pb
parent: pqm at pqm.ubuntu.com-20070903110923-pj5pw0wsf1u922j9
committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
branch nick: bzr.commit-less-verbose
timestamp: Mon 2007-09-03 23:17:52 +1000
message:
Make commit less verbose by default
=== modified file 'NEWS'
--- a/NEWS 2007-09-13 23:16:40 +0000
+++ b/NEWS 2007-09-14 00:47:46 +0000
@@ -13,6 +13,9 @@
PERFORMANCE:
+ * Commit in quiet mode is now slightly faster as the information to
+ output is no longer calculated. (Ian Clatworthy)
+
IMPROVEMENTS:
BUG FIXES:
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-09-11 00:27:26 +0000
+++ b/bzrlib/builtins.py 2007-09-13 04:28:56 +0000
@@ -2310,16 +2310,11 @@
raise errors.BzrCommandError("empty commit message specified")
return my_message
- if verbose or not is_quiet():
- reporter = ReportCommitToLog()
- else:
- reporter = NullCommitReporter()
-
try:
tree.commit(message_callback=get_message,
specific_files=selected_list,
allow_pointless=unchanged, strict=strict, local=local,
- reporter=reporter, revprops=properties,
+ reporter=None, verbose=verbose, revprops=properties,
author=author)
except PointlessCommit:
# FIXME: This should really happen before the file is read in;
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2007-09-05 00:36:07 +0000
+++ b/bzrlib/commit.py 2007-09-14 00:13:04 +0000
@@ -72,7 +72,7 @@
is_inside_or_parent_of_any,
quotefn, sha_file, split_lines)
from bzrlib.testament import Testament
-from bzrlib.trace import mutter, note, warning
+from bzrlib.trace import mutter, note, warning, is_quiet
from bzrlib.xml5 import serializer_v5
from bzrlib.inventory import Inventory, InventoryEntry
from bzrlib import symbol_versioning
@@ -108,6 +108,9 @@
def renamed(self, change, old_path, new_path):
pass
+ def is_verbose(self):
+ return False
+
class ReportCommitToLog(NullCommitReporter):
@@ -134,7 +137,7 @@
def completed(self, revno, rev_id):
self._note('Committed revision %d.', revno)
-
+
def deleted(self, file_id):
self._note('deleted %s', file_id)
@@ -147,6 +150,9 @@
def renamed(self, change, old_path, new_path):
self._note('%s %s => %s', change, old_path, new_path)
+ def is_verbose(self):
+ return True
+
class Commit(object):
"""Task of committing a new revision.
@@ -163,12 +169,13 @@
def __init__(self,
reporter=None,
config=None):
- if reporter is not None:
- self.reporter = reporter
- else:
- self.reporter = NullCommitReporter()
+ """Create a Commit object.
+
+ :param reporter: the default reporter to use or None to decide later
+ """
+ self.reporter = reporter
self.config = config
-
+
def commit(self,
message=None,
timestamp=None,
@@ -209,6 +216,8 @@
:param revprops: Properties for new revision
:param local: Perform a local only commit.
+ :param reporter: the reporter to use or None for the default
+ :param verbose: if True and the reporter is not None, report everything
:param recursive: If set to 'down', commit in any subtrees that have
pending changes of any sort during this commit.
"""
@@ -247,11 +256,6 @@
self.strict = strict
self.verbose = verbose
- if reporter is None and self.reporter is None:
- self.reporter = NullCommitReporter()
- elif reporter is not None:
- self.reporter = reporter
-
self.work_tree.lock_write()
self.pb = bzrlib.ui.ui_factory.nested_progress_bar()
self.basis_tree = self.work_tree.basis_tree()
@@ -267,6 +271,11 @@
# Check that the working tree is up to date
old_revno, new_revno = self._check_out_of_date_tree()
+ # Complete configuration setup
+ if reporter is not None:
+ self.reporter = reporter
+ elif self.reporter is None:
+ self.reporter = self._select_reporter()
if self.config is None:
self.config = self.branch.get_config()
@@ -368,6 +377,12 @@
self._cleanup()
return self.rev_id
+ def _select_reporter(self):
+ """Select the CommitReporter to use."""
+ if is_quiet():
+ return NullCommitReporter()
+ return ReportCommitToLog()
+
def _any_real_changes(self):
"""Are there real changes between new_inventory and basis?
@@ -666,12 +681,11 @@
self.builder.record_entry_contents(ie, self.parent_invs, path,
self.basis_tree)
- # Report what was deleted. We could skip this when no deletes are
- # detected to gain a performance win, but it arguably serves as a
- # 'safety check' by informing the user whenever anything disappears.
- for path, ie in self.basis_inv.iter_entries():
- if ie.file_id not in self.builder.new_inventory:
- self.reporter.deleted(path)
+ # Report what was deleted.
+ if self.reporter.is_verbose():
+ for path, ie in self.basis_inv.iter_entries():
+ if ie.file_id not in self.builder.new_inventory:
+ self.reporter.deleted(path)
def _populate_from_inventory(self, specific_files):
"""Populate the CommitBuilder by walking the working tree inventory."""
@@ -680,6 +694,7 @@
for unknown in self.work_tree.unknowns():
raise StrictCommitFailed()
+ report_changes = self.reporter.is_verbose()
deleted_ids = []
deleted_paths = set()
work_inv = self.work_tree.inventory
@@ -722,7 +737,7 @@
# without it thanks to a unicode normalisation issue. :-(
definitely_changed = kind != existing_ie.kind
self._record_entry(path, file_id, specific_files, kind, name,
- parent_id, definitely_changed, existing_ie)
+ parent_id, definitely_changed, existing_ie, report_changes)
# Unversion IDs that were found to be deleted
self.work_tree.unversion(deleted_ids)
@@ -753,7 +768,8 @@
pass
def _record_entry(self, path, file_id, specific_files, kind, name,
- parent_id, definitely_changed, existing_ie=None):
+ parent_id, definitely_changed, existing_ie=None,
+ report_changes=True):
"Record the new inventory entry for a path if any."
# mutter('check %s {%s}', path, file_id)
if (not specific_files or
@@ -774,7 +790,8 @@
if ie is not None:
self.builder.record_entry_contents(ie, self.parent_invs,
path, self.work_tree)
- self._report_change(ie, path)
+ if report_changes:
+ self._report_change(ie, path)
return ie
def _report_change(self, ie, path):
=== modified file 'bzrlib/tests/test_commit.py'
--- a/bzrlib/tests/test_commit.py 2007-08-08 05:43:43 +0000
+++ b/bzrlib/tests/test_commit.py 2007-09-03 13:17:52 +0000
@@ -70,6 +70,9 @@
def renamed(self, change, old_path, new_path):
self.calls.append(('renamed', change, old_path, new_path))
+ def is_verbose(self):
+ return True
+
class TestCommit(TestCaseWithTransport):
More information about the bazaar-commits
mailing list