~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-03-16 14:01:20 UTC
  • mfrom: (3280.2.5 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080316140120-i3yq8yr1l66m11h7
Start 1.4 development

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
18
from StringIO import StringIO
148
148
        else:
149
149
            revno = branch.get_revision_id_to_revno_map().get(self.revision_id,
150
150
                ['merge'])
151
 
        nick = re.sub('(\W+)', '-', branch.nick).strip('-')
152
 
        return '%s-%s' % (nick, '.'.join(str(n) for n in revno))
 
151
        return '%s-%s' % (branch.nick, '.'.join(str(n) for n in revno))
153
152
 
154
153
    @staticmethod
155
154
    def _generate_diff(repository, revision_id, ancestor_id):
210
209
                except errors.RevisionNotPresent:
211
210
                    # At least one dependency isn't present.  Try installing
212
211
                    # missing revisions from the submit branch
213
 
                    try:
214
 
                        submit_branch = \
215
 
                            _mod_branch.Branch.open(self.target_branch)
216
 
                    except errors.NotBranchError:
217
 
                        raise errors.TargetNotBranch(self.target_branch)
 
212
                    submit_branch = _mod_branch.Branch.open(self.target_branch)
218
213
                    missing_revisions = []
219
214
                    bundle_revisions = set(r.revision_id for r in
220
215
                                           info.real_revisions)
278
273
        """
279
274
        _BaseMergeDirective.__init__(self, revision_id, testament_sha1, time,
280
275
            timezone, target_branch, patch, source_branch, message)
281
 
        if patch_type not in (None, 'diff', 'bundle'):
282
 
            raise ValueError(patch_type)
 
276
        assert patch_type in (None, 'diff', 'bundle'), patch_type
283
277
        if patch_type != 'bundle' and source_branch is None:
284
278
            raise errors.NoMergeSource()
285
279
        if patch_type is not None and patch is None:
566
560
_format_registry = MergeDirectiveFormatRegistry()
567
561
_format_registry.register(MergeDirective)
568
562
_format_registry.register(MergeDirective2)
569
 
# 0.19 never existed.  It got renamed to 0.90.  But by that point, there were
570
 
# already merge directives in the wild that used 0.19. Registering with the old
571
 
# format string to retain compatibility with those merge directives.
572
563
_format_registry.register(MergeDirective2,
573
564
                          'Bazaar merge directive format 2 (Bazaar 0.19)')