From e3559c924c294a580ff8ef34ec65566b94b88822 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Sat, 30 Apr 2011 12:06:41 -0700 Subject: [PATCH 1/5] Hide SVN controls if repository doesn't have a SVN remote instead of only disabling them. --- PBGitSidebarController.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 051ed59..a5c5da7 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -522,8 +522,11 @@ enum { // get config BOOL hasSVN = [repository hasSvnRemote]; [svnFetchButton setEnabled:hasSVN]; + [svnFetchButton setTransparent:!hasSVN]; [svnRebaseButton setEnabled:hasSVN]; + [svnRebaseButton setTransparent:!hasSVN]; [svnDcommitButton setEnabled:hasSVN]; + [svnDcommitButton setTransparent:!hasSVN]; } - (IBAction) fetchPullPushAction:(id)sender From a775582c003a6f425a2d619d27e420abf83d87f7 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Sat, 30 Apr 2011 12:07:08 -0700 Subject: [PATCH 2/5] Make the toolbar editable. --- English.lproj/RepositoryWindow.xib | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/English.lproj/RepositoryWindow.xib b/English.lproj/RepositoryWindow.xib index 7a5139c..cbfa1a1 100644 --- a/English.lproj/RepositoryWindow.xib +++ b/English.lproj/RepositoryWindow.xib @@ -2,13 +2,13 @@ 1050 - 10J869 - 1305 + 10J3331a + 1306 1038.35 461.00 com.apple.InterfaceBuilder.CocoaPlugin - 1305 + 1306 YES @@ -63,7 +63,7 @@ YES YES - NO + YES YES 1 1 From 3f416bb8e72dacedd680ef122ba232ae82a2402d Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Sat, 30 Apr 2011 13:03:15 -0700 Subject: [PATCH 3/5] Tidy up the commit message to ensure it won't break the diff view. Renamed the GLFileView's +parseHTML into something more meaningful regarding what it actually does. Also, the method might need to be moved to somewhere else... --- GLFileView.h | 2 +- GLFileView.m | 19 +++++++++++-------- PBWebHistoryController.m | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/GLFileView.h b/GLFileView.h index 8084ddc..8cf1d5c 100644 --- a/GLFileView.h +++ b/GLFileView.h @@ -31,7 +31,7 @@ - (void)showFile; - (void)didLoad; - (NSString *)parseBlame:(NSString *)txt; -+ (NSString *)parseHTML:(NSString *)txt; ++ (NSString *)cleanupHTML:(NSString *)txt; + (NSString *)parseDiff:(NSString *)txt; + (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats; + (NSString *)getFileName:(NSString *)line; diff --git a/GLFileView.m b/GLFileView.m index f6d68c6..4e4a27c 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -110,7 +110,7 @@ if(startFile==@"fileview"){ fileTxt=[file textContents:&theError]; if(!theError) - fileTxt=[GLFileView parseHTML:fileTxt]; + fileTxt=[GLFileView cleanupHTML:fileTxt]; }else if(startFile==@"blame"){ fileTxt=[file blame:&theError]; if(!theError) @@ -240,13 +240,16 @@ [super closeView]; } -+ (NSString *) parseHTML:(NSString *)txt ++ (NSString *) cleanupHTML:(NSString *)txt { - txt=[txt stringByReplacingOccurrencesOfString:@"&" withString:@"&"]; - txt=[txt stringByReplacingOccurrencesOfString:@"<" withString:@"<"]; - txt=[txt stringByReplacingOccurrencesOfString:@">" withString:@">"]; + NSMutableString *newTxt = [NSMutableString stringWithString:txt]; + [newTxt replaceOccurrencesOfString:@"&" withString:@"&" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])]; + [newTxt replaceOccurrencesOfString:@"<" withString:@"<" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])]; + [newTxt replaceOccurrencesOfString:@">" withString:@">" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])]; + [newTxt replaceOccurrencesOfString:@"\"" withString:@""" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])]; + [newTxt replaceOccurrencesOfString:@"'" withString:@"'" 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 cleanupHTML:txt]; NSMutableString *res=[NSMutableString string]; NSScanner *scan=[NSScanner scannerWithString:txt]; @@ -504,7 +507,7 @@ - (NSString *) parseBlame:(NSString *)txt { - txt=[GLFileView parseHTML:txt]; + txt=[GLFileView cleanupHTML:txt]; NSArray *lines = [txt componentsSeparatedByString:@"\n"]; NSString *line; diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m index b422132..7dd0898 100644 --- a/PBWebHistoryController.m +++ b/PBWebHistoryController.m @@ -167,7 +167,8 @@ } }else{ if (subj) { - [subject appendString:[NSString stringWithFormat:@"%@
",[line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]]; + NSString *trimmedLine = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + [subject appendString:[NSString stringWithFormat:@"%@
",[GLFileView cleanupHTML:trimmedLine]]]; }else{ NSArray *comps=[line componentsSeparatedByString:@" "]; if([comps count]==2){ From 7d82aa07617a5b7f02327f0ee1d2719d154c5faf Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Sun, 1 May 2011 13:49:15 -0700 Subject: [PATCH 4/5] Rename cleanupHTML: to escapeHTML: --- GLFileView.h | 2 +- GLFileView.m | 8 ++++---- PBWebHistoryController.m | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GLFileView.h b/GLFileView.h index 8cf1d5c..2b97e23 100644 --- a/GLFileView.h +++ b/GLFileView.h @@ -31,7 +31,7 @@ - (void)showFile; - (void)didLoad; - (NSString *)parseBlame:(NSString *)txt; -+ (NSString *)cleanupHTML:(NSString *)txt; ++ (NSString *)escapeHTML:(NSString *)txt; + (NSString *)parseDiff:(NSString *)txt; + (NSString *)parseDiffTree:(NSString *)txt withStats:(NSMutableDictionary *)stats; + (NSString *)getFileName:(NSString *)line; diff --git a/GLFileView.m b/GLFileView.m index 4e4a27c..7fbd4ae 100644 --- a/GLFileView.m +++ b/GLFileView.m @@ -110,7 +110,7 @@ if(startFile==@"fileview"){ fileTxt=[file textContents:&theError]; if(!theError) - fileTxt=[GLFileView cleanupHTML:fileTxt]; + fileTxt=[GLFileView escapeHTML:fileTxt]; }else if(startFile==@"blame"){ fileTxt=[file blame:&theError]; if(!theError) @@ -240,7 +240,7 @@ [super closeView]; } -+ (NSString *) cleanupHTML:(NSString *)txt ++ (NSString *) escapeHTML:(NSString *)txt { NSMutableString *newTxt = [NSMutableString stringWithString:txt]; [newTxt replaceOccurrencesOfString:@"&" withString:@"&" options:NSLiteralSearch range:NSMakeRange(0, [newTxt length])]; @@ -299,7 +299,7 @@ + (NSString *)parseDiff:(NSString *)txt { - txt=[self cleanupHTML:txt]; + txt=[self escapeHTML:txt]; NSMutableString *res=[NSMutableString string]; NSScanner *scan=[NSScanner scannerWithString:txt]; @@ -507,7 +507,7 @@ - (NSString *) parseBlame:(NSString *)txt { - txt=[GLFileView cleanupHTML:txt]; + txt=[GLFileView escapeHTML:txt]; NSArray *lines = [txt componentsSeparatedByString:@"\n"]; NSString *line; diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m index 7dd0898..a870c30 100644 --- a/PBWebHistoryController.m +++ b/PBWebHistoryController.m @@ -168,7 +168,7 @@ }else{ if (subj) { NSString *trimmedLine = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - [subject appendString:[NSString stringWithFormat:@"%@
",[GLFileView cleanupHTML:trimmedLine]]]; + [subject appendString:[NSString stringWithFormat:@"%@
",[GLFileView escapeHTML:trimmedLine]]]; }else{ NSArray *comps=[line componentsSeparatedByString:@" "]; if([comps count]==2){ From e05be3b4bf856a768a1e7ebe7f16c6c327c233e0 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Sun, 1 May 2011 13:49:31 -0700 Subject: [PATCH 5/5] Use setHidden: instead of setTrasnparent: --- PBGitSidebarController.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index a5c5da7..dad7de1 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -522,11 +522,11 @@ enum { // get config BOOL hasSVN = [repository hasSvnRemote]; [svnFetchButton setEnabled:hasSVN]; - [svnFetchButton setTransparent:!hasSVN]; + [svnFetchButton setHidden:!hasSVN]; [svnRebaseButton setEnabled:hasSVN]; - [svnRebaseButton setTransparent:!hasSVN]; + [svnRebaseButton setHidden:!hasSVN]; [svnDcommitButton setEnabled:hasSVN]; - [svnDcommitButton setTransparent:!hasSVN]; + [svnDcommitButton setHidden:!hasSVN]; } - (IBAction) fetchPullPushAction:(id)sender