~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
17
18
 
18
19
from StringIO import StringIO
19
20
import re
82
83
    multiple_output_files = False
83
84
 
84
85
    def __init__(self, revision_id, testament_sha1, time, timezone,
85
 
                 target_branch, patch=None, source_branch=None, message=None,
86
 
                 bundle=None):
 
86
                 target_branch, patch=None, source_branch=None,
 
87
                 message=None, bundle=None):
87
88
        """Constructor.
88
89
 
89
90
        :param revision_id: The revision to merge
91
92
            merge.
92
93
        :param time: The current POSIX timestamp time
93
94
        :param timezone: The timezone offset
94
 
        :param target_branch: The branch to apply the merge to
 
95
        :param target_branch: Location of branch to apply the merge to
95
96
        :param patch: The text of a diff or bundle
96
97
        :param source_branch: A public location to merge the revision from
97
98
        :param message: The message to use when committing this merge
165
166
        :param target_branch: The url of the branch to merge into
166
167
        :param patch_type: 'bundle', 'diff' or None, depending on the type of
167
168
            patch desired.
168
 
        :param local_target_branch: a local copy of the target branch
169
 
        :param public_branch: location of a public branch containing the target
170
 
            revision.
 
169
        :param local_target_branch: the submit branch, either itself or a local copy
 
170
        :param public_branch: location of a public branch containing
 
171
            the target revision.
171
172
        :param message: Message to use when committing the merge
172
173
        :return: The merge directive
173
174
 
181
182
        if revision_id == _mod_revision.NULL_REVISION:
182
183
            t_revision_id = None
183
184
        t = testament.StrictTestament3.from_revision(repository, t_revision_id)
184
 
        submit_branch = _mod_branch.Branch.open(target_branch)
 
185
        if local_target_branch is None:
 
186
            submit_branch = _mod_branch.Branch.open(target_branch)
 
187
        else:
 
188
            submit_branch = local_target_branch
185
189
        if submit_branch.get_public_branch() is not None:
186
190
            target_branch = submit_branch.get_public_branch()
187
191
        if patch_type is None:
244
248
        :param branch: The source branch, to get the signing strategy
245
249
        :return: a string
246
250
        """
247
 
        my_gpg = gpg.GPGStrategy(branch.get_config())
 
251
        my_gpg = gpg.GPGStrategy(branch.get_config_stack())
248
252
        return my_gpg.sign(''.join(self.to_lines()))
249
253
 
250
254
    def to_email(self, mail_to, branch, sign=False):
256
260
        :param sign: If True, gpg-sign the email
257
261
        :return: an email message
258
262
        """
259
 
        mail_from = branch.get_config().username()
 
263
        mail_from = branch.get_config_stack().get('email')
260
264
        if self.message is not None:
261
265
            subject = self.message
262
266
        else:
373
377
            merge.
374
378
        :param time: The current POSIX timestamp time
375
379
        :param timezone: The timezone offset
376
 
        :param target_branch: The branch to apply the merge to
 
380
        :param target_branch: Location of the branch to apply the merge to
377
381
        :param patch: The text of a diff or bundle
378
382
        :param patch_type: None, "diff" or "bundle", depending on the contents
379
383
            of patch
567
571
        :param target_branch: The url of the branch to merge into
568
572
        :param include_patch: If true, include a preview patch
569
573
        :param include_bundle: If true, include a bundle
570
 
        :param local_target_branch: a local copy of the target branch
571
 
        :param public_branch: location of a public branch containing the target
572
 
            revision.
 
574
        :param local_target_branch: the target branch, either itself or a local copy
 
575
        :param public_branch: location of a public branch containing
 
576
            the target revision.
573
577
        :param message: Message to use when committing the merge
574
578
        :return: The merge directive
575
579
 
588
592
                t_revision_id = None
589
593
            t = testament.StrictTestament3.from_revision(repository,
590
594
                t_revision_id)
591
 
            submit_branch = _mod_branch.Branch.open(target_branch)
 
595
            if local_target_branch is None:
 
596
                submit_branch = _mod_branch.Branch.open(target_branch)
 
597
            else:
 
598
                submit_branch = local_target_branch
592
599
            submit_branch.lock_read()
593
600
            locked.append(submit_branch)
594
601
            if submit_branch.get_public_branch() is not None: