Revision b7e05a72

b/devflow/flow.py
55 55
        self.new_tags = []
56 56
        self.repo.git.pull("origin")
57 57

  
58
    def get_branch(self, mode, version):
59
        if mode not in ["release", "hotfix"]:
60
            raise ValueError("Unknown mode: %s" % mode)
61
        return "%s-%s" % (mode, version)
62

  
63
    def get_debian_branch(self, mode, version):
64
        if mode not in ["release", "hotfix"]:
65
            raise ValueError("Unknown mode: %s" % mode)
66
        return "debian-%s-%s" % (mode, version)
67

  
58 68
    @cleanup
59 69
    def start_release(self, version):
60 70
        self.start_common("release", version)
......
65 75

  
66 76
    @cleanup
67 77
    def end_release(self, version):
68
        self.end_common("release", version)
78
        repo = self.repo
79
        master = "master"
80
        debian_master = "debian"
81
        upstream = "develop"
82
        debian = "debian-develop"
83
        upstream_branch = self.get_branch("release", version)
84
        debian_branch = self.get_debian_branch("release", version)
85
        repo.git.checkout(upstream)
86
        with conflicts():
87
            repo.git.merge("--no-ff", upstream_branch)
88
        repo.git.checkout(debian)
89
        with conflicts():
90
            repo.git.merge("--no-ff", debian_branch)
91

  
92
        repo.git.checkout(master)
93
        with conflicts():
94
            repo.git.merge("--no-ff", upstream_branch)
95
        repo.git.checkout(debian_master)
96
        with conflicts():
97
            repo.git.merge("--no-ff", debian_branch)
98

  
99
        repo.git.checkout(upstream)
100
        print "To remove obsolete branches run:"
101
        print "git branch -d %s" % upstream_branch
102
        print "git branch -d %s" % debian_branch
69 103

  
70 104
    @cleanup
71 105
    def end_hotfix(self, version):
72
        self.end_common("hotfix", version)
106
        repo = self.repo
107
        upstream = "master"
108
        debian = "debian"
109
        upstream_branch = self.get_branch("hotfix", version)
110
        debian_branch = self.get_debian_branch("hotfix", version)
111

  
112
        repo.git.checkout(upstream)
113
        with conflicts():
114
            repo.git.merge("--no-ff", upstream_branch)
115
        repo.git.checkout(debian)
116
        with conflicts():
117
            repo.git.merge("--no-ff", debian_branch)
118

  
119
        repo.git.checkout(upstream)
120
        print "To remove obsolete branches run:"
121
        print "git branch -d %s" % upstream_branch
122
        print "git branch -d %s" % debian_branch
73 123

  
74 124
    def start_common(self, mode, version):
75 125
        if mode not in ["release", "hotfix"]:
......
122 172
            print "git branch -D %s" % feature_debian
123 173

  
124 174
    def end_common(self, mode, version):
125
        if mode not in ["release", "hotfix"]:
126
            raise ValueError("Unknown mode: %s" % mode)
127
        repo = self.repo
128
        master = "master"
129
        upstream = "develop" if mode == "release" else "master"
130
        debian = "debian-develop" if mode == "release" else "debian"
131
        upstream_branch = "%s-%s" % (mode, version)
132
        debian_branch = "debian-%s-%s" % (mode, version)
133
        repo.git.checkout(upstream)
134
        with conflicts():
135
            repo.git.merge("--no-ff", upstream_branch)
136
        repo.git.checkout(master)
137
        with conflicts():
138
            repo.git.merge("--no-ff", upstream_branch)
139
        repo.git.checkout(debian)
140
        with conflicts():
141
            repo.git.merge("--no-ff", debian_branch)
142
        repo.git.checkout(upstream)
143
        print "To remove obsolete branches run:"
144
        print "git branch -d %s" % upstream_branch
145
        print "git branch -d %s" % debian_branch
175
        pass
146 176

  
147 177

  
148 178
def refhead(repo):

Also available in: Unified diff