comparison treepkg/git.py @ 545:991bc01ae668

log used git repo and branch
author Bjoern Ricks <bricks@intevation.de>
date Wed, 02 Feb 2011 09:51:09 +0000
parents 8b49548aa8d4
children 149d18aca4f7
comparison
equal deleted inserted replaced
544:822a4d31efda 545:991bc01ae668
102 def update_or_checkout(self, revision=0): 102 def update_or_checkout(self, revision=0):
103 """Updates the working copy or creates by checking out the repository. 103 """Updates the working copy or creates by checking out the repository.
104 Revision number included for compatibility 104 Revision number included for compatibility
105 """ 105 """
106 gitdir = os.path.join(self.localdir, ".git") 106 gitdir = os.path.join(self.localdir, ".git")
107 branch = self.repository.branch
108 if not branch:
109 branch = "master"
107 if os.path.exists(gitdir): 110 if os.path.exists(gitdir):
108 self.log_info("Updating the working copy in %r", self.localdir) 111 self.log_info("Updating the working copy in %r for repo " \
112 "%s and branch %s", self.localdir,
113 self.repository.repository,
114 branch)
109 update(self.localdir, self.repository.branch) 115 update(self.localdir, self.repository.branch)
110 else: 116 else:
111 # TODO: better check if localdir contains files 117 # TODO: better check if localdir contains files
112 if os.path.exists(self.localdir): 118 if os.path.exists(self.localdir):
113 raise GitError("Working copy dir %s already exists. " \ 119 raise GitError("Working copy dir %s already exists. " \
114 " files. Can't checkout from %s" % (self.localdir, 120 " files. Can't checkout from %s" % (self.localdir,
115 self.repository.url)) 121 self.repository.url))
116 self.log_info("The working copy in %r doesn't exist yet." 122 self.log_info("The working copy in %r doesn't exist yet."
117 " Checking out from %r", 123 " Checking out branch %s from %r",
118 self.localdir, self.repository.url) 124 self.localdir, branch, self.repository.url)
119 self.repository.checkout(self.localdir) 125 self.repository.checkout(self.localdir)
120 126
121 def export(self, destdir): 127 def export(self, destdir):
122 """Exports the working copy to destdir""" 128 """Exports the working copy to destdir"""
123 self.repository.export(self.localdir, destdir) 129 self.repository.export(self.localdir, destdir)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)