Package gbp :: Module git
[hide private]
[frames] | no frames]

Module git

provides git repository related helpers

Classes [hide private]
  GitRepositoryError
Exception thrown by GitRepository
  GitRepository
Represents a git repository at path
  FastImport
Invoke git-fast-import
Functions [hide private]
 
create_repo(path)
create a repository at path
 
build_tag(format, version)
Generate a tag from a given format and a version
 
__sanitize_version(version)
sanitize a version so git accepts it as a tag
 
tag_to_version(tag, format)
Extract the version from a tag
 
rfc822_date_to_git(rfc822_date)
Parse a date in RFC822 format, and convert to a 'seconds tz' string.
Variables [hide private]
  __package__ = 'gbp'
Function Details [hide private]

build_tag(format, version)

 

Generate a tag from a given format and a version

>>> build_tag("debian/%(version)s", "0:0~0")
'debian/0%0_0'

__sanitize_version(version)

 

sanitize a version so git accepts it as a tag

>>> __sanitize_version("0.0.0")
'0.0.0'
>>> __sanitize_version("0.0~0")
'0.0_0'
>>> __sanitize_version("0:0.0")
'0%0.0'
>>> __sanitize_version("0%0~0")
'0%0_0'

tag_to_version(tag, format)

 

Extract the version from a tag

>>> tag_to_version("upstream/1%2_3-4", "upstream/%(version)s")
'1:2~3-4'
>>> tag_to_version("foo/2.3.4", "foo/%(version)s")
'2.3.4'
>>> tag_to_version("foo/2.3.4", "upstream/%(version)s")

rfc822_date_to_git(rfc822_date)

 

Parse a date in RFC822 format, and convert to a 'seconds tz' string.

>>> rfc822_date_to_git('Thu, 1 Jan 1970 00:00:01 +0000')
'1 +0000'
>>> rfc822_date_to_git('Thu, 20 Mar 2008 01:12:57 -0700')
'1206000777 -0700'
>>> rfc822_date_to_git('Sat, 5 Apr 2008 17:01:32 +0200')
'1207407692 +0200'