Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Models/Commit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public bool IsHighlightedInGraph
public bool IsCommitterVisible => !Author.Equals(Committer) || AuthorTime != CommitterTime;
public bool IsCurrentHead => Decorators.Find(x => x.Type is DecoratorType.CurrentBranchHead or DecoratorType.CurrentCommitHead) != null;
public bool HasDecorators => Decorators.Count > 0;
public virtual bool IsLocalChanges => false;
public string FirstParentToCompare => Parents.Count > 0 ? $"{SHA}^" : EmptyTreeHash.Guess(SHA);

public string GetFriendlyName()
Expand Down
28 changes: 27 additions & 1 deletion src/Models/CommitGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class Path(int color, bool isHighlighted)
public List<Point> Points { get; } = [];
public int Color { get; } = color;
public bool IsHighlighted { get; } = isHighlighted;
public bool IsDashed { get; set; } = false;
}

public class Link
Expand All @@ -57,6 +58,7 @@ public enum DotType
Default,
Head,
Merge,
LocalChanges,
}

public class Dot
Expand Down Expand Up @@ -110,6 +112,13 @@ public static CommitGraph Generate(List<Commit> commits, bool firstParentOnlyEna
{
major.Next = commit.Parents[0];
major.Goto(offsetX, offsetY, halfHeight);

// The link from local changes to HEAD is dashed, but the rest of this branch is not.
if (major.Path.IsDashed)
{
major.Detach();
temp.Paths.Add(major.Path);
}
}
else
{
Expand Down Expand Up @@ -185,6 +194,7 @@ public static CommitGraph Generate(List<Commit> commits, bool firstParentOnlyEna
if (commit.Parents.Count > 0)
{
major = new PathHelper(commit.Parents[0], isHighlighted, colorPicker.Next(), new Point(offsetX, offsetY));
major.Path.IsDashed = commit.IsLocalChanges;
unsolved.Add(major);
temp.Paths.Add(major.Path);
}
Expand All @@ -199,7 +209,9 @@ public static CommitGraph Generate(List<Commit> commits, bool firstParentOnlyEna
var position = new Point(major?.LastX ?? offsetX, offsetY);
var dotColor = major?.Path.Color ?? 0;
var anchor = new Dot() { Center = position, Color = dotColor, IsHighlighted = isHighlighted };
if (commit.IsCurrentHead)
if (commit.IsLocalChanges)
anchor.Type = DotType.LocalChanges;
else if (commit.IsCurrentHead)
anchor.Type = DotType.Head;
else if (commit.Parents.Count > 1)
anchor.Type = DotType.Merge;
Expand Down Expand Up @@ -406,6 +418,20 @@ public void Highlight()
_endY = 0;
}

/// <summary>
/// End the current path and continue with a new one (with the same color and highlighted state) from the end.
/// </summary>
public void Detach()
{
var color = Path.Color;
var isHighlighted = Path.IsHighlighted;
Add(LastX, _lastY);

Path = new Path(color, isHighlighted);
Path.Points.Add(new Point(LastX, _lastY));
_endY = 0;
}

private void Add(double x, double y)
{
if (_endY < y)
Expand Down
34 changes: 34 additions & 0 deletions src/Models/LocalChangesNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace SourceGit.Models
{
/// <summary>
/// Pseudo commit used to display local changes as a node (not yet attached) in the commit graph.
/// </summary>
public class LocalChangesNode : Commit
{
public const string NodeSHA = "LOCALCHANGES0000000000000000000000000000";

public override bool IsLocalChanges => true;

public int Count
{
get => _count;
set
{
if (SetProperty(ref _count, value))
{
// The localized label is provided by view (so it follows locale changes), subject only holds the count.
Subject = $"({value})";
OnPropertyChanged(nameof(Subject));
}
}
}

public LocalChangesNode()
{
SHA = NodeSHA;
IsMerged = true;
}

private int _count = 0;
}
}
3 changes: 3 additions & 0 deletions src/Resources/Locales/ca_ES.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Branca actual i comissions seleccionades</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Només les comissions seleccionades</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnlyFirstParent" xml:space="preserve">Comissions seleccionades (només el primer pare)</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Canvis locals</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Obre a la pàgina de canvis locals</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">{0} COMISSIONS SELECCIONADES</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">MOSTRA LES COLUMNES</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Mantingueu premuda «Ctrl» o «Maj» per seleccionar diverses comissions.</x:String>
Expand Down Expand Up @@ -852,6 +854,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Només comissions decorades</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Només el primer pare</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">MOSTRA ELS INDICADORS</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Canvis locals com a node del gràfic</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Mostra les comissions perdudes</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Mostra els submòduls com a arbre</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Mostra les etiquetes com a arbre</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/de_DE.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ $1, $2, … Werte der Eingabe-Steuerelemente</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchOnly" xml:space="preserve">Nur aktueller Branch</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Aktueller Branch &amp; ausgewählte Commits</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Nur ausgewählte Commits</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Lokale Änderungen</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Auf der Seite Änderungen öffnen</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">{0} COMMITS AUSGEWÄHLT</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">SPALTEN ANZEIGEN</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Halte ‚Strg‘ oder ‚Umschalt‘, um mehrere Commits auszuwählen.</x:String>
Expand Down Expand Up @@ -821,6 +823,7 @@ $1, $2, … Werte der Eingabe-Steuerelemente</x:String>
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Nur dekorierte Commits</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Nur ersten Vorgänger anzeigen</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">ANZEIGE-FLAGS</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Lokale Änderungen als Knoten im Graph</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Verlorene Commits anzeigen</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Zeige Submodule als Baumstruktur</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Zeige Tags als Baumstruktur</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/el_GR.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchOnly" xml:space="preserve">Μόνο ο τρέχων κλάδος</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Τρέχων κλάδος &amp; επιλεγμένα commits</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Μόνο τα επιλεγμένα commits</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Τοπικές αλλαγές</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Άνοιγμα στη σελίδα τοπικών αλλαγών</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">ΕΠΙΛΕΓΜΕΝΑ {0} COMMITS</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">ΕΜΦΑΝΙΣΗ ΣΤΗΛΩΝ</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Κρατήστε 'Ctrl' ή 'Shift' για να επιλέξετε πολλαπλά commits.</x:String>
Expand Down Expand Up @@ -817,6 +819,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Μόνο commits με αναφορές</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Μόνο πρώτος γονέας</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">ΕΜΦΑΝΙΣΗ ΣΗΜΑΙΩΝ</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Τοπικές αλλαγές ως κόμβος στο γράφημα</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Εμφάνιση χαμένων commits</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Εμφάνιση υπομονάδων ως δέντρο</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Εμφάνιση ετικετών ως δέντρο</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/en_US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Current Branch &amp; Selected Commits</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Selected Commits Only</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnlyFirstParent" xml:space="preserve">Selected Commits (First-parent Only)</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Local changes</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Open in Local Changes page</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">SELECTED {0} COMMITS</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">SHOW COLUMNS</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Hold 'Ctrl' or 'Shift' to select multiple commits.</x:String>
Expand Down Expand Up @@ -855,6 +857,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Decorated commits only</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">First-parent only</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">SHOW FLAGS</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Local changes as graph node</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Show lost commits</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Show Submodules as Tree</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Show Tags as Tree</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/es_ES.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Rama Actual y los Commits Seleccionados</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Solo los Commits Seleccionados</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnlyFirstParent" xml:space="preserve">Commits seleccionados (Solamente el primer padre)</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Cambios locales</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Abrir en la página de cambios</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">{0} COMMITS SELECCIONADOS</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">MOSTRAR COLUMNAS</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Mantén 'Ctrl' o 'Shift' para seleccionar múltiples commits.</x:String>
Expand Down Expand Up @@ -851,6 +853,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Sólo los commits decorados</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Mostrar sólo el primer padre</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">MOSTRAR FLAGS</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Cambios locales como nodo del gráfico</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Mostrar commits perdidos</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Mostrar Submódulos como Árbol</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Mostrar Etiquetas como Árbol</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/fr_FR.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchOnly" xml:space="preserve">Branche courante uniquement</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Branche courante et commits sélectionnés</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Commits sélectionnés uniquement</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Changements locaux</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Ouvrir dans la page Changements</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">{0} COMMITS SÉLECTIONNÉS</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">AFFICHER LES COLONNES</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Maintenir 'Ctrl' ou 'Shift' enfoncée pour sélectionner plusieurs commits.</x:String>
Expand Down Expand Up @@ -781,6 +783,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Commits décorés uniquement</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Premier parent uniquement</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">AFFICHER LES FLAGS</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Changements locaux comme nœud du graphe</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Afficher les commits perdus</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Afficher les sous-modules en tant qu'arbre</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Voir les Tags en tant qu'arbre</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/he_IL.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchOnly" xml:space="preserve">ה־Branch הנוכחי בלבד</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">ה־Branch הנוכחי ו־Commits שנבחרו</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Commits שנבחרו בלבד</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">שינויים מקומיים</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">פתח בעמוד השינויים המקומיים</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">נבחרו {0} COMMITS</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">הצג עמודות</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">החזק 'Ctrl' או 'Shift' לבחירת מספר commits.</x:String>
Expand Down Expand Up @@ -781,6 +783,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Commits מעוטרים בלבד</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">First-parent בלבד</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">הצג דגלים</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">שינויים מקומיים כצומת בגרף</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">הצג commits אבודים</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">הצג Submodules כעץ</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">הצג Tags כעץ</x:String>
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/Locales/id_ID.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchOnly" xml:space="preserve">Hanya Branch Saat Ini</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.CurrentBranchAndSelectedCommits" xml:space="preserve">Branch Saat Ini &amp; Commit Terpilih</x:String>
<x:String x:Key="Text.Histories.HighlightsInGraph.SelectedCommitsOnly" xml:space="preserve">Hanya Commit Terpilih</x:String>
<x:String x:Key="Text.Histories.LocalChanges" xml:space="preserve">Perubahan lokal</x:String>
<x:String x:Key="Text.Histories.LocalChanges.OpenPage" xml:space="preserve">Buka di halaman Perubahan Lokal</x:String>
<x:String x:Key="Text.Histories.Selected" xml:space="preserve">DIPILIH {0} COMMIT</x:String>
<x:String x:Key="Text.Histories.ShowColumns" xml:space="preserve">TAMPILKAN KOLOM</x:String>
<x:String x:Key="Text.Histories.Tips" xml:space="preserve">Tahan 'Ctrl' atau 'Shift' untuk memilih beberapa commit.</x:String>
Expand Down Expand Up @@ -822,6 +824,7 @@
<x:String x:Key="Text.Repository.ShowDecoratedCommitsOnly" xml:space="preserve">Hanya commit yang didekorasi</x:String>
<x:String x:Key="Text.Repository.ShowFirstParentOnly" xml:space="preserve">Hanya first-parent</x:String>
<x:String x:Key="Text.Repository.ShowFlags" xml:space="preserve">TAMPILKAN FLAG</x:String>
<x:String x:Key="Text.Repository.ShowLocalChangesInGraph" xml:space="preserve">Perubahan lokal sebagai node grafik</x:String>
<x:String x:Key="Text.Repository.ShowLostCommits" xml:space="preserve">Tampilkan commit yang hilang</x:String>
<x:String x:Key="Text.Repository.ShowSubmodulesAsTree" xml:space="preserve">Tampilkan Submodule sebagai Pohon</x:String>
<x:String x:Key="Text.Repository.ShowTagsAsTree" xml:space="preserve">Tampilkan Tag sebagai Pohon</x:String>
Expand Down
Loading