Merge lp:~jelmer/bzr-email/cmd into lp:bzr-email

Proposed by Jelmer Vernooij
Status: Rejected
Rejected by: Jelmer Vernooij
Proposed branch: lp:~jelmer/bzr-email/cmd
Merge into: lp:bzr-email
Diff against target: 57 lines (+40/-0)
1 file modified
__init__.py (+40/-0)
To merge this branch: bzr merge lp:~jelmer/bzr-email/cmd
To post a comment you must log in.

Unmerged revisions

30. By Jelmer Vernooij

Merge trunk.

29. By Jelmer Vernooij

Proper help for dry-run option.

28. By Jelmer Vernooij

Support send-email command in other directories than the root of a branch.

27. By Jelmer Vernooij

Merge trunk.

26. By Jelmer Vernooij

Use right branch object.

25. By Jelmer Vernooij

Add command for manually invoking the send email plugin.

Updating diff...

An updated diff will be available in a few minutes. Reload to see the changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '__init__.py'
--- __init__.py 2010-03-11 07:24:31 +0000
+++ __init__.py 2010-05-04 14:42:25 +0000
@@ -74,6 +74,8 @@
74# These three are used during import: No point lazy_importing them.74# These three are used during import: No point lazy_importing them.
75from bzrlib import errors75from bzrlib import errors
76from bzrlib.branch import Branch76from bzrlib.branch import Branch
77from bzrlib.commands import Command, register_command
78from bzrlib.option import Option
77from bzrlib.lazy_import import lazy_import79from bzrlib.lazy_import import lazy_import
7880
79# lazy_import emailer so that it doesn't get loaded if it isn't used81# lazy_import emailer so that it doesn't get loaded if it isn't used
@@ -124,6 +126,44 @@
124 return result126 return result
125127
126128
129class cmd_send_email(Command):
130 """Send email for specified revision.
131
132 """
133 takes_args = ['branch?']
134 takes_options = ['revision', Option('dry-run',
135 help="Show what would be done, but don't actually do anything.")]
136
137 def run(self, branch='.', revision=None,dry_run=False):
138 br = Branch.open_containing(branch)[0]
139
140 if revision is None:
141 revs = [br.last_revision()]
142 elif len(revision) == 1:
143 revs = [revision[0].in_history(br).rev_id]
144 elif len(revision) == 2:
145 if revision[0].spec is None:
146 from_revno = 1
147 else:
148 from_revno = revision[0].in_history(br).revno
149
150 if revision[1].spec is None:
151 to_revno = br.revno()
152 else:
153 to_revno = revision[1].in_history(br).revno
154 revs = br.revision_history()[from_revno:to_revno]
155 else:
156 raise BzrCommandError('bzr send-email --revision takes one or two arguments')
157
158 for rev_id in revs:
159 _emailer.EmailSender(br, rev_id, br.get_config()).send()
160
161 return 0
162
163
164register_command(cmd_send_email)
165
166
127# setup the email plugin with > 0.15 hooks.167# setup the email plugin with > 0.15 hooks.
128try:168try:
129 install_hooks()169 install_hooks()

Subscribers

People subscribed via source and target branches

to all changes: