Skip to content

Commit

Permalink
Merge pull request #69 from dl1ely/master
Browse files Browse the repository at this point in the history
Nicer handling of missing sections in .git/ftpdata file
  • Loading branch information
ezyang committed Jan 3, 2013
2 parents 87055ff + 3265c38 commit 6d0c8c0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions git-ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class FtpDataOldVersion(Exception):
class FtpSslNotSupported(Exception):
pass

class SectionNotFound(Exception):
pass

def main():
Git.git_binary = 'git' # Windows doesn't like env

Expand Down Expand Up @@ -196,9 +199,14 @@ def get_ftp_creds(repo, options):
logging.info("Using .git/ftpdata")
cfg.read(ftpdata)

if (not cfg.has_section(options.section)) and cfg.has_section('ftp'):
raise FtpDataOldVersion("Please rename the [ftp] section to [branch]. " +
"Take a look at the README for more information")
if (not cfg.has_section(options.section)):
if cfg.has_section('ftp'):
raise FtpDataOldVersion("Please rename the [ftp] section to [branch]. " +
"Take a look at the README for more information")
else:
raise SectionNotFound("Your .git/ftpdata file does not contain a section " +
"named '%s'" % options.section)


# just in case you do not want to store your ftp password.
try:
Expand Down

0 comments on commit 6d0c8c0

Please sign in to comment.