From 4a493b0c7a5dbc3ba1fe7a8f27f2cc38e29db9c1 Mon Sep 17 00:00:00 2001 From: Jonathan Patrick Davies Date: Tue, 12 Aug 2008 00:09:01 +0100 Subject: [PATCH] * get-branches: Check that the team has branches before downloading. --- debian/changelog | 6 ++++-- get-branches | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5f3afd5..f682eb3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,10 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low [ Jonathan Patrick Davies ] - * get-branches: Open the teams code page before making a new directory. + * get-branches: + - Open the teams code page before making a new directory. + - Now check team option before anything else. + - Check that the team has branches before downloading. * doc/get-branches.1: Created. * hugdaylist: Improved argument and error handling. * pull-lp-source: @@ -16,7 +19,6 @@ ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low * requestsync: Use the functions in the common.py file above to authenticate with Launchpad. * debian/control: Changed XS-Python-Version to >= 2.5. - * get-branches: Now check team option before anything else. [ Siegfried-Angel Gevatter Pujals ] * Add the GNU General Public License header to all scripts. diff --git a/get-branches b/get-branches index caccf23..28eaafb 100755 --- a/get-branches +++ b/get-branches @@ -118,12 +118,6 @@ def main(): print >> sys.stderr, "Perhaps invalid team name?" sys.exit(1) - try: - os.makedirs(team) - except: - pass - os.chdir(team) - branch_list_page = sock.read() sock.close() @@ -132,6 +126,18 @@ def main(): print "Downloading all branches for the team '%s'. This may take some " \ "time." % team + + # Check the team actually has branches. + if len(branch_page_urls) == 0: + print "The team '%s' does not have any branches on Launchpad." % team + os.rmdir(team) + sys.exit(0) + + try: + os.makedirs(team) + except: + pass + os.chdir(team) for url in branch_page_urls: sock = urllib2.urlopen("https://code.launchpad.net/%s" % url)