~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, Jelmer Vernooij, Jonathan Riddell, Scott Kitterman
  • Date: 2011-07-15 12:15:22 UTC
  • Revision ID: james.westby@ubuntu.com-20110715121522-avtc0uc3uuzcg7zn
Tags: 2.7.5
[ Jelmer Vernooij ]
* New 'bzr dep3-patch' subcommand that can generate DEP-3 compliant
  patches. LP: #460576

[ Jonathan Riddell ]
* Use new set_commit_message() hook in bzr to set the commit
  message from debian/changelog and set fixed bugs in tags. LP: #707274

[ Jelmer Vernooij ]
* Add dependency on devscripts >= 2.10.59, required now that 'dch --
  package' is used. LP: #783122
* Fix support for native packages with dashes in their version in
  sources.list. LP: #796853
* Fix deprecation warnings for TestCase.failUnlessExists and
  TestCase.failIfExists in bzr 2.4.

[ Scott Kitterman ]
* Delete debian/bzr-builddeb.dirs so the long obsolete and empty
  /usr/lib/python2.4/site-packages/bzrlib/plugins/bzr-builddeb/ is no
  longer created. Closes: #631564

[ Jelmer Vernooij ]
* Add support for xz and lzma tarballs. LP: #553668
* When importing upstream component tarballs, don't repack bz2/lzma
  tarballs to gz if the package is in v3 source format. LP: #810531

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
"""Tagging related functions for bzr-builddeb."""
21
21
 
22
 
__all__ = ['is_upstream_tag', 'upstream_tag_version']
23
 
 
24
 
 
25
22
try:
26
23
    from debian.changelog import Version
27
24
except ImportError:
29
26
    from debian_bundle.changelog import Version
30
27
 
31
28
 
32
 
def is_upstream_tag(tag):
33
 
    """Return true if tag is an upstream tag.
34
 
    
35
 
    :param tag: The string name of the tag.
36
 
    :return: True if the tag name is one generated by upstream tag operations.
37
 
 
38
 
    >>> is_upstream_tag('2.1')
39
 
    False
40
 
    >>> is_upstream_tag('upstream-2.1')
41
 
    True
42
 
    """
43
 
    return tag.startswith('upstream-') or tag.startswith('upstream/')
44
 
 
45
 
 
46
 
def upstream_tag_version(tag):
47
 
    """Return the upstream version portion of an upstream tag name.
48
 
 
49
 
    :param tag: The string name of the tag.
50
 
    :return: The version portion of the tag.
51
 
 
52
 
    >>> upstream_tag_version('upstream-2.1')
53
 
    '2.1'
54
 
    """
55
 
    assert is_upstream_tag(tag), "Not an upstream tag: %s" % tag
56
 
    if tag.startswith('upstream/'):
57
 
        tag = tag[len('upstream/'):]
58
 
    elif tag.startswith('upstream-'):
59
 
        tag = tag[len('upstream-'):]
60
 
        if tag.startswith('debian-'):
61
 
            tag = tag[len('debian-'):]
62
 
        elif tag.startswith('ubuntu-'):
63
 
            tag = tag[len('ubuntu-'):]
64
 
    return tag
65
 
 
66
 
 
67
29
def sort_debversion(branch, tags):
68
30
    """Sort tags using Debian version in-place.
69
31