diff --git a/FileViewer/FileViewerController.h b/FileViewer/FileViewerController.h index fe41175..0be25d1 100644 --- a/FileViewer/FileViewerController.h +++ b/FileViewer/FileViewerController.h @@ -29,6 +29,7 @@ - (void)showFile:(NSString *)file sha:(NSString *)sha; - (NSString*)refSpec; +-(NSString *)parseLog:(NSString *)string; -(NSString *)parseBlame:(NSString *)string; @property(retain) NSMutableArray *groups; diff --git a/FileViewer/FileViewerController.m b/FileViewer/FileViewerController.m index 2a4b219..e20ce6e 100644 --- a/FileViewer/FileViewerController.m +++ b/FileViewer/FileViewerController.m @@ -43,6 +43,10 @@ (commit)?@"commit":@"diff", ITEM_IDENTIFIER, @"Diff", ITEM_NAME, nil], + [NSDictionary dictionaryWithObjectsAndKeys: + @"log", ITEM_IDENTIFIER, + @"History", ITEM_NAME, + nil], nil]; [self.groups addObject:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], GROUP_SEPARATOR, @@ -122,24 +126,36 @@ - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { - NSString *txt; NSString *show=[[[scopeBar selectedItems] objectAtIndex:0] objectAtIndex:0]; + + NSString *path = [NSString stringWithFormat:@"html/views/%@", show]; + NSString *formatFile = [[NSBundle mainBundle] pathForResource:@"format" ofType:@"html" inDirectory:path]; + NSString *testFile = [NSString stringWithFormat:@"%@/test.html",NSHomeDirectory()]; + NSString *format; + if(formatFile!=nil) + format=[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:formatFile] encoding:nil error:nil]; + + NSString *txt; if(show==@"source") txt=[repository outputForArguments:[NSArray arrayWithObjects:@"show", [self refSpec], nil]]; else if(show==@"blame") txt=[self parseBlame:[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"blame", @"-p", file, sha, nil]]]; else if((show==@"diff") || (show==@"commit")) txt=[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"diff", (sha!=nil)?sha:file , (sha!=nil)?file:nil, nil]]; + else if(show==@"log") + txt=[self parseLog:[repository outputInWorkdirForArguments:[NSArray arrayWithObjects:@"log", [NSString stringWithFormat:@"--pretty=format:%@",format], @"--", file, nil]]]; else return; // XXXX controlar mejor. NSLog(@"didFinishLoadForFrame -> txt: '%@'",[txt substringToIndex:80]); + NSLog(@"didFinishLoadForFrame -> path: '%@'",path); + NSLog(@"didFinishLoadForFrame -> testFile: '%@'",testFile); id script = [webViewFileViwer windowScriptObject]; [script callWebScriptMethod:@"showFile" withArguments:[NSArray arrayWithObjects:txt, nil]]; - //NSLog(@"%@",[[[[sender mainFrame] DOMDocument] documentElement] outerHTML]); + [[[[[sender mainFrame] DOMDocument] documentElement] outerHTML] writeToFile:testFile atomically:YES encoding:NSUTF8StringEncoding error:nil]; } - (NSString*)refSpec @@ -148,6 +164,11 @@ } +-(NSString *)parseLog:(NSString *)string +{ + return string; +} + -(NSString *)parseBlame:(NSString *)string { string=[string stringByReplacingOccurrencesOfString:@"<" withString:@"<"]; diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index f817c82..0e7e9b0 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -29,6 +29,9 @@ 31D70AFC11C4006C00F4B199 /* MGScopeBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 31D70AF311C4006C00F4B199 /* MGScopeBar.m */; }; 31D70AFD11C4006C00F4B199 /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = 31D70AF911C4006C00F4B199 /* ReadMe.txt */; }; 31D70AFE11C4006C00F4B199 /* Source Code License.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 31D70AFA11C4006C00F4B199 /* Source Code License.rtf */; }; + 31DA63D811C6D7CD00BCBCAD /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 31DA63D711C6D7CD00BCBCAD /* index.html */; }; + 31DA63DA11C6D7F700BCBCAD /* log.js in Sources */ = {isa = PBXBuildFile; fileRef = 31DA63D911C6D7F700BCBCAD /* log.js */; }; + 31DA63DF11C6DA5800BCBCAD /* format.html in Resources */ = {isa = PBXBuildFile; fileRef = 31DA63DE11C6DA5800BCBCAD /* format.html */; }; 3BC07F4C0ED5A5C5009A7768 /* HistoryViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */; }; 3BC07F4D0ED5A5C5009A7768 /* CommitViewTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = 3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */; }; 47DBDB580E94EDE700671A1E /* DBPrefsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 47DBDB570E94EDE700671A1E /* DBPrefsWindowController.m */; }; @@ -315,6 +318,9 @@ 31D70AF811C4006C00F4B199 /* MGScopeBarDelegateProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGScopeBarDelegateProtocol.h; sourceTree = ""; }; 31D70AF911C4006C00F4B199 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; 31D70AFA11C4006C00F4B199 /* Source Code License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = "Source Code License.rtf"; sourceTree = ""; }; + 31DA63D711C6D7CD00BCBCAD /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = index.html; path = log/index.html; sourceTree = ""; }; + 31DA63D911C6D7F700BCBCAD /* log.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = log.js; path = log/log.js; sourceTree = ""; }; + 31DA63DE11C6DA5800BCBCAD /* format.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = format.html; path = log/format.html; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* GitX_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GitX_Prefix.pch; sourceTree = ""; }; 3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = HistoryViewTemplate.png; path = Images/HistoryViewTemplate.png; sourceTree = ""; }; 3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CommitViewTemplate.png; path = Images/CommitViewTemplate.png; sourceTree = ""; }; @@ -796,6 +802,16 @@ path = MGScopeBar; sourceTree = ""; }; + 31DA63D511C6D7A600BCBCAD /* log */ = { + isa = PBXGroup; + children = ( + 31DA63D711C6D7CD00BCBCAD /* index.html */, + 31DA63D911C6D7F700BCBCAD /* log.js */, + 31DA63DE11C6DA5800BCBCAD /* format.html */, + ); + name = log; + sourceTree = ""; + }; 47DBDB920E94F47200671A1E /* Preference Icons */ = { isa = PBXGroup; children = ( @@ -837,6 +853,7 @@ C3138B8B11C2F48400BE6CBE /* views */ = { isa = PBXGroup; children = ( + 31DA63D511C6D7A600BCBCAD /* log */, C3138B8C11C2F48400BE6CBE /* blame */, C3138B9111C2F48400BE6CBE /* commit */, C3138B9611C2F48400BE6CBE /* diff */, @@ -1485,6 +1502,8 @@ 31D70AFD11C4006C00F4B199 /* ReadMe.txt in Resources */, 31D70AFE11C4006C00F4B199 /* Source Code License.rtf in Resources */, 31A520AC11C6983900F604D0 /* test.html in Resources */, + 31DA63D811C6D7CD00BCBCAD /* index.html in Resources */, + 31DA63DF11C6DA5800BCBCAD /* format.html in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1667,6 +1686,7 @@ 315CB97B11C3305F003B8DBE /* FileViewerController.m in Sources */, 31D70AFB11C4006C00F4B199 /* MGRecessedPopUpButtonCell.m in Sources */, 31D70AFC11C4006C00F4B199 /* MGScopeBar.m in Sources */, + 31DA63DA11C6D7F700BCBCAD /* log.js in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/html/css/diff.css b/html/css/diff.css index 73087c3..d6eec1b 100644 --- a/html/css/diff.css +++ b/html/css/diff.css @@ -1,4 +1,5 @@ -.diff .file { +.diff .file, +#log .commit { margin: 10px; padding: 10px; -webkit-border-radius: 10px; diff --git a/html/views/log/format.html b/html/views/log/format.html new file mode 100644 index 0000000..7b8604f --- /dev/null +++ b/html/views/log/format.html @@ -0,0 +1,10 @@ +
+

