diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 0463483..7672e99 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -60,6 +60,7 @@ F5E928550E8841FB00056E75 /* diff.js in Resources */ = {isa = PBXBuildFile; fileRef = F5E928540E8841FB00056E75 /* diff.js */; }; F5E92A1B0E88550E00056E75 /* empty_file.png in Resources */ = {isa = PBXBuildFile; fileRef = F5E92A1A0E88550E00056E75 /* empty_file.png */; }; F5E92A230E88569500056E75 /* new_file.png in Resources */ = {isa = PBXBuildFile; fileRef = F5E92A220E88569500056E75 /* new_file.png */; }; + F5EC2DAD0E8C235C000FA381 /* spinner.gif in Resources */ = {isa = PBXBuildFile; fileRef = F5EC2DAC0E8C235C000FA381 /* spinner.gif */; }; F5FF4E180E0829C20006317A /* PBGitRevList.m in Sources */ = {isa = PBXBuildFile; fileRef = F5FF4E170E0829C20006317A /* PBGitRevList.m */; }; F5FF4E7A0E082E440006317A /* PBGitGrapher.m in Sources */ = {isa = PBXBuildFile; fileRef = F5FF4E790E082E440006317A /* PBGitGrapher.m */; }; /* End PBXBuildFile section */ @@ -173,6 +174,7 @@ F5E928540E8841FB00056E75 /* diff.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = diff.js; path = html/diff.js; sourceTree = ""; }; F5E92A1A0E88550E00056E75 /* empty_file.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = empty_file.png; path = Images/empty_file.png; sourceTree = ""; }; F5E92A220E88569500056E75 /* new_file.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = new_file.png; path = Images/new_file.png; sourceTree = ""; }; + F5EC2DAC0E8C235C000FA381 /* spinner.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; name = spinner.gif; path = Images/spinner.gif; sourceTree = ""; }; F5FF4E160E0829C20006317A /* PBGitRevList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRevList.h; sourceTree = ""; }; F5FF4E170E0829C20006317A /* PBGitRevList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevList.m; sourceTree = ""; }; F5FF4E780E082E440006317A /* PBGitGrapher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitGrapher.h; sourceTree = ""; }; @@ -260,6 +262,7 @@ 29B97315FDCFA39411CA2CEA /* Other Sources */ = { isa = PBXGroup; children = ( + F5EC2DAC0E8C235C000FA381 /* spinner.gif */, F5E92A1A0E88550E00056E75 /* empty_file.png */, 32CA4F630368D1EE00C91783 /* GitX_Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, @@ -514,6 +517,7 @@ F59116E60E843BB50072CCB1 /* PBGitCommitView.xib in Resources */, F5E9281D0E8840CF00056E75 /* diff.html in Resources */, F5E92A230E88569500056E75 /* new_file.png in Resources */, + F5EC2DAD0E8C235C000FA381 /* spinner.gif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Images/spinner.gif b/Images/spinner.gif new file mode 100644 index 0000000..ddb7ff1 Binary files /dev/null and b/Images/spinner.gif differ diff --git a/PBGitCommit.h b/PBGitCommit.h index e2c87c2..7e24779 100644 --- a/PBGitCommit.h +++ b/PBGitCommit.h @@ -15,6 +15,7 @@ NSString* subject; NSString* author; NSString* details; + NSString *_patch; NSArray* parents; NSArray* refs; NSDate* date; @@ -31,6 +32,7 @@ @property (retain) NSArray* parents, *refs; @property (copy) NSDate* date; @property (readonly) NSString* dateString; +@property (readonly) NSString* patch; @property (assign) char sign; @property (readonly) NSString* details; diff --git a/PBGitCommit.m b/PBGitCommit.m index 0fef796..f60d1b1 100644 --- a/PBGitCommit.m +++ b/PBGitCommit.m @@ -44,6 +44,15 @@ return details; } +- (NSString *) patch +{ + if (_patch != nil) + return _patch; + + _patch = [repository outputForArguments:[NSArray arrayWithObjects:@"format-patch", @"-1", @"--stdout", sha, nil]]; + return _patch; +} + - (PBGitTree*) tree { return [PBGitTree rootForCommit: self]; diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib index 2759752..991205f 100644 --- a/PBGitHistoryView.xib +++ b/PBGitHistoryView.xib @@ -8,7 +8,7 @@ 352.00 YES - + YES @@ -320,7 +320,7 @@ 1 - + 256 YES @@ -346,7 +346,7 @@ public.url-name - {{1, 0}, {851, 220}} + {{1, 0}, {851, 229}} @@ -373,7 +373,8 @@ YES - {852, 220} + {852, 229} + Details @@ -645,7 +646,7 @@ Item 2 - + 256 YES @@ -768,29 +769,6 @@ 2322 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - Apple URL pasteboard type - CorePasteboardFlavorType 0x6D6F6F76 - CorePasteboardFlavorType 0x75726C20 - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - NeXT font pasteboard type - NeXT ruler pasteboard type - WebURLsWithTitlesPboardType - - {543, 112} @@ -897,21 +875,20 @@ {852, 229} - Tree - + 6 YES YES YES - + @@ -1327,6 +1304,14 @@ 107 + + + policyDelegate + + + + 109 + @@ -1859,7 +1844,7 @@ - 107 + 109 diff --git a/html/commit.html b/html/commit.html index 70fe140..58a5571 100644 --- a/html/commit.html +++ b/html/commit.html @@ -10,6 +10,12 @@ + + +
Paste online
diff --git a/html/commit.js b/html/commit.js index 155d83c..b7af418 100644 --- a/html/commit.js +++ b/html/commit.js @@ -3,6 +3,7 @@ var Commit = Class.create({ initialize: function(obj) { this.raw = obj.details; this.refs = obj.refs; + this.object = obj; var diffStart = this.raw.indexOf("\ndiff "); var messageStart = this.raw.indexOf("\n\n") + 2; @@ -37,6 +38,45 @@ var Commit = Class.create({ } }); +var notify = function(text, busy) { + var n = $("notification"); + n.style.display = ""; + if (busy) + $("spinner").style.display = ""; + else + $("spinner").style.display = "none"; + + $("notification_message").innerHTML = text; +} + +var gistie = function() { + notify("Uploading code to Gistie..", true); + + new Ajax.Request("http://gist.github.com/gists", { + method: 'post', + parameters: { + "file_ext[gistfile1]": "patch", + "file_name[gistfile1]": commit.object.subject.replace(/[^a-zA-Z0-9]/g, "-") + ".patch", + "file_contents[gistfile1]": commit.object.patch() + }, + + onSuccess: function(t) { + if (m = t.responseText.match(/gist: (\d+)/)) + notify("Code uploaded to gistie #" + m[1] + ""); + else + notify("Pasting to Gistie failed."); + }, + onFailure: function(t) { + notify("Pasting to Gistie failed."); + }, + onException: function(t) { + notify("Pasting to Gistie failed."); + }, + + }); + +} + var selectCommit = function(a) { Controller.selectCommit_(a); } @@ -51,6 +91,7 @@ var showDiffs = function() { } var reload = function() { + $("notification").style.display = "none"; commit.refs = null; showRefs(); commit.reloadRefs(); @@ -70,6 +111,7 @@ var showRefs = function() { var loadCommit = function() { commit = new Commit(CommitObject); + $("notification").style.display = "none"; $("commitID").innerHTML = commit.sha; if (commit.author_email) diff --git a/html/commits.css b/html/commits.css index ceaeeb8..3676816 100644 --- a/html/commits.css +++ b/html/commits.css @@ -3,6 +3,28 @@ font-family: Helvetica; font-size: 12px; } + +#gistie { + float: right; + margin-right: 100px; + color: rgb(20, 79, 174); + text-decoration: underline; +} + +#notification { + width: 80%; + margin: auto; + border: 1px solid #A8A159; + background-color: #FFF487; + font-size: 140%; + padding: 10px; +} + +#notification img { + vertical-align: bottom; + margin-right: 10px; +} + .property_name { width: 50px; color:#7F7F7F;
SHA: