Merge lp:~nskaggs/juju-ci-tools/add-version-branch-support into lp:juju-ci-tools

Proposed by Nicholas Skaggs
Status: Merged
Merged at revision: 1426
Proposed branch: lp:~nskaggs/juju-ci-tools/add-version-branch-support
Merge into: lp:juju-ci-tools
Diff against target: 44 lines (+20/-0)
1 file modified
git_gate.py (+20/-0)
To merge this branch: bzr merge lp:~nskaggs/juju-ci-tools/add-version-branch-support
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+295731@code.launchpad.net

Description of the change

Add support for versioned branch from an unversioned repo. This is to support the names + names.v2 repository and similar stories.

http://gopkg.in/juju/names.v2 lives at https://github.com/juju/names/tree/v2, which otherwise clones into 'names', rather than 'names.v2'.

To post a comment you must log in.
1427. By Nicholas Skaggs

use \Z instead of checking length

Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'git_gate.py'
--- git_gate.py 2015-12-14 16:23:40 +0000
+++ git_gate.py 2016-05-25 15:18:07 +0000
@@ -5,6 +5,7 @@
55
6import argparse6import argparse
7import os7import os
8import re
8import subprocess9import subprocess
9import sys10import sys
1011
@@ -51,6 +52,8 @@
51 git = SubcommandRunner("git")52 git = SubcommandRunner("git")
5253
53 final_project = args.project54 final_project = args.project
55 if args.project_ref:
56 final_project = version_dir_from_branch(args.project, args.project_ref)
54 if args.feature_branch:57 if args.feature_branch:
55 final_project = from_feature_dir(args.project)58 final_project = from_feature_dir(args.project)
5659
@@ -91,6 +94,23 @@
91 go("test", project_ellipsis)94 go("test", project_ellipsis)
9295
9396
97def version_dir_from_branch(directory, branch_name):
98 """
99 For branches of repos that are versioned with gopkg.in, we need to
100 do some special handling, since the test code expects the version to be
101 appended to the reponame with a ".". However, the version is different
102 than the base gopkg.in branch. To account for this, we use the convention
103 that a version branch is named v[0-9], and clone accordingly.
104
105 Thus, the branch for gopkg.in/juju/charm.v6 would be from a git repo
106 named charm, tagged v6, which should end up in
107 $GOPATH/src/gokpg.in/juju/charm.v6
108 """
109 if re.match('[v]\d\Z', branch_name):
110 return directory + '.' + branch_name
111 return directory
112
113
94def from_feature_dir(directory):114def from_feature_dir(directory):
95 """115 """
96 For feature branches on repos that are versioned with gopkg.in, we need to116 For feature branches on repos that are versioned with gopkg.in, we need to

Subscribers

People subscribed via source and target branches