mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
initial File log
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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:@"<"];
|
||||
|
||||
@@ -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 = "<group>"; };
|
||||
31D70AF911C4006C00F4B199 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
|
||||
31D70AFA11C4006C00F4B199 /* Source Code License.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = "Source Code License.rtf"; sourceTree = "<group>"; };
|
||||
31DA63D711C6D7CD00BCBCAD /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = index.html; path = log/index.html; sourceTree = "<group>"; };
|
||||
31DA63D911C6D7F700BCBCAD /* log.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = log.js; path = log/log.js; sourceTree = "<group>"; };
|
||||
31DA63DE11C6DA5800BCBCAD /* format.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = format.html; path = log/format.html; sourceTree = "<group>"; };
|
||||
32CA4F630368D1EE00C91783 /* GitX_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GitX_Prefix.pch; sourceTree = "<group>"; };
|
||||
3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = HistoryViewTemplate.png; path = Images/HistoryViewTemplate.png; sourceTree = "<group>"; };
|
||||
3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CommitViewTemplate.png; path = Images/CommitViewTemplate.png; sourceTree = "<group>"; };
|
||||
@@ -796,6 +802,16 @@
|
||||
path = MGScopeBar;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
31DA63D511C6D7A600BCBCAD /* log */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
31DA63D711C6D7CD00BCBCAD /* index.html */,
|
||||
31DA63D911C6D7F700BCBCAD /* log.js */,
|
||||
31DA63DE11C6DA5800BCBCAD /* format.html */,
|
||||
);
|
||||
name = log;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
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;
|
||||
};
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
.diff .file {
|
||||
.diff .file,
|
||||
#log .commit {
|
||||
margin: 10px;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<div id='%h' class='commit'>
|
||||
<p class="title">%s</p>
|
||||
<table>
|
||||
<tr><td>Author:</td><td>%an</td></tr>
|
||||
<tr><td>Date:</td><td>%ar</td></tr>
|
||||
<tr><td>Commit:</td><td>%H</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
file:///Users/laullon/xcode/gitx/build/Release/GitX.app/Contents/Resources/html/views/history/index.html
|
||||
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Details for commit</title>
|
||||
<link rel="stylesheet" href="../../css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script src="../../lib/GitX.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../lib/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../lib/keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<link rel="stylesheet" href="log.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script src="log.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var showDiff = function(diff) {
|
||||
highlightDiff(diff, $("diff"));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="message" style="display:none">
|
||||
There are no differences
|
||||
</div>
|
||||
<div id='log'></div>
|
||||
</body>
|
||||
@@ -0,0 +1,4 @@
|
||||
.commit table tr td:nth-of-type(1){
|
||||
text-align: right;
|
||||
color: gray;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var showFile = function(txt) {
|
||||
$("log").style.display = "";
|
||||
$("log").innerHTML=txt;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
<html><head>
|
||||
<title>Details for commit</title>
|
||||
<link rel="stylesheet" href="../../css/GitX.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script src="../../lib/GitX.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../lib/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../lib/diffHighlighter.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../../lib/keyboardNavigation.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<link rel="stylesheet" href="log.css" type="text/css" media="screen" title="no title" charset="utf-8">
|
||||
<script src="log.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var showDiff = function(diff) {
|
||||
highlightDiff(diff, $("diff"));
|
||||
}
|
||||
</script>
|
||||
</head><body>
|
||||
<div id="message" style="display:none">
|
||||
There are no differences
|
||||
</div>
|
||||
<div id="log"><div id="7037821" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>703782163ddb653789c304e396eadb31f541864f</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>10 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">PBChangedFile: Add assert to make sure we're not doing something stupid</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="0d8ba8c" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>0d8ba8c2632e129fe7627f86d907c8b470c1bf20</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>1 year, 1 month ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">Rename 'CachedChanges" to "StagedChanges" for greater consistency</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="f9ff15c" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>f9ff15cc6bf3c807425321581002f676985dd222</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>1 year, 1 month ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">PBChangedFile: remove shouldBeDeleted boolean</div>
|
||||
<div class="body">We don't need this anymore</div>
|
||||
</div>
|
||||
|
||||
<div id="8d729da" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>8d729dae4cc8d3b564d149d6c9bb96922ee1bafa</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>1 year, 6 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Don't change selection when refreshing</div>
|
||||
<div class="body">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.</div>
|
||||
</div>
|
||||
|
||||
<div id="0975426" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>0975426f2f5119335c00768006b1ede0252ac448</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 7 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: move index functions to separate controller</div>
|
||||
<div class="body">This merges functionality that was previously stored in the
|
||||
combination of PBGitCommitController / PBChangedFile to a
|
||||
dedicated controller, PBGitIndexController.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="1d19bd6" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>1d19bd64dfa83def18d5271c9afef9300ef0d65e</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 8 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">PBChangedFile: Don't use cat to read file contents</div>
|
||||
<div class="body">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.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="472d36c" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>472d36c7f970d9f3dbda3b9d7c8a7d51546bda56</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 8 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Add context menu to revert changes</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="e659e63" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>e659e63fc08ecd46cc1c26b6260126502ec656aa</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 8 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Add option to amend commits</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="5010511" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>5010511bdb358ad376fd4668368bc5c12d9d8214</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 8 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Always use a single PBChangedFile object</div>
|
||||
<div class="body">This makes sure we don't add a double object to our array,
|
||||
if a file has both cached and unstaged changes.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="a0f248e" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>a0f248ef9f50a3af0efebdfb29c706bd97011a97</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 8 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Also show deleted files correctly</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="001b6bf" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>001b6bf10eeaaf618971bc079e7415690c4c8d1a</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 9 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Handle new files better</div>
|
||||
<div class="body">This fixes the 'cat' command that was acting up and also shows
|
||||
information when a file could not be displayed</div>
|
||||
</div>
|
||||
|
||||
<div id="aafc284" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>aafc284eb8fbd69acf40acfef07e25f409a87a18</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 9 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">ChangedFile: add a path separator to reset command</div>
|
||||
<div class="body">Sometimes a file could not be reset because it contained weird characters.
|
||||
|
||||
This hopefully fixes it.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="76e176e" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>76e176e8b4ac59438340b129874ffbdfa7404ea3</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 9 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">Add staging and unstaging of files</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="9b3909e" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>9b3909e7592d3c8648accb67642a2b57a441f128</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 9 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Add a status bar to the diff view</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="44009b6" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>44009b6f3e7e6fc5b54910c2b2a9a54b13f95a14</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 9 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: use only one array for all files</div>
|
||||
<div class="body"></div>
|
||||
</div>
|
||||
|
||||
<div id="252796e" class="commit">
|
||||
<table>
|
||||
<tbody><tr><td>Commit:</td><td>252796ee26ce733c4a6d3044e3142f9ee5df005e</td></tr>
|
||||
<tr><td>Author:</td><td>Pieter de Bie</td></tr>
|
||||
<tr><td>Date:</td><td>2 years, 9 months ago</td></tr>
|
||||
</tbody></table>
|
||||
<div class="title">CommitView: Show basic files</div>
|
||||
<div class="body"></div>
|
||||
</div></div>
|
||||
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user