~ubuntu-branches/debian/sid/bzr-builddeb/sid

« back to all changes in this revision

Viewing changes to tagging.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij, Colin Watson, Jelmer Vernooij, Robert Collins, James Westby
  • Date: 2010-08-11 18:23:54 UTC
  • Revision ID: james.westby@ubuntu.com-20100811182354-pgqznly5bbtoiso4
Tags: 2.5
[ Colin Watson ]
* Consider a .dsc without a Format: to be Format: 1.0.

[ Jelmer Vernooij ]
* export now uses the timestamp of the last revision, making them more
  deterministic, and so hopefully producing the same tarballs when it is
  used for that.
* Fix use of getattr to have 3 arguments to avoid exception. (LP: #572093)
* Implement the automatic_tag_name hook so that "bzr tag" with no arguments
  will tag based on the version in debian/changelog.
* Support upstream/VERSION tags, for compatibility with git-
  buildpackage. LP: #551362
* Support upstream tarballs without a pristine tar delta.
* Support -r argument to import-upstream.

[ Robert Collins ]
* Add import-upstream command which imports an upstream - useful for
  migrating existing packaging branches into pristine-tar using mode.
* Stop stripping .bzrignore from tarball imports. LP: #496907
* Make the upstream branch authoritative for file ids when importing a
  tarball, stopping errors when files are renamed. LP: #588060

[ James Westby ]
* Add a --package-merge option to builddeb to build with the -v and -sa
  appropriate when doing a merge from Debian or similar. LP: #576027
* Fixed a logic error that stops -r working in merge-upstream. LP: #594575

[ Jelmer Vernooij ]
* Determine Bazaar home directory using bzrlib to prevent test
  isolation issues. Closes: #614125
* Bump standards version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010 Canonical Limited
 
2
# vim: ts=4 sts=4 sw=4
 
3
#
 
4
# This file is part of bzr-builddeb.
 
5
#
 
6
# bzr-builddeb is free software; you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation; either version 2 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# bzr-builddeb is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with bzr-builddeb; if not, write to the Free Software
 
18
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 
 
20
"""Tagging related functions for bzr-builddeb."""
 
21
 
 
22
__all__ = ['is_upstream_tag', 'upstream_tag_version']
 
23
 
 
24
def is_upstream_tag(tag):
 
25
    """Return true if tag is an upstream tag.
 
26
    
 
27
    :param tag: The string name of the tag.
 
28
    :return: True if the tag name is one generated by upstream tag operations.
 
29
 
 
30
    >>> is_upstream_tag('2.1')
 
31
    False
 
32
    >>> is_upstream_tag('upstream-2.1')
 
33
    True
 
34
    """
 
35
    return tag.startswith('upstream-') or tag.startswith('upstream/')
 
36
 
 
37
 
 
38
def upstream_tag_version(tag):
 
39
    """Return the upstream version portion of an upstream tag name.
 
40
 
 
41
    :param tag: The string name of the tag.
 
42
    :return: The version portion of the tag.
 
43
 
 
44
    >>> upstream_tag_version('upstream-2.1')
 
45
    '2.1'
 
46
    """
 
47
    assert is_upstream_tag(tag), "Not an upstream tag: %s" % tag
 
48
    if tag.startswith('upstream/'):
 
49
        tag = tag[len('upstream/'):]
 
50
    elif tag.startswith('upstream-'):
 
51
        tag = tag[len('upstream-'):]
 
52
        if tag.startswith('debian-'):
 
53
            tag = tag[len('debian-'):]
 
54
        elif tag.startswith('ubuntu-'):
 
55
            tag = tag[len('ubuntu-'):]
 
56
    return tag