diff options
| author | Anil Khatri <anil.soccer.khatri@gmail.com> | 2019-10-23 23:50:31 +0530 | 
|---|---|---|
| committer | Anil Khatri <anil.soccer.khatri@gmail.com> | 2019-10-23 23:50:31 +0530 | 
| commit | 1dc46d735003df8ff928974cb07545f69f8ea411 (patch) | |
| tree | b415d4dffe4d6aded124d2acafd16ab5a87e4941 /git/refs/log.py | |
| parent | 284f89d768080cb86e0d986bfa1dd503cfe6b682 (diff) | |
| download | gitpython-1dc46d735003df8ff928974cb07545f69f8ea411.tar.gz | |
resolved all minor issues arised by last fix patch
Diffstat (limited to 'git/refs/log.py')
| -rw-r--r-- | git/refs/log.py | 45 | 
1 files changed, 22 insertions, 23 deletions
diff --git a/git/refs/log.py b/git/refs/log.py index bc6d4486..74115145 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -46,13 +46,13 @@ class RefLogEntry(tuple):      def format(self):          """:return: a string suitable to be placed in a reflog file"""          act = self.actor -        time = self.time +        time_ = self.time_          return u"{} {} {} <{}> {!s} {}\t{}\n".format(self.oldhexsha,                                                       self.newhexsha,                                                       act.name,                                                       act.email, -                                                     time[0], -                                                     altz_to_utctz_str(time[1]), +                                                     time_[0], +                                                     altz_to_utctz_str(time_[1]),                                                       self.message)      @property @@ -71,7 +71,7 @@ class RefLogEntry(tuple):          return self[2]      @property -    def time(self): +    def time_(self):          """time as tuple:          * [0] = int(time) @@ -84,12 +84,12 @@ class RefLogEntry(tuple):          return self[4]      @classmethod -    def new(cls, oldhexsha, newhexsha, actor, time, tz_offset, message): +    def new(cls, oldhexsha, newhexsha, actor, time_, tz_offset, message):          """:return: New instance of a RefLogEntry"""          if not isinstance(actor, Actor):              raise ValueError("Need actor instance, got %s" % actor)          # END check types -        return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), message)) +        return RefLogEntry((oldhexsha, newhexsha, actor, (time_, tz_offset), message))      @classmethod      def from_line(cls, line): @@ -121,9 +121,9 @@ class RefLogEntry(tuple):          # END handle missing end brace          actor = Actor._from_string(info[82:email_end + 1]) -        time, tz_offset = parse_date(info[email_end + 2:]) +        time_, tz_offset = parse_date(info[email_end + 2:]) -        return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), msg)) +        return RefLogEntry((oldhexsha, newhexsha, actor, (time_, tz_offset), msg))  class RefLog(list, Serializable): @@ -220,21 +220,20 @@ class RefLog(list, Serializable):          with open(filepath, 'rb') as fp:              if index < 0:                  return RefLogEntry.from_line(fp.readlines()[index].strip()) -            else: -                # read until index is reached -                for i in xrange(index + 1): -                    line = fp.readline() -                    if not line: -                        break -                    # END abort on eof -                # END handle runup - -                if i != index or not line: # skipcq:PYL-W0631 -                    raise IndexError -                # END handle exception - -                return RefLogEntry.from_line(line.strip()) -            # END handle index +            # read until index is reached +            for i in xrange(index + 1): +                line = fp.readline() +                if not line: +                    break +                # END abort on eof +            # END handle runup + +            if i != index or not line:  # skipcq:PYL-W0631 +                raise IndexError +            # END handle exception + +            return RefLogEntry.from_line(line.strip()) +        # END handle index      def to_file(self, filepath):          """Write the contents of the reflog instance to a file at the given filepath.  | 
