Skip to content

Commit

Permalink
Merge branch 'master' into FIX_NavigateView
Browse files Browse the repository at this point in the history
Conflicts:
	GitUI/CommandsDialogs/BrowseDialog/FormBrowseMenuCommands.cs
	GitUI/UserControls/RevisionGrid.Designer.cs
	GitUI/UserControls/RevisionGrid.cs
  • Loading branch information
australiensun committed Jul 7, 2013
2 parents a05feae + 46eec04 commit 730a1dd
Show file tree
Hide file tree
Showing 76 changed files with 1,888 additions and 1,371 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ GitCommandsTests/test-results/*
GitExtensionsMono.sln.VisualState.xml
TestResult.xml
libgit2sharp
Setup/GitExtensions/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
Expand Down
22 changes: 3 additions & 19 deletions .nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<PropertyGroup>
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
Expand Down Expand Up @@ -82,21 +76,11 @@
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
<Exec Command="$(RestoreCommand)" Condition="Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
<Exec Command="$(BuildCommand)" />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
Expand Down
4 changes: 4 additions & 0 deletions .nuget/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="7-Zip.CommandLine" version="9.20.0" />
</packages>
4 changes: 2 additions & 2 deletions CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.46")]
[assembly: AssemblyFileVersion("2.46")]
[assembly: AssemblyVersion("2.48")]
[assembly: AssemblyFileVersion("2.48")]
19 changes: 16 additions & 3 deletions GitCommands/Config/ConfigFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ private void Load()
}

public static readonly char[] CommentChars = new char[] { ';', '#' };

public void LoadFromString(string str)
{
ConfigFileParser parser = new ConfigFileParser(this);
parser.Parse(str);
}


public static string EscapeValue(string value)
{
Expand Down Expand Up @@ -116,6 +123,11 @@ public void Save()
}
}

public IEnumerable<ConfigSection> GetConfigSections(string sectionName)
{
return ConfigSections.Where(section => section.SectionName.Equals(sectionName, StringComparison.OrdinalIgnoreCase));
}

private void SetStringValue(string setting, string value)
{
var keyIndex = FindAndCheckKeyIndex(setting);
Expand Down Expand Up @@ -273,12 +285,13 @@ private class ConfigFileParser

public ConfigFileParser(ConfigFile configFile)
{
_configFile = configFile;
_fileContent = File.ReadAllText(FileName, ConfigFile.GetEncoding());
_configFile = configFile;
}

public void Parse()
public void Parse(string aFileContent = null)
{
_fileContent = aFileContent ?? File.ReadAllText(FileName, ConfigFile.GetEncoding());

ParsePart parseFunc = ReadUnknown;

for (pos = 0; pos < _fileContent.Length; pos++)
Expand Down
56 changes: 17 additions & 39 deletions GitCommands/Git/GitCommandHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ public enum IgnoreSubmodulesMode

public static class GitCommandHelpers
{
public static void SetEnvironmentVariable()
{
SetEnvironmentVariable(false);
}

public static void SetEnvironmentVariable(bool reload)
public static void SetEnvironmentVariable(bool reload = false)
{
string path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
if (!string.IsNullOrEmpty(Settings.GitBinDir) && !path.Contains(Settings.GitBinDir))
Expand Down Expand Up @@ -117,7 +112,7 @@ private static string WindowsDefaultHomeDir
}
}

public static string FixPath(string path)
public static string FixPath([NotNull] string path)
{
path = path.Trim();
return path.Replace('\\', '/');
Expand Down Expand Up @@ -193,7 +188,6 @@ internal static int CreateAndStartProcess(string arguments, string cmd, string w

process.WaitForExit();

startInfo = null;
return process.ExitCode;
}
}
Expand Down Expand Up @@ -234,7 +228,7 @@ internal static int CreateAndStartProcess(string arguments, string cmd, string w
}
}

internal static IEnumerable<string> CreateAndStartProcessAsync(string arguments, string cmd, string workDir, string stdInput, Encoding encoding)
internal static IEnumerable<string> CreateAndStartProcessAsync(string arguments, string cmd, string workDir, string stdInput)
{
if (string.IsNullOrEmpty(cmd))
yield break;
Expand All @@ -253,11 +247,9 @@ internal static IEnumerable<string> CreateAndStartProcessAsync(string arguments,
process.StartInfo.WorkingDirectory = workDir;
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.StartInfo.LoadUserProfile = true;
process.StartInfo.StandardOutputEncoding = encoding;
process.StartInfo.StandardErrorEncoding = encoding;
process.Start();

string line = null;
string line;
do
{
line = process.StandardOutput.ReadLine();
Expand Down Expand Up @@ -319,8 +311,8 @@ public static GitVersion VersionInUse

public static string CherryPickCmd(string cherry, bool commit, string arguments)
{
string CherryPickCmd = commit ? "cherry-pick" : "cherry-pick --no-commit";
return CherryPickCmd + " " + arguments + " \"" + cherry + "\"";
string cherryPickCmd = commit ? "cherry-pick" : "cherry-pick --no-commit";
return cherryPickCmd + " " + arguments + " \"" + cherry + "\"";
}

public static string GetFullBranchName(string branch)
Expand Down Expand Up @@ -489,9 +481,9 @@ public static string CreateOrphanCmd(string newBranchName, string startPoint = n
/// <param name="files">Files to remove. Fileglobs can be given to remove matching files.</param>
public static string RemoveCmd(bool force = true, bool isRecursive = true, params string[] files)
{
string file = files.Any()
? string.Join(" ", files)
: ".";
string file = ".";
if (files.Any())
file = string.Join(" ", files);

return string.Format("rm {0} {1} {2}",
force ? "--force" : string.Empty,
Expand Down Expand Up @@ -600,12 +592,7 @@ public static string PushMultipleCmd(string path, IEnumerable<GitPushAction> pus
return cmd;
}

public static string PushTagCmd(string path, string tag, bool all)
{
return PushTagCmd(path, tag, all, false);
}

public static string PushTagCmd(string path, string tag, bool all, bool force)
public static string PushTagCmd(string path, string tag, bool all, bool force = false)
{
path = FixPath(path);

Expand Down Expand Up @@ -940,15 +927,10 @@ public static GitSubmoduleStatus GetSubmoduleStatus(string text)
return status;
}

public static List<GitItemStatus> GetAllChangedFilesFromString(GitModule module, string statusString)
{
return GetAllChangedFilesFromString(module, statusString, false);
}

/*
source: C:\Program Files\msysgit\doc\git\html\git-status.html
*/
public static List<GitItemStatus> GetAllChangedFilesFromString(GitModule module, string statusString, bool fromDiff /*old name and new name are switched.. %^&#^% */)
public static List<GitItemStatus> GetAllChangedFilesFromString(GitModule module, string statusString, bool fromDiff = false)
{
var diffFiles = new List<GitItemStatus>();

Expand All @@ -961,7 +943,7 @@ public static List<GitItemStatus> GetAllChangedFilesFromString(GitModule module,
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in FxCop.targets.
The file will have its original line endings in your working directory.*/
var nl = new char[] { '\n', '\r' };
var nl = new[] { '\n', '\r' };
string trimmedStatus = statusString.Trim(nl);
int lastNewLinePos = trimmedStatus.LastIndexOfAny(nl);
if (lastNewLinePos > 0)
Expand Down Expand Up @@ -1026,7 +1008,7 @@ The file will have its original line endings in your working directory.*/

if (fromDiff || y == ' ')
continue;
GitItemStatus gitItemStatusY = null;
GitItemStatus gitItemStatusY;
if (y == 'R' || y == 'C') // Find renamed files...
{
string nextfile = n + 1 < files.Length ? files[n + 1] : "";
Expand Down Expand Up @@ -1275,9 +1257,10 @@ private static DateTime RoundDateTime(DateTime dateTime)
/// </summary>
/// <param name="originDate">Current date.</param>
/// <param name="previousDate">The date to get relative time string for.</param>
/// <param name="displayWeeks">Display weeks in date string.</param>
/// <returns>The human readable string for relative date.</returns>
/// <see cref="http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time"/>
public static string GetRelativeDateString(DateTime originDate, DateTime previousDate, bool displayWeeks)
public static string GetRelativeDateString(DateTime originDate, DateTime previousDate, bool displayWeeks = true)
{
var ts = new TimeSpan(RoundDateTime(originDate).Ticks - RoundDateTime(previousDate).Ticks);
double delta = Math.Abs(ts.TotalSeconds);
Expand Down Expand Up @@ -1314,11 +1297,6 @@ public static string GetRelativeDateString(DateTime originDate, DateTime previou
return Strings.GetNYearsAgoText(years);
}

public static string GetRelativeDateString(DateTime originDate, DateTime previousDate)
{
return GetRelativeDateString(originDate, previousDate, true);
}

public static string GetFullDateString(DateTimeOffset datetime)
{
// previous format "ddd MMM dd HH':'mm':'ss yyyy"
Expand All @@ -1343,7 +1321,7 @@ private static bool IsDiffFile(string path)
}
}

#if !MONO
#if !__MonoCS__
static class NativeMethods
{
[DllImport("kernel32.dll")]
Expand All @@ -1362,7 +1340,7 @@ public static extern bool GenerateConsoleCtrlEvent(uint dwCtrlEvent,

public static void TerminateTree(this Process process)
{
#if !MONO
#if !__MonoCS__
if (EnvUtils.RunningOnWindows())
{
// Send Ctrl+C
Expand Down
Loading

0 comments on commit 730a1dd

Please sign in to comment.