2024-07-22 23:52:25 -07:00
|
|
|
|
using Avalonia.Collections;
|
|
|
|
|
|
|
|
|
|
namespace SourceGit.Models
|
|
|
|
|
{
|
|
|
|
|
public class RepositorySettings
|
|
|
|
|
{
|
2024-10-02 00:13:27 -07:00
|
|
|
|
public string DefaultRemote
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = string.Empty;
|
2024-10-14 18:39:01 -07:00
|
|
|
|
|
2024-07-22 23:52:25 -07:00
|
|
|
|
public DealWithLocalChanges DealWithLocalChangesOnCheckoutBranch
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = DealWithLocalChanges.DoNothing;
|
|
|
|
|
|
2024-10-30 03:39:38 -07:00
|
|
|
|
public bool EnablePruneOnFetch
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
2024-07-22 23:52:25 -07:00
|
|
|
|
public bool FetchWithoutTags
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
|
|
|
|
public DealWithLocalChanges DealWithLocalChangesOnPull
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = DealWithLocalChanges.DoNothing;
|
|
|
|
|
|
|
|
|
|
public bool PreferRebaseInsteadOfMerge
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = true;
|
|
|
|
|
|
|
|
|
|
public bool FetchWithoutTagsOnPull
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
2024-07-27 02:52:01 -07:00
|
|
|
|
public bool FetchAllBranchesOnPull
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
2024-07-27 05:35:19 -07:00
|
|
|
|
} = true;
|
2024-07-27 02:52:01 -07:00
|
|
|
|
|
2024-08-20 00:20:58 -07:00
|
|
|
|
public bool CheckSubmodulesOnPush
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = true;
|
|
|
|
|
|
2024-07-22 23:52:25 -07:00
|
|
|
|
public bool PushAllTags
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
|
|
|
|
public DealWithLocalChanges DealWithLocalChangesOnCreateBranch
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = DealWithLocalChanges.DoNothing;
|
|
|
|
|
|
|
|
|
|
public bool CheckoutBranchOnCreateBranch
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = true;
|
|
|
|
|
|
|
|
|
|
public AvaloniaList<string> Filters
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = new AvaloniaList<string>();
|
|
|
|
|
|
2024-08-15 03:59:35 -07:00
|
|
|
|
public AvaloniaList<CommitTemplate> CommitTemplates
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = new AvaloniaList<CommitTemplate>();
|
|
|
|
|
|
2024-07-22 23:52:25 -07:00
|
|
|
|
public AvaloniaList<string> CommitMessages
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = new AvaloniaList<string>();
|
|
|
|
|
|
2024-08-05 03:18:57 -07:00
|
|
|
|
public AvaloniaList<IssueTrackerRule> IssueTrackerRules
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = new AvaloniaList<IssueTrackerRule>();
|
|
|
|
|
|
2024-11-01 02:23:31 -07:00
|
|
|
|
public AvaloniaList<CustomAction> CustomActions
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = new AvaloniaList<CustomAction>();
|
|
|
|
|
|
2024-09-25 19:50:21 -07:00
|
|
|
|
public bool EnableAutoFetch
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
|
|
|
|
public int AutoFetchInterval
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = 10;
|
|
|
|
|
|
2024-10-22 18:45:52 -07:00
|
|
|
|
public bool EnableSignOffForCommit
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
2024-10-28 02:55:32 -07:00
|
|
|
|
public bool IncludeUntrackedWhenStash
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = true;
|
|
|
|
|
|
|
|
|
|
public bool OnlyStagedWhenStash
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
|
|
|
|
public bool KeepIndexWhenStash
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = false;
|
|
|
|
|
|
2024-10-28 06:31:40 -07:00
|
|
|
|
public string PreferedOpenAIService
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
} = "---";
|
|
|
|
|
|
2024-07-22 23:52:25 -07:00
|
|
|
|
public void PushCommitMessage(string message)
|
|
|
|
|
{
|
|
|
|
|
var existIdx = CommitMessages.IndexOf(message);
|
|
|
|
|
if (existIdx == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (existIdx > 0)
|
|
|
|
|
{
|
|
|
|
|
CommitMessages.Move(existIdx, 0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CommitMessages.Count > 9)
|
|
|
|
|
CommitMessages.RemoveRange(9, CommitMessages.Count - 9);
|
|
|
|
|
|
|
|
|
|
CommitMessages.Insert(0, message);
|
|
|
|
|
}
|
2024-08-05 03:18:57 -07:00
|
|
|
|
|
|
|
|
|
public IssueTrackerRule AddNewIssueTracker()
|
|
|
|
|
{
|
|
|
|
|
var rule = new IssueTrackerRule()
|
|
|
|
|
{
|
|
|
|
|
Name = "New Issue Tracker",
|
|
|
|
|
RegexString = "#(\\d+)",
|
|
|
|
|
URLTemplate = "https://xxx/$1",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IssueTrackerRules.Add(rule);
|
|
|
|
|
return rule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IssueTrackerRule AddGithubIssueTracker(string repoURL)
|
|
|
|
|
{
|
|
|
|
|
var rule = new IssueTrackerRule()
|
|
|
|
|
{
|
|
|
|
|
Name = "Github ISSUE",
|
|
|
|
|
RegexString = "#(\\d+)",
|
|
|
|
|
URLTemplate = string.IsNullOrEmpty(repoURL) ? "https://github.com/username/repository/issues/$1" : $"{repoURL}/issues/$1",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IssueTrackerRules.Add(rule);
|
|
|
|
|
return rule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IssueTrackerRule AddJiraIssueTracker()
|
|
|
|
|
{
|
|
|
|
|
var rule = new IssueTrackerRule()
|
|
|
|
|
{
|
|
|
|
|
Name = "Jira Tracker",
|
|
|
|
|
RegexString = "PROJ-(\\d+)",
|
|
|
|
|
URLTemplate = "https://jira.yourcompany.com/browse/PROJ-$1",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IssueTrackerRules.Add(rule);
|
|
|
|
|
return rule;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-24 03:07:04 -07:00
|
|
|
|
public IssueTrackerRule AddGitLabIssueTracker(string repoURL)
|
|
|
|
|
{
|
|
|
|
|
var rule = new IssueTrackerRule()
|
|
|
|
|
{
|
|
|
|
|
Name = "GitLab ISSUE",
|
|
|
|
|
RegexString = "#(\\d+)",
|
|
|
|
|
URLTemplate = string.IsNullOrEmpty(repoURL) ? "https://gitlab.com/username/repository/-/issues/$1" : $"{repoURL}/-/issues/$1",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IssueTrackerRules.Add(rule);
|
|
|
|
|
return rule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IssueTrackerRule AddGitLabMergeRequestTracker(string repoURL)
|
|
|
|
|
{
|
|
|
|
|
var rule = new IssueTrackerRule()
|
|
|
|
|
{
|
|
|
|
|
Name = "GitLab MR",
|
|
|
|
|
RegexString = "!(\\d+)",
|
|
|
|
|
URLTemplate = string.IsNullOrEmpty(repoURL) ? "https://gitlab.com/username/repository/-/merge_requests/$1" : $"{repoURL}/-/merge_requests/$1",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
IssueTrackerRules.Add(rule);
|
|
|
|
|
return rule;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-05 03:18:57 -07:00
|
|
|
|
public void RemoveIssueTracker(IssueTrackerRule rule)
|
|
|
|
|
{
|
|
|
|
|
if (rule != null)
|
|
|
|
|
IssueTrackerRules.Remove(rule);
|
|
|
|
|
}
|
2024-11-01 02:23:31 -07:00
|
|
|
|
|
|
|
|
|
public CustomAction AddNewCustomAction()
|
|
|
|
|
{
|
|
|
|
|
var act = new CustomAction()
|
|
|
|
|
{
|
|
|
|
|
Name = "Unnamed Custom Action",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CustomActions.Add(act);
|
|
|
|
|
return act;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RemoveCustomAction(CustomAction act)
|
|
|
|
|
{
|
|
|
|
|
if (act != null)
|
|
|
|
|
CustomActions.Remove(act);
|
|
|
|
|
}
|
2024-07-22 23:52:25 -07:00
|
|
|
|
}
|
|
|
|
|
}
|