Jens Alfke avatar Jens Alfke committed 2dda2f0

Fixed: Conflict/merge support didn't recognize conflicts between *uncommitted* local changes and newly pulled revisions. Also, the merge-related contextual menu commands didn't work right when right-clicking an unselected row.

Comments (0)

Files changed (3)

 } HgStatus;
 
 typedef enum {
-    kUnmerged,
-    kResolved,
-    kConflict
+    kUnmerged,  // nothing to merge
+    kResolved,  // merge resolved
+    kConflict   // in conflict
 } HgMergeStatus;
 
 

Source/HgRevision.m

     [dir updateStatusFromOutput: [op.output componentsSeparatedByString: @"\n"]
                   isMergeStatus: NO];
 
-    // If this looks like an uncommitted merge, look for conflicts:
-    if (self.isUncommitted && self.parent2) {
+    // Look for merge conflicts:
+    if (self.isUncommitted) {
         LogTo(HgRepository, @"Checking for merge conflicts...");
         op = [[HgOperation alloc] initWithDirectory: self
                                             command: @"resolve", @"-l", nil];

Source/RepoController_Actions.m

 - (NSArray*) _uncommittedSelectedFiles
 {
     if( self.selectedRevision.isUncommitted ) {
-        NSArray *files = [_tree selectedObjects];
+        NSArray *files = self.selectedFiles;
         if( files.count > 0 )
             return files;
     }
     // Merge failed -- was it because of conflicts?
     NSString *title, *message;
     HgUncommittedRevision* cur = _repo.uncommittedRevision;
-    if (cur.parent2 && cur.root.mergeStatus == kConflict) {
+    if (cur.root.mergeStatus == kConflict) {
         title = NSLocalizedString(@"Merge Conflicts Remain",
                                   @"Title of merge-conflicts sheet");
         message = NSLocalizedString(@"The merge is unfinished and has not yet been committed!\n\n"
 // Redo a merge in a graphical compare/merge tool.
 - (IBAction) remergeFiles: (id)sender {
     HgRevision *rev = self.selectedRevision;
-    if( !rev.isUncommitted || !rev.parent2 ) {
+    if( !rev.isUncommitted ) {
         NSBeep();
         return;
     }
     BOOL any = NO;
-    for (HgFile *file in [_tree selectedObjects]) {
+    for (HgFile *file in self.selectedFiles) {
         if (file.isFile && file.mergeStatus == kConflict) {
             any = YES;
             NSError *error;
 
 - (HgMergeStatus) mergeStatusOfSelection {
     HgRevision *rev = self.selectedRevision;
-    if( ! rev.isUncommitted || !rev.parent2 )
+    if( ! rev.isUncommitted )
         return kUnmerged;
-    NSArray *files = [_tree selectedObjects];
+    NSArray *files = self.selectedFiles;
     if (files.count == 0)
         return kUnmerged;
     for (HgFile *file in files) {
     }
 
     NSError *error = nil;
-    if( ! [_repo.uncommittedRevision markFiles: [_tree selectedObjects]
+    if( ! [_repo.uncommittedRevision markFiles: self.selectedFiles
                                       resolved: (status != kResolved)
                                          error: &error] ) {
         [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.