Commits

Anonymous committed 64c0541

修改包含冲突的文件标志;修改Pull并且Update成功后界面刷新;修改Merge后界面不刷新的问题;修改Refresh按钮的界面不刷新问题;

Comments (0)

Files changed (10)

Murky.xcodeproj/project.pbxproj

 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
-		0041024D1140F99B00717B62 /* toolbar_allconflicts.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = toolbar_allconflicts.png; path = ../Murky/Resources/Icons/toolbar_allconflicts.png; sourceTree = SOURCE_ROOT; };
-		0078DD7E1142539500649710 /* toolbar_resolve.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = toolbar_resolve.png; path = ../Murky/Resources/Icons/toolbar_resolve.png; sourceTree = SOURCE_ROOT; };
+		0041024D1140F99B00717B62 /* toolbar_allconflicts.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = toolbar_allconflicts.png; sourceTree = "<group>"; };
+		0078DD7E1142539500649710 /* toolbar_resolve.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = toolbar_resolve.png; sourceTree = "<group>"; };
 		0078DDDA114287FF00649710 /* status_conflict.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_conflict.png; path = ../Murky/Resources/Icons/status_conflict.png; sourceTree = SOURCE_ROOT; };
 		1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
 		270E509B0C56A5400069C9C6 /* HgDir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HgDir.h; sourceTree = "<group>"; };
Add a comment to this file

Resources/Icons/status_conflict.png

Old
Old image
New
New image
Add a comment to this file

Resources/Icons/status_resolved.png

Added
New image

Source/HgConfigFile.m

 //
 
 #import "HgConfigFile.h"
+#import "HgRepository.h"
 #import "MYTask.h"
 
 
     if (self != nil) {
         _path = path;
         [self sync];
+        
+        //** Name and Password **//
+        if ([UserInfo sharedUserInfo].loginName == nil) {
+            NSStringEncoding encoding;
+            NSString *contents = [NSString stringWithContentsOfFile: _path usedEncoding: &encoding error: nil];
+            NSRange range = [contents rangeOfString:@"://"];
+            if (range.length > 0 && range.location >= 0) {
+                NSString *subString = [contents substringFromIndex:range.location + 3];
+                range = [contents rangeOfString:@"@"];
+                if (range.length > 0 && range.location >= 0) {
+                    subString = [subString substringToIndex:range.location];
+                    NSArray *array = [subString componentsSeparatedByString:@":"];
+                    if (array && [array count] == 2) {
+                        [UserInfo sharedUserInfo].loginName = (NSString *)[array objectAtIndex:0];
+                        [UserInfo sharedUserInfo].loginPassword = (NSString *)[array objectAtIndex:1];
+                    }
+                }
+            }
+        }
+        ///////////////////////////
     }
     return self;
 }
     HgDir *_dir;
     NSString *_name;
     HgStatus _status;
+    HgStatus _prestatus;
     NSImage *_icon;
 }
 
         _name = [name copy];
         _dir = parentDir;
         _status = kNotTracked;
+        _prestatus = _status;
     }
     return self;
 }
 - (void) setStatus: (HgStatus)status
 {
     if( status != _status ) {
+        _prestatus = _status;
         _status = status;
     }
 }
 {
 	
 	if( _status == kModified ){
-		return [NSImage imageNamed:@"status_modified"];
+		if(_prestatus == KUnresolve) {
+            return [NSImage imageNamed:@"status_resolved"];
+        } else {
+            return [NSImage imageNamed:@"status_modified"];
+        }
 	}
     //else if( _status == kNeedsUpdate){
 //		return [NSImage imageNamed:@"status_needs_update"];

Source/HgRepository.h

 typedef UInt32 HgTransferOptions;
 
 
+
+@interface UserInfo : NSObject
+{
+    NSString *_loginName;
+    NSString *_loginPassword;
+}
+
++ (UserInfo *) sharedUserInfo;
+
+@property (copy) NSString *loginName, *loginPassword;
+
+@end
+
+
+
 /** A Mercurial repository. */
 @interface HgRepository : NSObject
 {

Source/HgRepository.m

 #import "MYDirectoryWatcher.h"
 
 
+
+@implementation UserInfo
+
+static UserInfo *sharedUserInfo = nil;
+
+
+@synthesize loginName = _loginName, loginPassword = _loginPassword;
+
++ (UserInfo *) sharedUserInfo {
+    @synchronized ([UserInfo class]) {
+        if (sharedUserInfo == nil) {
+            [[UserInfo alloc] init];
+            return sharedUserInfo;
+        }
+    }
+    
+    return sharedUserInfo;
+}
+
+
++ (id) alloc {
+    @synchronized ([UserInfo class]) {
+        sharedUserInfo = [super alloc];
+        return sharedUserInfo;
+    }
+    return nil;
+}
+
+- (void)dealloc {
+    [_loginName release];
+    [_loginPassword release];
+    [super dealloc];
+}
+
+@end
+
+
+
 @interface HgRepository (Internal)
 @property (copy) NSArray* revisions;
 - (BOOL) _checkWorkingTreePaths: (NSSet*)paths error: (NSError**)outError;
         }
     }
     
