* get-branches: Check that the team has branches before downloading.

This commit is contained in:
Jonathan Patrick Davies 2008-08-12 00:09:01 +01:00
parent eab57aec28
commit 4a493b0c7a
2 changed files with 16 additions and 8 deletions

6
debian/changelog vendored
View File

@ -1,7 +1,10 @@
ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low ubuntu-dev-tools (0.37ubuntu1) intrepid; urgency=low
[ Jonathan Patrick Davies ] [ 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. * doc/get-branches.1: Created.
* hugdaylist: Improved argument and error handling. * hugdaylist: Improved argument and error handling.
* pull-lp-source: * 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 * requestsync: Use the functions in the common.py file above to authenticate
with Launchpad. with Launchpad.
* debian/control: Changed XS-Python-Version to >= 2.5. * debian/control: Changed XS-Python-Version to >= 2.5.
* get-branches: Now check team option before anything else.
[ Siegfried-Angel Gevatter Pujals ] [ Siegfried-Angel Gevatter Pujals ]
* Add the GNU General Public License header to all scripts. * Add the GNU General Public License header to all scripts.

View File

@ -118,12 +118,6 @@ def main():
print >> sys.stderr, "Perhaps invalid team name?" print >> sys.stderr, "Perhaps invalid team name?"
sys.exit(1) sys.exit(1)
try:
os.makedirs(team)
except:
pass
os.chdir(team)
branch_list_page = sock.read() branch_list_page = sock.read()
sock.close() sock.close()
@ -132,6 +126,18 @@ def main():
print "Downloading all branches for the team '%s'. This may take some " \ print "Downloading all branches for the team '%s'. This may take some " \
"time." % team "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: for url in branch_page_urls:
sock = urllib2.urlopen("https://code.launchpad.net/%s" % url) sock = urllib2.urlopen("https://code.launchpad.net/%s" % url)