return self.__get_field('authname')
def set_authname(self, name):
- if not name:
- if config.has_option('stgit', 'authname'):
- name = config.get('stgit', 'authname')
- elif 'GIT_AUTHOR_NAME' in os.environ:
- name = os.environ['GIT_AUTHOR_NAME']
- self.__set_field('authname', name)
+ self.__set_field('authname', name or git.author().name)
def get_authemail(self):
return self.__get_field('authemail')
- def set_authemail(self, address):
- if not address:
- if config.has_option('stgit', 'authemail'):
- address = config.get('stgit', 'authemail')
- elif 'GIT_AUTHOR_EMAIL' in os.environ:
- address = os.environ['GIT_AUTHOR_EMAIL']
- self.__set_field('authemail', address)
+ def set_authemail(self, email):
+ self.__set_field('authemail', email or git.author().email)
def get_authdate(self):
return self.__get_field('authdate')
def set_authdate(self, date):
- if not date and 'GIT_AUTHOR_DATE' in os.environ:
- date = os.environ['GIT_AUTHOR_DATE']
- self.__set_field('authdate', date)
+ self.__set_field('authdate', date or git.author().date)
def get_commname(self):
return self.__get_field('commname')
def set_commname(self, name):
- if not name:
- if config.has_option('stgit', 'commname'):
- name = config.get('stgit', 'commname')
- elif 'GIT_COMMITTER_NAME' in os.environ:
- name = os.environ['GIT_COMMITTER_NAME']
- self.__set_field('commname', name)
+ self.__set_field('commname', name or git.committer().name)
def get_commemail(self):
return self.__get_field('commemail')
- def set_commemail(self, address):
- if not address:
- if config.has_option('stgit', 'commemail'):
- address = config.get('stgit', 'commemail')
- elif 'GIT_COMMITTER_EMAIL' in os.environ:
- address = os.environ['GIT_COMMITTER_EMAIL']
- self.__set_field('commemail', address)
+ def set_commemail(self, email):
+ self.__set_field('commemail', email or git.committer().email)
def get_log(self):
return self.__get_field('log')
def __patch_is_current(self, patch):
return patch.get_name() == read_string(self.__current_file)
- def __patch_applied(self, name):
+ def patch_applied(self, name):
"""Return true if the patch exists in the applied list
"""
return name in self.get_applied()
- def __patch_unapplied(self, name):
+ def patch_unapplied(self, name):
"""Return true if the patch exists in the unapplied list
"""
return name in self.get_unapplied()
def patch_exists(self, name):
"""Return true if there is a patch with the given name, false
otherwise."""
- return self.__patch_applied(name) or self.__patch_applied(name)
+ return self.patch_applied(name) or self.patch_unapplied(name)
def __begin_stack_check(self):
"""Save the current HEAD into .git/refs/heads/base if the stack
before_existing = False, refresh = True):
"""Creates a new patch
"""
- if self.__patch_applied(name) or self.__patch_unapplied(name):
+ if self.patch_applied(name) or self.patch_unapplied(name):
raise StackException, 'Patch "%s" already exists' % name
if not message and can_edit:
if self.__patch_is_current(patch):
self.pop_patch(name)
- elif self.__patch_applied(name):
+ elif self.patch_applied(name):
raise StackException, 'Cannot remove an applied patch, "%s", ' \
'which is not current' % name
elif not name in self.get_unapplied():