@@ -25,8 +25,9 @@ def __init__(self):
2525 self .trimmed = False
2626 self .prevRef = None
2727 self .topref = None
28- self .numCommits = settings .commits
29- self .defaultNumCommits = settings .commits
28+ self .n_default = settings .n_default
29+ self .n = settings .n
30+ self .n_orig = self .n
3031 self .selected_branches = []
3132 self .stop = False
3233 self .zone_title_offset = 2.6 if platform .system () == "Windows" else 2.6
@@ -50,9 +51,9 @@ def construct(self):
5051 self .show_outro ()
5152
5253 def get_commits (self , start = "HEAD" ):
53- if not self .numCommits :
54+ if not self .n :
5455 if settings .allow_no_commits :
55- self .numCommits = self .defaultNumCommits
56+ self .n = self .n_default
5657 self .commits = ["dark" ] * 5
5758 self .zone_title_offset = 2
5859 return
@@ -63,29 +64,27 @@ def get_commits(self, start="HEAD"):
6364 try :
6465 self .commits = (
6566 list (self .repo .iter_commits (start ))
66- if self .numCommits == 1
67+ if self .n == 1
6768 else list (
68- self .repo .iter_commits (
69- start + "~" + str (self .numCommits ) + "..." + start
70- )
69+ self .repo .iter_commits (start + "~" + str (self .n ) + "..." + start )
7170 )
7271 )
73- if len (self .commits ) < self .defaultNumCommits :
72+ if len (self .commits ) < self .n_default :
7473 self .commits = list (self .repo .iter_commits (start ))
75- while len (self .commits ) < self .defaultNumCommits :
74+ while len (self .commits ) < self .n_default :
7675 self .commits .append (self .create_dark_commit ())
77- self .numCommits = self .defaultNumCommits
76+ self .n = self .n_orig
7877
7978 except GitCommandError :
80- self .numCommits -= 1
79+ self .n -= 1
8180 self .get_commits (start = start )
8281
8382 def parse_commits (
8483 self , commit , i , prevCircle = None , shift = numpy .array ([0.0 , 0.0 , 0.0 ])
8584 ):
8685 isNewCommit = commit .hexsha not in self .drawnCommits
8786
88- if i < self .numCommits and commit in self .commits :
87+ if i < self .n and commit in self .commits :
8988 commitId , circle , arrow , hide_refs = self .draw_commit (
9089 commit , i , prevCircle , shift
9190 )
@@ -113,7 +112,7 @@ def parse_commits(
113112 if i == 0 and len (self .drawnRefs ) < 2 :
114113 self .draw_dark_ref ()
115114
116- if i < self .numCommits : # len(self.commits) - 1 :
115+ if i < self .n :
117116 i += 1
118117 commitParents = list (commit .parents )
119118 if len (commitParents ) > 0 :
0 commit comments