+    //** Name and Password **//    
+    NSString *url = stringForURL(srcURL);
+    NSRange range = [url rangeOfString:@"@"];
+    if (range.location >= 0 && range.length > 0) {
+        NSString *subUrl = [url substringToIndex:range.location];
+        range = [subUrl rangeOfString:@"://"];
+        if (range.location >= 0 && range.length > 0) {
+            subUrl = [url substringFromIndex:range.location+3];
+            NSArray *info = [url componentsSeparatedByString:@":"];
+            if (info && [info count] == 2) {
+                [UserInfo sharedUserInfo].loginName = (NSString *)[info objectAtIndex:0];
+                [UserInfo sharedUserInfo].loginPassword = (NSString *)[info objectAtIndex:1];
+            }
+        }
+    }
+    ///////////////////////////
+    
     NSMutableArray *args = [NSMutableArray arrayWithObjects: @"--", stringForURL(srcURL), stringForURL(dstURL), nil];
     if( !(options & kHgUpdateAfterwards) )
         [args insertObject: @"--noupdate" atIndex: 0];

Source/HgUncommittedRevision.m

                            NSLocalizedString(@"Missing commit message",
                                              @"Error message for hg commit"));
     if( ! [self applyCommand: @"commit" 
-                    arguments: [NSArray arrayWithObjects: @"--message", message, nil]
+                    arguments: [NSArray arrayWithObjects: @"--message", message, @"--user", [UserInfo sharedUserInfo].loginName, nil]
                       toFiles: files
                         error: outError] )
         return NO;

Source/RepoController_Actions.m

 
 - (IBAction) refreshStatus: (id)sender
 {
-    NSError *error =nil;
-    if( ! [_repo updateStatus: &error] )
+    RepoController *current = [[self class] existingRepoControllerWithDirectory: [_repo absolutePath]];
+    NSError *error;
+    if( current ) {
+        [current showWindow: self];
+        [current awakeFromNib];
+        [current.repository updateStatus: &error];
+    }
+    
+    if(error)
         [self presentError: error];
 }
 
             didEnd = @selector(_cloneDidEnd:result:url:);
     }    
     
+    if(xferOp==kHgPull)
+        didEnd = @selector(_pullDidEnd:result:url:);
+    
     static NSString* const kMessage[] = {@"Pulling from <%@>", @"Pushing to <%@>", @"Cloning to <%@>"};
     // NSLocalizedString(@"Pulling from <%@>", @"Progress message during Pull command")
     // NSLocalizedString(@"Pushing to <%@>", @"Progress message during Push command")
     [other showWindow: self];
 }
 
+//** Added by Robin
+- (void) _pullDidEnd: (NSPanel*)sheet result: (int)result url: (NSURL*)url
+{
+    
+    [self _closeProgressSheet];
+    
+    // get current RepoController and reload
+    RepoController *current = [[self class] existingRepoControllerWithDirectory: [_repo absolutePath]];
+    NSError *error;
+    if( current ) {
+        [current showWindow: self];
+        [current awakeFromNib];
+        [current.repository updateStatus: &error];
+    }
+    
+}
+/////////////////
 
 #pragma mark -
 #pragma mark ADD / REMOVE / DISCARD:
                                        nil, nil, nil, self.window, nil, NULL, NULL, NULL,
                                        @"%@", output);
         
+        // get current RepoController and reload
+        RepoController *current = [[self class] existingRepoControllerWithDirectory: [_repo absolutePath]];
+        NSError *_error;
+        if( current ) {
+            [current showWindow: self];
+            [current awakeFromNib];
+            [current.repository updateStatus: &_error];
+        }
+        if (_error) {
+            [self presentError: _error];
+        }
     } else        
         [self presentError: error];
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.