Skip to content

Commit

Permalink
Merged Makefile change
Browse files Browse the repository at this point in the history
Merged change to print nicer message about chunk counts

Add shell script for executing git-bin.exe on Unix-based systems

smudge push: indicate when no chunks need transferring, handy for debugging

Use correct grammar for amount of chunks being transferred
  • Loading branch information
Mark Dunham committed Aug 13, 2012
1 parent 1654b41 commit bf2a824
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 21 deletions.
9 changes: 5 additions & 4 deletions Makefile
@@ -1,4 +1,5 @@
all:
xbuild /property:Configuration=Release
mv git-bin/bin/Release/git-bin.exe git-bin/bin/Release/git-bin

all:
xbuild /property:Configuration=Release
cp git-bin/git-bin.in git-bin/bin/Release/git-bin
chmod +x git-bin/bin/Release/git-bin

8 changes: 4 additions & 4 deletions build.sh
@@ -1,4 +1,4 @@
#!/bin/bash

xbuild /property:Configuration=Release

#!/bin/bash

xbuild /property:Configuration=Release

26 changes: 20 additions & 6 deletions git-bin/Commands/PushCommand.cs
Expand Up @@ -29,14 +29,28 @@ public void Execute()

var filesToUpload = filesInCache.Except(filesInRemote).ToList();

GitBinConsole.WriteLine("Uploading {0} chunks", filesToUpload.Count);

for (int i = 0; i < filesToUpload.Count; i++)
if (filesToUpload.Count == 0)
{
GitBinConsole.WriteLine("All chunks already present on remote");
}
else
{
using (new RemoteProgressPrinter(i, filesToUpload.Count, _remote))
if (filesToUpload.Count == 1)
{
GitBinConsole.WriteLine("Uploading 1 chunk");
}
else
{
GitBinConsole.WriteLine("Uploading {0} chunks", filesToUpload.Count);
}

for (int i = 0; i < filesToUpload.Count; i++)
{
var file = filesToUpload[i];
_remote.UploadFile(_cacheManager.GetPathForFile(file.Name), file.Name);
using (new RemoteProgressPrinter(i + 1, filesToUpload.Count, _remote))
{
var file = filesToUpload[i];
_remote.UploadFile(_cacheManager.GetPathForFile(file.Name), file.Name);
}
}
}
}
Expand Down
21 changes: 14 additions & 7 deletions git-bin/Commands/SmudgeCommand.cs
Expand Up @@ -38,23 +38,30 @@ private void DownloadMissingFiles(IEnumerable<string> chunkHashes)
{
var filesToDownload = _cacheManager.GetFilenamesNotInCache(chunkHashes);

if (filesToDownload.Length > 0)
if (filesToDownload.Length == 0)
{
GitBinConsole.WriteLineNoPrefix(" Downloading {0} chunks...", filesToDownload.Length);
GitBinConsole.WriteLineNoPrefix(" All chunks already present in cache\n");
}
else
{
if (filesToDownload.Length == 1)
{
GitBinConsole.WriteLineNoPrefix(" Downloading 1 chunk...");
}
else
{
GitBinConsole.WriteLineNoPrefix(" Downloading {0} chunks...", filesToDownload.Length);
}

for (int i = 0; i < filesToDownload.Length; i++)
{
using (new RemoteProgressPrinter(i, filesToDownload.Length, _remote))
using (new RemoteProgressPrinter(i + 1, filesToDownload.Length, _remote))
{
var file = filesToDownload[i];
_remote.DownloadFile(_cacheManager.GetPathForFile(file), file);
}
}
}
else
{
GitBinConsole.WriteNoPrefix(Environment.NewLine);
}
}

private void OutputReassembledChunks(IEnumerable<string> chunkHashes)
Expand Down
2 changes: 2 additions & 0 deletions git-bin/git-bin.in
@@ -0,0 +1,2 @@
#!/bin/bash
mono git-bin.exe $@

0 comments on commit bf2a824

Please sign in to comment.