%s

+ + + + +
Author:%an
Date:%ar
Commit:%H
+
+ +file:///Users/laullon/xcode/gitx/build/Release/GitX.app/Contents/Resources/html/views/history/index.html \ No newline at end of file diff --git a/html/views/log/index.html b/html/views/log/index.html new file mode 100644 index 0000000..32f98f0 --- /dev/null +++ b/html/views/log/index.html @@ -0,0 +1,25 @@ + + + Details for commit + + + + + + + + + + + + + + +
+ diff --git a/html/views/log/log.css b/html/views/log/log.css new file mode 100644 index 0000000..26cda56 --- /dev/null +++ b/html/views/log/log.css @@ -0,0 +1,4 @@ +.commit table tr td:nth-of-type(1){ + text-align: right; + color: gray; +} \ No newline at end of file diff --git a/html/views/log/log.js b/html/views/log/log.js new file mode 100644 index 0000000..8859d80 --- /dev/null +++ b/html/views/log/log.js @@ -0,0 +1,5 @@ +var showFile = function(txt) { + $("log").style.display = ""; + $("log").innerHTML=txt; + return; +} diff --git a/html/views/log/test.html b/html/views/log/test.html new file mode 100644 index 0000000..5e8d6e1 --- /dev/null +++ b/html/views/log/test.html @@ -0,0 +1,200 @@ + + Details for commit + + + + + + + + + + + + +
+ + + + +
Commit:703782163ddb653789c304e396eadb31f541864f
Author:Pieter de Bie
Date:10 months ago
+
PBChangedFile: Add assert to make sure we're not doing something stupid
+
+
+ +
+ + + + +
Commit:0d8ba8c2632e129fe7627f86d907c8b470c1bf20
Author:Pieter de Bie
Date:1 year, 1 month ago
+
Rename 'CachedChanges" to "StagedChanges" for greater consistency
+
+
+ +
+ + + + +
Commit:f9ff15cc6bf3c807425321581002f676985dd222
Author:Pieter de Bie
Date:1 year, 1 month ago
+
PBChangedFile: remove shouldBeDeleted boolean
+
We don't need this anymore
+
+ +
+ + + + +
Commit:8d729dae4cc8d3b564d149d6c9bb96922ee1bafa
Author:Pieter de Bie
Date:1 year, 6 months ago
+
CommitView: Don't change selection when refreshing
+
We used to read in a completely new array when refreshing +the index. The problem with this is that the selection +changes when reading in the new array. We avoid this +by changing the current array, rather than loading in +a completely new one.
+
+ +
+ + + + +
Commit:0975426f2f5119335c00768006b1ede0252ac448
Author:Pieter de Bie
Date:2 years, 7 months ago
+
CommitView: move index functions to separate controller
+
This merges functionality that was previously stored in the +combination of PBGitCommitController / PBChangedFile to a +dedicated controller, PBGitIndexController. +
+
+ +
+ + + + +
Commit:1d19bd64dfa83def18d5271c9afef9300ef0d65e
Author:Pieter de Bie
Date:2 years, 8 months ago
+
PBChangedFile: Don't use cat to read file contents
+
This changes PBChangedFile to read in files by using +NSString's stringWithContentsOfFile: method. + +It still uses the UTF8 encoding scheme so that we +can capture binary files. This should perhaps be loosened to +also allow other encodings. +
+
+ +
+ + + + +
Commit:472d36c7f970d9f3dbda3b9d7c8a7d51546bda56
Author:Pieter de Bie
Date:2 years, 8 months ago
+
CommitView: Add context menu to revert changes
+
+
+ +
+ + + + +
Commit:e659e63fc08ecd46cc1c26b6260126502ec656aa
Author:Pieter de Bie
Date:2 years, 8 months ago
+
CommitView: Add option to amend commits
+
+
+ +
+ + + + +
Commit:5010511bdb358ad376fd4668368bc5c12d9d8214
Author:Pieter de Bie
Date:2 years, 8 months ago
+
CommitView: Always use a single PBChangedFile object
+
This makes sure we don't add a double object to our array, +if a file has both cached and unstaged changes. +
+
+ +
+ + + + +
Commit:a0f248ef9f50a3af0efebdfb29c706bd97011a97
Author:Pieter de Bie
Date:2 years, 8 months ago
+
CommitView: Also show deleted files correctly
+
+
+ +
+ + + + +
Commit:001b6bf10eeaaf618971bc079e7415690c4c8d1a
Author:Pieter de Bie
Date:2 years, 9 months ago
+
CommitView: Handle new files better
+
This fixes the 'cat' command that was acting up and also shows +information when a file could not be displayed
+
+ +
+ + + + +
Commit:aafc284eb8fbd69acf40acfef07e25f409a87a18
Author:Pieter de Bie
Date:2 years, 9 months ago
+
ChangedFile: add a path separator to reset command
+
Sometimes a file could not be reset because it contained weird characters. + +This hopefully fixes it. +
+
+ +
+ + + + +
Commit:76e176e8b4ac59438340b129874ffbdfa7404ea3
Author:Pieter de Bie
Date:2 years, 9 months ago
+
Add staging and unstaging of files
+
+
+ +
+ + + + +
Commit:9b3909e7592d3c8648accb67642a2b57a441f128
Author:Pieter de Bie
Date:2 years, 9 months ago
+
CommitView: Add a status bar to the diff view
+
+
+ +
+ + + + +
Commit:44009b6f3e7e6fc5b54910c2b2a9a54b13f95a14
Author:Pieter de Bie
Date:2 years, 9 months ago
+
CommitView: use only one array for all files
+
+
+ +
+ + + + +
Commit:252796ee26ce733c4a6d3044e3142f9ee5df005e
Author:Pieter de Bie
Date:2 years, 9 months ago
+
CommitView: Show basic files
+
+
+ + \ No newline at end of file