Merge fixes from master
This commit is contained in:
commit
e6a933bdb7
@ -823,6 +823,7 @@ class GitView:
|
|||||||
self.colours = {}
|
self.colours = {}
|
||||||
self.nodepos = {}
|
self.nodepos = {}
|
||||||
self.incomplete_line = {}
|
self.incomplete_line = {}
|
||||||
|
self.commits = []
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
last_colour = 0
|
last_colour = 0
|
||||||
@ -840,12 +841,7 @@ class GitView:
|
|||||||
|
|
||||||
commit = Commit(commit_lines)
|
commit = Commit(commit_lines)
|
||||||
if (commit != None ):
|
if (commit != None ):
|
||||||
(out_line, last_colour, last_nodepos) = self.draw_graph(commit,
|
self.commits.append(commit)
|
||||||
index, out_line,
|
|
||||||
last_colour,
|
|
||||||
last_nodepos)
|
|
||||||
self.index[commit.commit_sha1] = index
|
|
||||||
index += 1
|
|
||||||
|
|
||||||
# Skip the '\0
|
# Skip the '\0
|
||||||
commit_lines = []
|
commit_lines = []
|
||||||
@ -854,6 +850,14 @@ class GitView:
|
|||||||
|
|
||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
|
for commit in self.commits:
|
||||||
|
(out_line, last_colour, last_nodepos) = self.draw_graph(commit,
|
||||||
|
index, out_line,
|
||||||
|
last_colour,
|
||||||
|
last_nodepos)
|
||||||
|
self.index[commit.commit_sha1] = index
|
||||||
|
index += 1
|
||||||
|
|
||||||
self.treeview.set_model(self.model)
|
self.treeview.set_model(self.model)
|
||||||
self.treeview.show()
|
self.treeview.show()
|
||||||
|
|
||||||
@ -869,13 +873,6 @@ class GitView:
|
|||||||
last_nodepos = 0
|
last_nodepos = 0
|
||||||
|
|
||||||
# Add the incomplete lines of the last cell in this
|
# Add the incomplete lines of the last cell in this
|
||||||
for sha1 in self.incomplete_line.keys():
|
|
||||||
if ( sha1 != commit.commit_sha1):
|
|
||||||
for pos in self.incomplete_line[sha1]:
|
|
||||||
in_line.append((pos, pos, self.colours[sha1]))
|
|
||||||
else:
|
|
||||||
del self.incomplete_line[sha1]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
colour = self.colours[commit.commit_sha1]
|
colour = self.colours[commit.commit_sha1]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -897,6 +894,14 @@ class GitView:
|
|||||||
self.colours[commit.parent_sha1[0]] = colour
|
self.colours[commit.parent_sha1[0]] = colour
|
||||||
self.nodepos[commit.parent_sha1[0]] = node_pos
|
self.nodepos[commit.parent_sha1[0]] = node_pos
|
||||||
|
|
||||||
|
for sha1 in self.incomplete_line.keys():
|
||||||
|
if ( sha1 != commit.commit_sha1):
|
||||||
|
self.draw_incomplete_line(sha1, node_pos,
|
||||||
|
out_line, in_line, index)
|
||||||
|
else:
|
||||||
|
del self.incomplete_line[sha1]
|
||||||
|
|
||||||
|
|
||||||
in_line.append((node_pos, self.nodepos[commit.parent_sha1[0]],
|
in_line.append((node_pos, self.nodepos[commit.parent_sha1[0]],
|
||||||
self.colours[commit.parent_sha1[0]]))
|
self.colours[commit.parent_sha1[0]]))
|
||||||
|
|
||||||
@ -936,6 +941,23 @@ class GitView:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
self.incomplete_line[sha1] = [self.nodepos[sha1]]
|
self.incomplete_line[sha1] = [self.nodepos[sha1]]
|
||||||
|
|
||||||
|
def draw_incomplete_line(self, sha1, node_pos, out_line, in_line, index):
|
||||||
|
for idx, pos in enumerate(self.incomplete_line[sha1]):
|
||||||
|
if(pos == node_pos):
|
||||||
|
out_line.append((pos,
|
||||||
|
pos+0.5, self.colours[sha1]))
|
||||||
|
self.incomplete_line[sha1][idx] = pos = pos+0.5
|
||||||
|
try:
|
||||||
|
next_commit = self.commits[index+1]
|
||||||
|
if (next_commit.commit_sha1 == sha1 and pos != int(pos)):
|
||||||
|
# join the line back to the node point
|
||||||
|
# This need to be done only if we modified it
|
||||||
|
in_line.append((pos, pos-0.5, self.colours[sha1]))
|
||||||
|
continue;
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
in_line.append((pos, pos, self.colours[sha1]))
|
||||||
|
|
||||||
|
|
||||||
def _go_clicked_cb(self, widget, revid):
|
def _go_clicked_cb(self, widget, revid):
|
||||||
"""Callback for when the go button for a parent is clicked."""
|
"""Callback for when the go button for a parent is clicked."""
|
||||||
|
@ -118,7 +118,7 @@ dir="$2"
|
|||||||
[ -e "$dir" ] && echo "$dir already exists." && usage
|
[ -e "$dir" ] && echo "$dir already exists." && usage
|
||||||
mkdir -p "$dir" &&
|
mkdir -p "$dir" &&
|
||||||
D=$(cd "$dir" && pwd) &&
|
D=$(cd "$dir" && pwd) &&
|
||||||
trap 'err=$?; rm -r $D; exit $err' exit
|
trap 'err=$?; cd ..; rm -r "$D"; exit $err' exit
|
||||||
case "$bare" in
|
case "$bare" in
|
||||||
yes) GIT_DIR="$D" ;;
|
yes) GIT_DIR="$D" ;;
|
||||||
*) GIT_DIR="$D/.git" ;;
|
*) GIT_DIR="$D/.git" ;;
|
||||||
|
@ -28,28 +28,13 @@ sub andjoin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub repoconfig {
|
sub repoconfig {
|
||||||
my $val;
|
my ($val) = qx{git-repo-config --get merge.summary};
|
||||||
eval {
|
|
||||||
my $pid = open(my $fh, '-|');
|
|
||||||
if (!$pid) {
|
|
||||||
exec('git-repo-config', '--get', 'merge.summary');
|
|
||||||
}
|
|
||||||
($val) = <$fh>;
|
|
||||||
close $fh;
|
|
||||||
};
|
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub current_branch {
|
sub current_branch {
|
||||||
my $fh;
|
my ($bra) = qx{git-symbolic-ref HEAD};
|
||||||
my $pid = open($fh, '-|');
|
|
||||||
die "$!" unless defined $pid;
|
|
||||||
if (!$pid) {
|
|
||||||
exec('git-symbolic-ref', 'HEAD') or die "$!";
|
|
||||||
}
|
|
||||||
my ($bra) = <$fh>;
|
|
||||||
chomp($bra);
|
chomp($bra);
|
||||||
close $fh or die "$!";
|
|
||||||
$bra =~ s|^refs/heads/||;
|
$bra =~ s|^refs/heads/||;
|
||||||
if ($bra ne 'master') {
|
if ($bra ne 'master') {
|
||||||
$bra = " into $bra";
|
$bra = " into $bra";
|
||||||
@ -61,18 +46,12 @@ sub current_branch {
|
|||||||
|
|
||||||
sub shortlog {
|
sub shortlog {
|
||||||
my ($tip) = @_;
|
my ($tip) = @_;
|
||||||
my ($fh, @result);
|
my @result;
|
||||||
my $pid = open($fh, '-|');
|
foreach ( qx{git-log --topo-order --pretty=oneline $tip ^HEAD} ) {
|
||||||
die "$!" unless defined $pid;
|
|
||||||
if (!$pid) {
|
|
||||||
exec('git-log', '--topo-order',
|
|
||||||
'--pretty=oneline', $tip, '^HEAD') or die "$!";
|
|
||||||
}
|
|
||||||
while (<$fh>) {
|
|
||||||
s/^[0-9a-f]{40}\s+//;
|
s/^[0-9a-f]{40}\s+//;
|
||||||
push @result, $_;
|
push @result, $_;
|
||||||
}
|
}
|
||||||
close $fh or die "$!";
|
die "git-log failed\n" if $?;
|
||||||
return @result;
|
return @result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user