Merge pull request #46 from RomainMuller/pull_request.

Several improvements
* Editable toolbar
* Hidden SVN controls when no SVN remote
* Escaped HTML in commit comment.
This commit is contained in:
German Laullon
2011-05-02 09:41:43 -07:00
5 changed files with 21 additions and 14 deletions
+4 -4
View File
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10J869</string>
<string key="IBDocument.InterfaceBuilderVersion">1305</string>
<string key="IBDocument.SystemVersion">10J3331a</string>
<string key="IBDocument.InterfaceBuilderVersion">1306</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1305</string>
<string key="NS.object.0">1306</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -63,7 +63,7 @@
<nil key="NSToolbarDelegate"/>
<bool key="NSToolbarPrefersToBeShown">YES</bool>
<bool key="NSToolbarShowsBaselineSeparator">YES</bool>
<bool key="NSToolbarAllowsUserCustomization">NO</bool>
<bool key="NSToolbarAllowsUserCustomization">YES</bool>
<bool key="NSToolbarAutosavesConfiguration">YES</bool>
<int key="NSToolbarDisplayMode">1</int>
<int key="NSToolbarSizeMode">1</int>
+1 -1
View File
@@ -31,7 +31,7 @@
- (void)showFile;
- (void)didLoad;
- (NSString *)parseBlame:(NSString *)txt;
+ (NSString *)parseHTML:(NSString *)txt;
+ (NSString *)escapeHTML:(NSString *)txt;
+ (NSString *)parseDiff:(NSString *)txt;
+ (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats;
+ (NSString *)getFileName:(NSString *)line;
+11 -8
View File
@@ -110,7 +110,7 @@
if(startFile==@"fileview"){
fileTxt=[file textContents:&theError];
if(!theError)
fileTxt=[GLFileView parseHTML:fileTxt];
fileTxt=[GLFileView escapeHTML:fileTxt];
}else if(startFile==@"blame"){
fileTxt=[file blame:&theError];
if(!theError)
@@ -240,13 +240,16 @@
[super closeView];
}
+ (NSString *) parseHTML:(NSString *)txt
+ (NSString *) escapeHTML:(NSString *)txt
{
txt=[txt stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"];
txt=[txt stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
txt=[txt stringByReplacingOccurrencesOfString:@">" withString:@"&gt;"];
NSMutableString *newTxt = [NSMutableString stringWithString:txt];
[newTxt replaceOccurrencesOfString:@"&" withString:@"&amp;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
[newTxt replaceOccurrencesOfString:@"<" withString:@"&lt;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
[newTxt replaceOccurrencesOfString:@">" withString:@"&gt;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
[newTxt replaceOccurrencesOfString:@"\"" withString:@"&quot;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
[newTxt replaceOccurrencesOfString:@"'" withString:@"&apos;" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])];
return txt;
return newTxt;
}
+ (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats
@@ -296,7 +299,7 @@
+ (NSString *)parseDiff:(NSString *)txt
{
txt=[self parseHTML:txt];
txt=[self escapeHTML:txt];
NSMutableString *res=[NSMutableString string];
NSScanner *scan=[NSScanner scannerWithString:txt];
@@ -504,7 +507,7 @@
- (NSString *) parseBlame:(NSString *)txt
{
txt=[GLFileView parseHTML:txt];
txt=[GLFileView escapeHTML:txt];
NSArray *lines = [txt componentsSeparatedByString:@"\n"];
NSString *line;
+3
View File
@@ -522,8 +522,11 @@ enum {
// get config
BOOL hasSVN = [repository hasSvnRemote];
[svnFetchButton setEnabled:hasSVN];
[svnFetchButton setHidden:!hasSVN];
[svnRebaseButton setEnabled:hasSVN];
[svnRebaseButton setHidden:!hasSVN];
[svnDcommitButton setEnabled:hasSVN];
[svnDcommitButton setHidden:!hasSVN];
}
- (IBAction) fetchPullPushAction:(id)sender
+2 -1
View File
@@ -167,7 +167,8 @@
}
}else{
if (subj) {
[subject appendString:[NSString stringWithFormat:@"%@<br/>",[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]];
NSString *trimmedLine = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[subject appendString:[NSString stringWithFormat:@"%@<br/>",[GLFileView escapeHTML:trimmedLine]]];
}else{
NSArray *comps=[line componentsSeparatedByString:@" "];
if([comps count]==2){