Commits

p2 committed 4fcba47

Dirty source adjustments to make Murky build with SDK 10.7 and in 64 bit

Comments (0)

Files changed (27)

 build
 .svn
 (*)
+*.xcodeproj/xcuserdata
+*.xcworkspace/xcuserdata
 *.pbxuser
 *.perspectivev3
 *.pyc

Murky.xcodeproj/project.pbxproj

 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 44;
+	objectVersion = 46;
 	objects = {
 
 /* Begin PBXBuildFile section */
 		277C52120C56761000E60690 /* HgOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 277C52110C56761000E60690 /* HgOperation.m */; };
 		277D16B90C989715001D8600 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 277D16B80C989715001D8600 /* libicucore.dylib */; };
 		277E134410D5CA3400508D2B /* Murky.icns in Resources */ = {isa = PBXBuildFile; fileRef = 277E134310D5CA3400508D2B /* Murky.icns */; };
-		27874C5E10FBD8BF00F0B178 /* BWToolkitFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27874C3310FBD53400F0B178 /* BWToolkitFramework.framework */; };
-		27874C9310FBDA4800F0B178 /* BWToolkitFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27874C3310FBD53400F0B178 /* BWToolkitFramework.framework */; };
 		279089880FBFD9CC00CEA97E /* RevisionDescriptionTemplate.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 279089860FBFD9CC00CEA97E /* RevisionDescriptionTemplate.rtf */; };
 		27A6B63F0CAC254500482D5D /* RepoController_Actions.m in Sources */ = {isa = PBXBuildFile; fileRef = 27A6B63E0CAC254500482D5D /* RepoController_Actions.m */; };
 		27AA81BC0FADF65500D4FCBB /* CollectionUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 27AA81B50FADF65500D4FCBB /* CollectionUtils.m */; };
 		D095A50E0FBC329500512681 /* status_nottracked.png in Resources */ = {isa = PBXBuildFile; fileRef = D095A50D0FBC329500512681 /* status_nottracked.png */; };
 		D095A5120FBC363100512681 /* status_removed.png in Resources */ = {isa = PBXBuildFile; fileRef = D095A5110FBC363100512681 /* status_removed.png */; };
 		D095A5170FBC376E00512681 /* status_null.png in Resources */ = {isa = PBXBuildFile; fileRef = D095A5160FBC376E00512681 /* status_null.png */; };
+		EE46721213B55AE4001FBD17 /* BWToolkitFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE46721113B55AE4001FBD17 /* BWToolkitFramework.framework */; };
 /* End PBXBuildFile section */
 
-/* Begin PBXContainerItemProxy section */
-		27874C3010FBD53400F0B178 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 27874BFF10FBCE3800F0B178 /* BWToolkit.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = 8D1AC9740486D14A00FE50C9;
-			remoteInfo = BWToolkit;
-		};
-		27874C3210FBD53400F0B178 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 27874BFF10FBCE3800F0B178 /* BWToolkit.xcodeproj */;
-			proxyType = 2;
-			remoteGlobalIDString = 53DF68FD067E5B5A0090B5B0;
-			remoteInfo = BWToolkitFramework;
-		};
-		27AF15471152882200BBA2B7 /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 27874BFF10FBCE3800F0B178 /* BWToolkit.xcodeproj */;
-			proxyType = 1;
-			remoteGlobalIDString = 53DF68FC067E5B5A0090B5B0;
-			remoteInfo = BWToolkitFramework;
-		};
-/* End PBXContainerItemProxy section */
-
 /* Begin PBXCopyFilesBuildPhase section */
 		730B98BD10EF59CC004B9F6E /* Frameworks */ = {
 			isa = PBXCopyFilesBuildPhase;
 			dstPath = "";
 			dstSubfolderSpec = 10;
 			files = (
-				27874C5E10FBD8BF00F0B178 /* BWToolkitFramework.framework in Frameworks */,
 			);
 			name = Frameworks;
 			runOnlyForDeploymentPostprocessing = 0;
 		277D16B80C989715001D8600 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
 		277E134310D5CA3400508D2B /* Murky.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Murky.icns; sourceTree = "<group>"; };
 		277E135C10D5CAD800508D2B /* mercurial-logo-official.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "mercurial-logo-official.icns"; sourceTree = "<group>"; };
-		27874BFF10FBCE3800F0B178 /* BWToolkit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = BWToolkit.xcodeproj; sourceTree = BWToolkit; };
 		279089870FBFD9CC00CEA97E /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/RevisionDescriptionTemplate.rtf; sourceTree = SOURCE_ROOT; };
 		27A6B63E0CAC254500482D5D /* RepoController_Actions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RepoController_Actions.m; sourceTree = "<group>"; };
 		27AA81A50FADF53100D4FCBB /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
 		D095A50D0FBC329500512681 /* status_nottracked.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_nottracked.png; path = Resources/Icons/status_nottracked.png; sourceTree = SOURCE_ROOT; };
 		D095A5110FBC363100512681 /* status_removed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_removed.png; path = Resources/Icons/status_removed.png; sourceTree = SOURCE_ROOT; };
 		D095A5160FBC376E00512681 /* status_null.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = status_null.png; path = Resources/Icons/status_null.png; sourceTree = SOURCE_ROOT; };
+		EE46721113B55AE4001FBD17 /* BWToolkitFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BWToolkitFramework.framework; path = ../BWToolkit/BWToolkitFramework.framework; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				27874C9310FBDA4800F0B178 /* BWToolkitFramework.framework in Frameworks */,
 				8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
 				277D16B90C989715001D8600 /* libicucore.dylib in Frameworks */,
 				73CA82D710135FC10081F0D8 /* ScriptingBridge.framework in Frameworks */,
+				EE46721213B55AE4001FBD17 /* BWToolkitFramework.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 			sourceTree = "<group>";
 			usesTabs = 0;
 		};
-		27874C2B10FBD53400F0B178 /* Products */ = {
-			isa = PBXGroup;
-			children = (
-				27874C3110FBD53400F0B178 /* BWToolkit.ibplugin */,
-				27874C3310FBD53400F0B178 /* BWToolkitFramework.framework */,
-			);
-			name = Products;
-			sourceTree = "<group>";
-		};
 		27AA81B30FADF60100D4FCBB /* MYUtilities */ = {
 			isa = PBXGroup;
 			children = (
 		29B97323FDCFA39411CA2CEA /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
-				27874BFF10FBCE3800F0B178 /* BWToolkit.xcodeproj */,
+				EE46721113B55AE4001FBD17 /* BWToolkitFramework.framework */,
 				73CA82D610135FC10081F0D8 /* ScriptingBridge.framework */,
 				277D16B80C989715001D8600 /* libicucore.dylib */,
 				29B97324FDCFA39411CA2CEA /* AppKit.framework */,
 			buildRules = (
 			);
 			dependencies = (
-				27AF15481152882200BBA2B7 /* PBXTargetDependency */,
 			);
 			name = Murky;
 			productInstallPath = "$(HOME)/Applications";
 /* Begin PBXProject section */
 		29B97313FDCFA39411CA2CEA /* Project object */ = {
 			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0410;
+			};
 			buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Murky" */;
-			compatibilityVersion = "Xcode 3.0";
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
+			knownRegions = (
+				en,
+			);
 			mainGroup = 29B97314FDCFA39411CA2CEA /* MercurialViewer */;
 			projectDirPath = "";
-			projectReferences = (
-				{
-					ProductGroup = 27874C2B10FBD53400F0B178 /* Products */;
-					ProjectRef = 27874BFF10FBCE3800F0B178 /* BWToolkit.xcodeproj */;
-				},
-			);
 			projectRoot = "";
 			targets = (
 				8D1107260486CEB800E47090 /* Murky */,
 		};
 /* End PBXProject section */
 
-/* Begin PBXReferenceProxy section */
-		27874C3110FBD53400F0B178 /* BWToolkit.ibplugin */ = {
-			isa = PBXReferenceProxy;
-			fileType = wrapper.cfbundle;
-			path = BWToolkit.ibplugin;
-			remoteRef = 27874C3010FBD53400F0B178 /* PBXContainerItemProxy */;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-		27874C3310FBD53400F0B178 /* BWToolkitFramework.framework */ = {
-			isa = PBXReferenceProxy;
-			fileType = wrapper.framework;
-			path = BWToolkitFramework.framework;
-			remoteRef = 27874C3210FBD53400F0B178 /* PBXContainerItemProxy */;
-			sourceTree = BUILT_PRODUCTS_DIR;
-		};
-/* End PBXReferenceProxy section */
-
 /* Begin PBXResourcesBuildPhase section */
 		8D1107290486CEB800E47090 /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = /bin/sh;
-			shellScript = "# -q silences duplicate comments with same key warning\n./Localize.py --to English --genstrings \"./**/*.[hm]\" --utf8\n\n# Localize nibs\n./Localize.py --from English --to \"French|German\" --utf8\n";
+			shellScript = "echo -n \"Localizing...\"\n\n# -q silences duplicate comments with same key warning\n./Localize.py --to English --genstrings \"./**/*.[hm]\" --utf8\n\n# Localize nibs\n./Localize.py --from English --to \"French|German\" --utf8\n\necho \" done\"";
 		};
 /* End PBXShellScriptBuildPhase section */
 
 		};
 /* End PBXSourcesBuildPhase section */
 
-/* Begin PBXTargetDependency section */
-		27AF15481152882200BBA2B7 /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			name = BWToolkitFramework;
-			targetProxy = 27AF15471152882200BBA2B7 /* PBXContainerItemProxy */;
-		};
-/* End PBXTargetDependency section */
-
 /* Begin PBXVariantGroup section */
 		279089860FBFD9CC00CEA97E /* RevisionDescriptionTemplate.rtf */ = {
 			isa = PBXVariantGroup;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SRCROOT)\"",
+					"\"$(SRCROOT)/../BWToolkit\"/**",
 				);
 				INFOPLIST_FILE = Resources/Info.plist;
 				INSTALL_PATH = "$(HOME)/Applications";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"\"$(SRCROOT)\"",
+					"\"$(SRCROOT)/../BWToolkit\"/**",
 				);
 				INFOPLIST_FILE = Resources/Info.plist;
 				INSTALL_PATH = "$(HOME)/Applications";
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 27AA81C50FADF83000D4FCBB /* MYUtilities_Debug.xcconfig */;
 			buildSettings = {
+				ARCHS = "$(NATIVE_ARCH_ACTUAL)";
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_DYNAMIC_NO_PIC = YES;
 				GCC_ENABLE_OBJC_GC = required;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = Source/Murky_Prefix.pch;
-				GCC_VERSION = 4.2;
-				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
+				SDKROOT = macosx;
 			};
 			name = Debug;
 		};
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 27AA81C60FADF83000D4FCBB /* MYUtilities_Release.xcconfig */;
 			buildSettings = {
-				ARCHS = (
-					ppc,
-					i386,
-				);
+				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
 				GCC_DYNAMIC_NO_PIC = YES;
 				GCC_ENABLE_OBJC_GC = required;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = Source/Murky_Prefix.pch;
-				GCC_VERSION = 4.2;
-				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
+				SDKROOT = macosx;
 			};
 			name = Release;
 		};

Murky.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:Murky.xcodeproj">
+   </FileRef>
+</Workspace>
 = BUILDING IT =
 
 System requirements:
-    - Mac OS X 10.5+
-    - Apple's Xcode tools, version 3.1+
+    - Mac OS X 10.6+
+    - Apple's Xcode tools, version 4+
 
 Dependencies:
     - Mercurial, of course <http://mercurial.selenic.com/downloads/>
     *** PLEASE READ THIS FIRST! ***
     Before the first time you build, you'll need to tell Xcode where the MYUtilities sources are. 
     You do this by setting up a named 'Source Tree':
+	
+	*** NOTE: Update instructions for Xcode 4 ***
+	a) MYUtilities auto-download if you checkout with Mercurial
+	b) For now uses the packaged BWToolkit, the dependency has been removed. Make sure it's in Framework search paths
 
  1. Clone or download MYUtilities
  2. Clone or download BWToolkit.
  7. Repeat steps 5-6 to add a new item named "BWToolkit", whose path points to
     where you put BWToolkit.
     
+ (! ibplugins are currently not supported in Xcode 4:)
  You'll also need to install the BWToolkit Interface Builder plugin:
     
  1. Open BWToolkit.xcodeproj and build it in 'Release' mode.

Resources/Info.plist

 <dict>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>English</string>
-	<key>NSHumanReadableCopyright</key>
-	<string>© Jens Alfke, 2008-2010</string>
 	<key>CFBundleDocumentTypes</key>
 	<array>
 		<dict>
 	<string>${PRODUCT_NAME}</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>0.8.4</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleVersion</key>
-	<string>0.8.3</string>
-	<key>CFBundleShortVersionString</key>
-	<string>0.8.3</string>
+	<string>0.8.4</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>© Jens Alfke, 2008-2010</string>
 	<key>NSMainNibFile</key>
 	<string>MainMenu</string>
 	<key>NSPrincipalClass</key>

Source/FileViewer.m

 #import "HgRevision.h"
 #import "HgRepository.h"
 #import "SourceHighlighting.h"
+#import <tgmath.h>
 
 
 @interface FileViewer ()
     [self setTextWraps: NO];
     
     HgRepository *repository = file.repository;
-    int nRevisions = repository.revisions.count;
+    NSInteger nRevisions = repository.revisions.count;
     _revisionSlider.maxValue = nRevisions - 1;
     
     NSMutableArray *revisions = [file.revisions mutableCopy];
                 source = error.localizedRecoverySuggestion;
             text = AttributedStringForSourceCode(source);
             if (!error) {
-                int maxRev = _file.repository.revisions.count-1;
-                int revNo = revision.localNumber;
+                NSInteger maxRev = _file.repository.revisions.count-1;
+                NSInteger revNo = revision.localNumber;
                 if (revNo == NSNotFound)
                     revNo = maxRev;
                 HighlightAnnotatedFile(text, revNo, maxRev, self.revTooltips);
     if (revision.isUncommitted) {
         _revisionSlider.intValue = (int)_revisionSlider.maxValue;
     } else {
-        _revisionSlider.intValue = revision.localNumber;
+        _revisionSlider.intValue = (int)revision.localNumber;
         name = [name stringByAppendingFormat: @" r%i", revision.localNumber];
     }
     self.window.title = $sprintf(NSLocalizedString(@"%@ in %@",
         self.file = file;
 }
 
-- (BOOL) skipRevision: (int)delta {
+- (BOOL) skipRevision: (NSInteger)delta {
     NSArray *revisions = [_revisionSlider.cell revisions];
-    int index = [revisions indexOfObject: self.revision];
+    NSInteger index = [revisions indexOfObject: self.revision];
     if (index==NSNotFound)
         return NO;
     index += delta;
-    if (index<0 || index>=(int)revisions.count)
+    if (index<0 || index>=(NSInteger)revisions.count)
         return NO;
     self.revision = [revisions objectAtIndex: index];
     return YES;
 
 
 - (IBAction) sliderChanged: (id)sender {
-    int revNo = _revisionSlider.intValue;
+    NSInteger revNo = _revisionSlider.intValue;
     self.revision = [[_file.repository revisions] objectAtIndex: revNo];
 }
 
 }
 
 - (double)tickMarkValueAtIndex:(NSInteger)index {
-    int revNo = [[_revisions objectAtIndex: index] localNumber];
+    NSInteger revNo = [[_revisions objectAtIndex: index] localNumber];
     if (revNo == NSNotFound)
-        revNo = (int) self.maxValue;
+        revNo = (NSInteger) self.maxValue;
     return revNo;
 }
 
 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
-    float xClear = cellFrame.origin.x - 1;
-    int i = 0;
+    CGFloat xClear = cellFrame.origin.x - 1;
+    NSInteger i = 0;
     for (HgRevision *rev in _revisions) {
         NSRect r = [self rectOfTickMarkAtIndex: i++];
         if (rev.localNumber == self.intValue)
         NSPoint org = {cellFrame.origin.x + r.origin.x - 2,
                        cellFrame.origin.y + r.origin.y + 4};
         NSString *label = rev.localString;
-        float width = [label sizeWithAttributes: sTickAttrs].width;
-        org.x = org.x + 2.0f - floorf(width/2.0f);      // center
+        CGFloat width = [label sizeWithAttributes: sTickAttrs].width;
+        org.x = org.x + 2.0f - floor(width/2.0f);      // center
         org.x = MIN(org.x, NSMaxX([controlView bounds]) - width);  // pin to right edge
         if (org.x >= xClear) {  // don't let labels overlap
             [label drawAtPoint: org withAttributes: sTickAttrs];
     [super drawKnob: knobRect];
     
     // Don't show the uncommitted revision
-    int revNo = self.intValue;
+    NSInteger revNo = self.intValue;
     if (revNo == self.maxValue) {
         HgRevision *lastRev = _revisions.lastObject;
         if (lastRev.isUncommitted)
     // Else show the revision number in the knob:
     NSString *label = $sprintf(@"%i", self.intValue);
     NSSize size = [label sizeWithAttributes: sTickAttrs];
-    NSPoint org = {roundf(NSMidX(knobRect) - size.width/2.0f),
-                   roundf(NSMidY(knobRect) - size.height/2.0f)};
+    NSPoint org = {round(NSMidX(knobRect) - size.width/2.0f),
+                   round(NSMidY(knobRect) - size.height/2.0f)};
     [label drawAtPoint: org withAttributes: sTickAttrs];
 }
 

Source/HgConfigFile.m

 
 - (void) sync
 {
-    NSDictionary *attrs = [[NSFileManager defaultManager] fileAttributesAtPath: _path traverseLink: YES];
+    NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath: _path error: nil];
     NSDate *modDate = attrs.fileModificationDate;
     CFAbsoluteTime modTime = modDate ?modDate.timeIntervalSinceReferenceDate :0.0;
     if( modTime != _modTime ) {
 
 - (void) _computeStatus
 {
-    int maxPos = -1;
+    NSInteger maxPos = -1;
     HgMergeStatus maxMergeStatus = kUnmerged;
     for( HgFile *file in _files ) {
         if( file.isDirectory )
 {
     HgFile *file = self;
     NSArray *components = [path componentsSeparatedByString: @"/"];
-    unsigned n = components.count;
-    for( unsigned i=0; i<n; i++ ) {
+    NSUInteger n = components.count;
+    for( NSUInteger i=0; i<n; i++ ) {
         NSString *name = [components objectAtIndex: i];
         if( name.length > 0 ) {
             BOOL isDir = (i<n-1);
 
 - (NSDictionary*) fileAttributes
 {
-    return [[NSFileManager defaultManager] fileAttributesAtPath: self.absolutePath traverseLink: YES];
+    return [[NSFileManager defaultManager] attributesOfItemAtPath: self.absolutePath error: nil];
 }
 
 - (CFAbsoluteTime) modTime
 + (NSArray*) keyPathsForValuesAffectingIsUncommitted  {return [NSArray arrayWithObject: @"status"];}
 
 
-- (int) compare: (id)object
+- (NSComparisonResult) compare: (id)object
 {
     return [_name caseInsensitiveCompare: [object name]];
 }

Source/HgLogOperation.h

 - (id) initIncomingWithRepository: (HgRepository*)repo
                         otherRepo: (NSURL*)otherRepo;
 
-//@property unsigned limit;
+//@property NSUInteger limit;
 @property NSRange range;
 
 @property (readonly,nonatomic) NSArray* revisions;

Source/HgLogOperation.m

 {
     *outID = kZeroRevisionID;
     NSString *str = [[xml attributeForName: attr] stringValue];
-    unsigned len = str.length;
+    NSUInteger len = str.length;
     if( len != 40 ) {
         if( len>0 )
             Warn(@"Revision ID has wrong length (%u)",len);
 #pragma mark XML PARSING:
 
 
-- (HgRevision*) _revisionWithNumber: (int)revNo
+- (HgRevision*) _revisionWithNumber: (NSInteger)revNo
 {
     if( revNo < 0 )
         return nil;
     NSArray *revs = _repository.revisions;
-    if( (unsigned)revNo < revs.count ) {
+    if( (NSUInteger)revNo < revs.count ) {
         HgRevision *rev = [revs objectAtIndex: revNo];
         if (!rev.isUncommitted)
             return rev;
     }
-    return [_revsByNumber objectForKey: [NSNumber numberWithInt: revNo]];
+    return [_revsByNumber objectForKey: [NSNumber numberWithInteger: revNo]];
 }
 
 
     // Link to its parent(s):
     if( revision.localNumber > 0 ) {
         NSArray *parents = stringsForXPath(changeset,@"parent/@rev");
-        int parent;
+        NSInteger parent;
         if( parents.count > 0 ) {
             parent = [[parents objectAtIndex: 0] intValue];
             if( parents.count > 1 ) {
-                int parent2 = [[parents objectAtIndex: 1] intValue];
+                NSInteger parent2 = [[parents objectAtIndex: 1] intValue];
                 revision.parent2 = [self _revisionWithNumber: parent2];
             }
         } else
     _revisions = [NSMutableArray array];
     _revsByNumber = [NSMutableDictionary dictionary];
     for (NSXMLElement *changeset in changesets) {
-        int revNo = [[[changeset attributeForName: @"rev"] stringValue] intValue];
+        NSInteger revNo = [[[changeset attributeForName: @"rev"] stringValue] intValue];
         HgRevisionID nodeID;
         if( ! identifierFromAttribute(changeset,@"node",&nodeID) )
             return [self makeError: @"HgLogOperation couldn't get changeset ID for rev #%i",revNo];
                                                    identifier: nodeID];
         }
         [_revisions addObject: revision];
-        [_revsByNumber setObject: revision forKey: [NSNumber numberWithInt: revNo]];
+        [_revsByNumber setObject: revision forKey: [NSNumber numberWithInteger: revNo]];
     }
     
     // Now update the revisions' attributes (and parent links) from the XML:
-    int i = 0;
+    NSInteger i = 0;
     for (NSXMLElement *changeset in changesets) {
         HgRevision *revision = [_revisions objectAtIndex: i++];
         [self _updateRevision: revision fromChangeset: changeset];

Source/HgProject.h

 @property (readonly) NSString *uuid;
 
 - (BOOL) addChild: (HgProject*)child;
-- (BOOL) addChild: (HgProject*)child atIndex: (unsigned)index;
+- (BOOL) addChild: (HgProject*)child atIndex: (NSUInteger)index;
 - (BOOL) addChild: (HgProject*)child afterChild: (HgProject*)afterChild;
 - (BOOL) removeChild: (HgProject*)child;
 - (BOOL) removeDescendent: (HgProject*)descendent;

Source/HgProject.m

     return [self addChild: child atIndex: _children.count];
 }
 
-- (BOOL) addChild: (HgProject*)child atIndex: (unsigned)index
+- (BOOL) addChild: (HgProject*)child atIndex: (NSUInteger)index
 {
     if( _children && [_children indexOfObjectIdenticalTo: child]==NSNotFound ) {
         NSIndexSet *indexes = [NSIndexSet indexSetWithIndex: index];
 
 - (BOOL) addChild: (HgProject*)child afterChild: (HgProject*)afterChild
 {
-    unsigned index;
+    NSUInteger index;
     if (afterChild) {
         index = [_children indexOfObjectIdenticalTo: afterChild];
         if (index==NSNotFound)
 - (BOOL) removeChild: (HgProject*)child
 {
     if (_children) {
-        unsigned index = [_children indexOfObjectIdenticalTo: child];
+        NSUInteger index = [_children indexOfObjectIdenticalTo: child];
         if( index != NSNotFound ) {
             NSIndexSet *indexes = [NSIndexSet indexSetWithIndex: index];
             [self willChange: NSKeyValueChangeInsertion valuesAtIndexes: indexes forKey: @"children"];

Source/HgRepository.m

 
 
 /** Returns the local revision number of the tip, or NSNotFound if there are no revisions */
-- (int) _getTip
+- (NSInteger) _getTip
 {
     NSArray *revs = [self _getRevNumbers: @"tip"];
     if( revs.count > 1 )
 /** Gets the parent(s) of the current revision. Returns NO on failure.
     *outRev2 will be -1 unless the current revision is a merge.
     *outRev1 will be -1 if the repository is new and has no committed revisions yet. */
-- (BOOL) _getParent1: (int*)outRev1 parent2: (int*)outRev2
+- (BOOL) _getParent1: (NSInteger*)outRev1 parent2: (NSInteger*)outRev2
 {
     *outRev1 = *outRev2 = -1;
     NSArray *revs = [self _getRevNumbers: @"parents"];
 {
     // Run "hg parents" to get current revision number:
     NSError *error;
-    int curRevNo, curParent2;
+    NSInteger curRevNo, curParent2;
     if( ! [self _getParent1: &curRevNo parent2: &curParent2] )
         return NO;
     
     HgRevision *parent2Rev = _uncommittedRevision.parent2;
-    int parent2 = parent2Rev ?parent2Rev.localNumber :-1;
+    NSInteger parent2 = parent2Rev ?parent2Rev.localNumber :-1;
 
     // Run "hg tip" to get tip revision number:
-    int tip = [self _getTip];
+    NSInteger tip = [self _getTip];
     if( tip==NSNotFound )
         return NO;
     
     NSMutableArray *nuRevisions = [_revisions mutableCopy];
     
     HgRevision *tipRevision = self.tipRevision;
-    int curTip = tipRevision ?tipRevision.localNumber :-1;
+    NSInteger curTip = tipRevision ?tipRevision.localNumber :-1;
     if( tip > curTip ) {
         // New revisions have been added!
         LogTo(HgRepository,@"_checkRevisions: Tip changed from %i to %i (cur=%i) ... updating revisions", curTip,tip, curRevNo);
 
 /** Batch-loads the detail info of a range of revisions. */
 - (BOOL) getDetailsOfRevisions: (NSRange)revNoRange {
-    unsigned nRevisions = _revisions.count;
+    NSUInteger nRevisions = _revisions.count;
     if (nRevisions > 0 && [[_revisions lastObject] isUncommitted])
         nRevisions--;
     Assert(revNoRange.location < nRevisions, @"Invalid start revision");
 
 - (HgRevision*) tipRevision
 {
-    unsigned n = _revisions.count;
+    NSUInteger n = _revisions.count;
     if( n==0 )
         return nil;
     HgRevision *r = [self.revisions objectAtIndex: n-1];

Source/HgRevision.h

 @interface HgRevision : NSObject <NSCopying>
 {
     HgRepository *_repository;
-    int _localNumber;
+    NSInteger _localNumber;
     NSString *_comment, *_shortComment, *_author, *_email, *_branch;
     NSDate *_date;
     HgRevisionID _identifier;
 }
 
 - (id) initWithRepository: (HgRepository*)repository
-              localNumber: (int)revision
+              localNumber: (NSInteger)revision
                identifier: (HgRevisionID)myID;
 
 @property (readonly,nonatomic)  HgRepository *repository;
 @property (readonly,nonatomic)  BOOL isUncommitted;     // YES if this represents an uncommitted local change
 @property (readonly,nonatomic)  BOOL isHead;            // YES if this has no children
-@property (readonly,nonatomic)  int localNumber;
+@property (readonly,nonatomic)  NSInteger localNumber;
 @property (readonly,nonatomic)  HgRevisionID identifier;
 @property (readonly,nonatomic)  NSString *identifierString, *localString;
 @property (copy,nonatomic)      NSString *comment, *author, *email, *branch;
 
 - (NSData*) getFileContents: (HgFile*)file error: (NSError**)outError;
 - (NSString*) getPathToFileContents: (HgFile*)file inTempDir: (HgTempDir*)tempDir error: (NSError**)outError;
-- (NSString*) diffFile: (HgFile*)file withRevisionNumber: (int)otherRev error: (NSError**)outError;
+- (NSString*) diffFile: (HgFile*)file withRevisionNumber: (NSInteger)otherRev error: (NSError**)outError;
 - (NSString*) diffFile: (HgFile*)file withRevision: (HgRevision*)other error: (NSError**)outError;
-- (NSString*) compareFile: (HgFile*)file withRevisionNumber: (int)otherRev error: (NSError**)outError;
+- (NSString*) compareFile: (HgFile*)file withRevisionNumber: (NSInteger)otherRev error: (NSError**)outError;
 - (NSString*) annotateFile: (HgFile*)file error: (NSError**)outError;
 
 - (NSArray*) outgoingRevisionsForRepository: (NSURL*)otherRepo;

Source/HgRevision.m

 static NSString* StringFromHgRevisionID( HgRevisionID r )
 {
     NSMutableString *str = [NSMutableString string];
-    for( int i=0; i<20; i++ ) {
-        [str appendFormat: @"%02x", (unsigned)r.bytes[i]];
+    for( NSInteger i=0; i<20; i++ ) {
+        [str appendFormat: @"%02x", (NSUInteger)r.bytes[i]];
     }
     return str;
 }
 
 
 - (id) initWithRepository: (HgRepository*)repository
-              localNumber: (int)revision
+              localNumber: (NSInteger)revision
                identifier: (HgRevisionID)myID
 {
     Assert(repository);
 
 - (NSComparisonResult) compare: (HgRevision*)rev
 {
-    return (int)_localNumber - (int)rev.localNumber;
+    return (NSInteger)_localNumber - (NSInteger)rev.localNumber;
 }
 
 
 }
 
 
-- (NSString*) diffFile: (HgFile*)file withRevisionNumber: (int)otherRev error: (NSError**)outError
+- (NSString*) diffFile: (HgFile*)file withRevisionNumber: (NSInteger)otherRev error: (NSError**)outError
 {
     Assert(otherRev>=0 && otherRev!=NSNotFound);
     if( otherRev==_localNumber )
 }
 
 
-- (NSString*) compareFile: (HgFile*)file withRevisionNumber: (int)otherRev error: (NSError**)outError
+- (NSString*) compareFile: (HgFile*)file withRevisionNumber: (NSInteger)otherRev error: (NSError**)outError
 {
     Assert(otherRev>=0 && otherRev!=NSNotFound);
     if( otherRev==_localNumber )

Source/HgUncommittedRevision.m

 #pragma mark FILE OPERATIONS:
 
 
-- (NSString*) diffFile: (HgFile*)file withRevisionNumber: (int)otherRev error: (NSError**)outError
+- (NSString*) diffFile: (HgFile*)file withRevisionNumber: (NSInteger)otherRev error: (NSError**)outError
 {
     if( otherRev==_localNumber )
         return @"";

Source/IconTextCell.m

 
 #import "IconTextCell.h"
 
-void defineTextAndIconRects(NSRect cellRect, NSRect *imageRect, NSRect *stringRect, float stringHeight);
+void defineTextAndIconRects(NSRect cellRect, NSRect *imageRect, NSRect *stringRect, CGFloat stringHeight);
 
 @implementation IconTextCell
 
 
 - (void)drawInteriorWithFrame:(NSRect)aRect inView:(NSView *)controlView {
 	NSRect imgRect, strRect;
-	float strHeight = [[self attributedStringValue] size].height;
+	CGFloat strHeight = [[self attributedStringValue] size].height;
 	defineTextAndIconRects(aRect, &imgRect, &strRect, strHeight);
 	
 	if([[self controlView] isFlipped])
 	[[self attributedStringValue] drawInRect:strRect];
 }
 
-- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength {
+- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength {
 	NSRect imgRect, strRect;
-	float strHeight = [[self attributedStringValue] size].height;
+	CGFloat strHeight = [[self attributedStringValue] size].height;
 	defineTextAndIconRects(aRect, &imgRect, &strRect, strHeight);
 	
 	[super selectWithFrame:strRect inView:controlView editor:textObj delegate:anObject start:selStart length:selLength];
 
 @end
 
-void defineTextAndIconRects(NSRect cellRect, NSRect *imageRect, NSRect *stringRect, float stringHeight) {
-	float cellHeight = cellRect.size.height;
+void defineTextAndIconRects(NSRect cellRect, NSRect *imageRect, NSRect *stringRect, CGFloat stringHeight) {
+	CGFloat cellHeight = cellRect.size.height;
 	
 	NSDivideRect(cellRect, imageRect, stringRect, cellHeight, NSMinXEdge);
 	

Source/MercurialApp.m

 - (IBAction) runNewPanel: (id)sender
 {
     NSSavePanel *panel = [NSSavePanel savePanel];
-    if( [panel runModalForDirectory: nil file: nil] == NSOKButton ) {
-        NSString *path = [panel filename];
-        [[NSFileManager defaultManager] createDirectoryAtPath: path attributes:nil];
-        [self openRepository: path remember: YES];
+    if( [panel runModal] == NSOKButton ) {
+        NSString *path = [panel.URL path];
+        [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil];
+        [self openRepository:path remember:YES];
     
     }
 
     panel.canChooseFiles = NO;
     panel.canChooseDirectories = YES;
     panel.allowsMultipleSelection = NO;
-    if( [panel runModalForDirectory: nil file: nil types: nil] == NSOKButton ) {
-        NSString *path = [[panel filenames] objectAtIndex: 0];
+    if( [panel runModal] == NSOKButton && [panel.URLs count] > 0 ) {
+        NSString *path = [panel.URLs objectAtIndex: 0];
         [self openRepository: path remember: YES];
     }
 }
     NSString *selectedEditorID = [[NSUserDefaults standardUserDefaults] stringForKey:kPrefPreferredTextEditorID];
     if (!selectedEditorID)
         selectedEditorID = @"com.apple.TextEdit";
-    int selectedItemIndex = [editorIDs indexOfObject:selectedEditorID];
+    NSInteger selectedItemIndex = [editorIDs indexOfObject:selectedEditorID];
     if (selectedItemIndex == NSNotFound)
         selectedItemIndex = 0;
     [_textEditorPreferenceButton selectItemAtIndex:selectedItemIndex];
 }
 
 - (IBAction) selectTextEditor:(id)sender {
-    int selectedIndex = [_textEditorPreferenceButton indexOfSelectedItem];
+    NSInteger selectedIndex = [_textEditorPreferenceButton indexOfSelectedItem];
     NSString *editorID = [[[self supportedTextEditors] valueForKeyPath:@"@unionOfObjects.editorID"] objectAtIndex:selectedIndex];
     [[NSUserDefaults standardUserDefaults] setObject: editorID
                                               forKey: kPrefPreferredTextEditorID];

Source/ProjectsController.m

 static NSMutableArray *sDraggingProjects;
 
 
-- (int) _typeOfDrag: (id<NSDraggingInfo>)info
+- (NSInteger) _typeOfDrag: (id<NSDraggingInfo>)info
 {
     NSString *type = [[info draggingPasteboard] availableTypeFromArray: kDropTypes];
     if( type )
         
         for( HgProject *child in projects ) {
             Log(@"    add %@ to %@ at %i", child,dstParent,index);
-            if ([dstParent.children indexOfObjectIdenticalTo: child] < (unsigned)index)
+            if ([dstParent.children indexOfObjectIdenticalTo: child] < (NSUInteger)index)
                 index--;
             [_root removeDescendent: child];
             if( [dstParent addChild: child atIndex: index] )
 - (HgProject*) selectedProject
 {
     // During a right-click, use the clicked row if it's not selected:
-    int row = _outline.clickedRow;
+    NSInteger row = _outline.clickedRow;
     if( row >= 0 && ! [_outline isRowSelected: row] )
         return [[_outline itemAtRow: row] representedObject];
     else {

Source/RepoController.m

 @interface RepoController ()
 - (void) _updateWindowTitle;
 - (void) _expandPaths;
+- (void)tableView:(NSTableView *)tableView didClickTableColumn:(NSTableColumn *)tableColumn;
 @end
 
 
     }
     HgRepository *repo = [[HgRepository alloc] initWithPath: path localPath: NULL];
     if( ! repo ) {
-        int result = NSRunAlertPanel(NSLocalizedString(@"Convert to Mercurial repository?", 
+        NSInteger result = NSRunAlertPanel(NSLocalizedString(@"Convert to Mercurial repository?", 
                                                        @"Title of conversion alert from Open command"), 
                                      NSLocalizedString(@"The directory <%@> is not already a Mercurial repository. Would you like to make it one?", 
                                                        @"Body of conversion alert from Open command"),
 {
     if( ! self.showsOnlyUncleanFiles ) {
         _expandedPaths = [NSMutableArray array];
-        unsigned nRows = [_outline numberOfRows];
-        for( unsigned row=0; row<nRows; row++ ) {
+        NSUInteger nRows = [_outline numberOfRows];
+        for( NSUInteger row=0; row<nRows; row++ ) {
             NSTreeNode *item = [_outline itemAtRow: row];
             if( [_outline isItemExpanded: item] )
                 [_expandedPaths addObject: [[item representedObject] path]];
     [self setValue: _expandedPaths forSetting: @"ExpandedPaths"];
 }
 
-static NSString* modifiedString(unsigned n) {
+static NSString* modifiedString(NSUInteger n) {
     if (n == 0)
         return nil;
     NSString *format;
     return [NSString stringWithFormat: format, n];
 }
 
-static NSString* conflictString(unsigned n) {
+static NSString* conflictString(NSUInteger n) {
     if (n == 0)
         return nil;
     NSString *format;
 - (void) _updateViewModeButtonTitle
 {
     NSArray *modified = self.selectedRevision.uncleanFiles;
-    unsigned nConflicts = 0;
+    NSUInteger nConflicts = 0;
     for (HgFile *file in modified)
         if (file.mergeStatus == kConflict)
             nConflicts++;
 - (NSArray*) selectedFiles
 {
     // During a right-click, use the clicked row if it's not selected:
-    int row = _outline.clickedRow;
+    NSInteger row = _outline.clickedRow;
     if( row >= 0 && ! [_outline isRowSelected: row] )
         return [NSArray arrayWithObject: [[_outline itemAtRow: row] representedObject]];
     

Source/RepoController_Actions.m

     return YES;
     /*
     NSArray *revisions = file.revisions;
-    unsigned nRevisions = revisions.count;
+    NSUInteger nRevisions = revisions.count;
     if( nRevisions < 2 )
         return NO;
     *outNew = [revisions lastObject];
         case 1: {
             // One selection: diff it against previous
             *outNew = [sel objectAtIndex: 0];
-            unsigned selIndex = [revisions indexOfObject: *outNew];
+            NSUInteger selIndex = [revisions indexOfObject: *outNew];
             if( selIndex==0 || selIndex==NSNotFound )
                 return NO;
             *outOld = [revisions objectAtIndex: selIndex-1];
         if( file.isFile ) {
             if( file.status==kModified ) {
                 NSArray *revisions = file.revisions;
-                unsigned n = revisions.count;
+                NSUInteger n = revisions.count;
                 if( ! [self showComparisonFromRevision: [revisions objectAtIndex: n-2]
                                             toRevision: [revisions objectAtIndex: n-1]
                                                 ofFile: file
 
 - (IBAction) stopProgress: (id)sender
 {
-    int button = NSOKButton;
+    NSInteger button = NSOKButton;
     if( self.currentOperation.isRunning ) {
         self.currentOperation.stop;
         button = NSCancelButton;
 #pragma mark COMMIT / PUSH / PULL:
 
 
-static BOOL isFileStatus( id file, void *status ) {
+static BOOL isFileStatus( HgFile *file, void *status ) {
     return [file status] == (HgStatus)status;
 }
 
 }
 
 
-- (void) _endCommitWarnSheet: (NSPanel*)sheet resultCode: (int)result context: (NSArray*)files
+- (void) _endCommitWarnSheet: (NSPanel*)sheet resultCode: (NSInteger)result context: (NSArray*)files
 {
     [sheet orderOut: self];
     if( result == NSOKButton )
         self.showsOnlyUncleanFiles = YES;
         [_outline deselectAll: self];
         for( HgFile *file in unknown ) {
-            int row = [revision.uncleanFiles indexOfObjectIdenticalTo: file];
-            if( row != NSNotFound )
-                [_outline selectRow: row byExtendingSelection: YES];
+            NSInteger row = [revision.uncleanFiles indexOfObjectIdenticalTo: file];
+            if (row != NSNotFound) {
+                NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:row];
+                [_outline selectRowIndexes:indexes byExtendingSelection:YES];
+            }
         }
         
         NSBeginCriticalAlertSheet(NSLocalizedString(@"Some files aren't in the repository", 
     _repo.uncommittedRevision.formattedDescription = _commitMessageField.string;
     BOOL ok = YES;
     NSButton *button = sender;
-    int returnCode = button.tag;
+    NSInteger returnCode = button.tag;
     if( returnCode == NSOKButton ) {
         NSWindow *sheet = [sender window];
         if( sheet==_commitSheet )
         NSBeep();
 }
 
-- (void) _commitSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
+- (void) _commitSheetDidEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode context: (void*)context
 {
     [sheet orderOut: self];
     if( returnCode == NSOKButton ) {
 
 - (IBAction) pushPullRevisions: (id)sender
 {
-    HgTransferOp op = [sender tag];
+    HgTransferOp op = (int)[sender tag];
     NSString *defaultURL, *desc, *buttonTitle;
     switch( op ) {
         case kHgPush: 
     [URLFormatter beginFilePickerFor: _pushURLField];
 }
 
-- (void) _pushSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
+- (void) _pushSheetDidEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode context: (void*)context
 {
     [sheet orderOut: self];
     if( returnCode != NSOKButton )
                              context: url];
 }
 
-- (void) _pullDidEnd: (NSPanel*)sheet result: (int)result url: (NSURL*)url
+- (void) _pullDidEnd: (NSPanel*)sheet result: (NSInteger)result url: (NSURL*)url
 {
     [self _closeProgressSheet];
     // Warn the user if a merge is required:
     }
 }
 
-- (void) _postPullSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode {
+- (void) _postPullSheetDidEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode {
     [sheet orderOut: self];
     if (returnCode == NSOKButton) {
         [self merge: self];
     }
 }
 
-- (void) _pushDidEnd: (NSPanel*)sheet result: (int)result url: (NSURL*)url
+- (void) _pushDidEnd: (NSPanel*)sheet result: (NSInteger)result url: (NSURL*)url
 {
     [self _closeProgressSheet];
     // If pushed to a repo open in another window, update that one:
         [other.repository updateStatus: &error];
 }
 
-- (void) _cloneDidEnd: (NSPanel*)sheet result: (int)result url: (NSURL*)url
+- (void) _cloneDidEnd: (NSPanel*)sheet result: (NSInteger)result url: (NSURL*)url
 {
     [self _closeProgressSheet];
     // If cloned to a local filesystem, open the new cloned repo:
                                                     @"Body of Remove alert"));
 }
 
-- (void) _removeSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
+- (void) _removeSheetDidEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode context: (void*)context
 {
     [sheet orderOut: self];
     if( returnCode == NSOKButton ) {
     }
 }
 
-- (void) _removeSheetWithModificationsEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
+- (void) _removeSheetWithModificationsEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode context: (void*)context
 {
     [sheet orderOut: self];
     if( returnCode == NSAlertDefaultReturn || returnCode == NSAlertOtherReturn) {
                                                     @"Body of Discard alert"));
 }
 
-- (void) _discardSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
+- (void) _discardSheetDidEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode context: (void*)context
 {
     [sheet orderOut: self];
     if( returnCode == NSOKButton ) {
                               error.localizedRecoverySuggestion, output);
 }
 
-- (void) mergeConfirmationSheetDidFinish: (NSPanel*)sheet resultCode: (int)resultCode {
+- (void) mergeConfirmationSheetDidFinish: (NSPanel*)sheet resultCode: (NSInteger)resultCode {
     [sheet orderOut: self];
     if (resultCode == NSOKButton) {
         // The user might have gone to Xcode and made changes before pressing Commit,
                               rev.localNumber);
 }
 
-- (void) _updateSheetDidEnd: (NSPanel*)sheet returnCode: (int)returnCode context: (void*)context
+- (void) _updateSheetDidEnd: (NSPanel*)sheet returnCode: (NSInteger)returnCode context: (void*)context
 {
     [sheet orderOut: self];
     if( returnCode == NSOKButton )

Source/RevisionGraphColumn.h

 @interface RevisionGraphColumn : NSObject
 {
     NSArray *_revisions;
-    unsigned _nRevisions;
+    NSUInteger _nRevisions;
     __strong UInt8 *_array;
     __strong UInt64 *_used;
-    int _maxWidth;
+    NSInteger _maxWidth;
     NSMutableSet *_laidOut;
     NSMutableArray *_parent2Queue;
 }
 
 @property (readonly) NSArray *revisions;
 
-- (void) drawRevisionNumber: (unsigned)revNo inRect: (NSRect)bounds flipped: (BOOL)flipped;
+- (void) drawRevisionNumber: (NSUInteger)revNo inRect: (NSRect)bounds flipped: (BOOL)flipped;
 - (void) drawRevision: (HgRevision*)rev inRect: (NSRect)bounds flipped: (BOOL)flipped;
 
 @end
 @interface RevisionGraphCell : NSImageCell
 {
     RevisionGraphColumn *_graph;
-    int _revisionNumber;
+    NSInteger _revisionNumber;
     BOOL _flipped;
 }
 
 @property (copy) NSArray *revisions;
-@property (readwrite) int revisionNumber;
+@property (readwrite) NSInteger revisionNumber;
 @property (readwrite) BOOL flipped;
 
 @end

Source/RevisionGraphColumn.m

 
 #import "RevisionGraphColumn.h"
 #import "HgRevision.h"
+#include <tgmath.h>
 
 
 enum {
 
 @implementation RevisionGraphColumn
 
-- (BOOL) _addLineFrom: (unsigned)rev0 to: (unsigned)rev1
+- (BOOL) _addLineFrom: (NSUInteger)rev0 to: (NSUInteger)rev1
 {
     Assert(rev0>=0&&rev0<_nRevisions,@"bad rev0: %i",rev0);
     Assert(rev1>rev0&&rev1<_nRevisions,@"bad rev1: %i",rev1);
     
     UInt64 used = 0;
-    for( unsigned r=rev0+1; r<rev1; r++ )
+    for( NSUInteger r=rev0+1; r<rev1; r++ )
         used |= _used[r];
     
-    int x;
+    NSInteger x;
     UInt64 mask;
     for( x=0,mask=1; x<_maxWidth; x++, mask <<= 1 ) {
         if( !(used & mask) && !(_array[rev1*_maxWidth + x] & kPrevMask) 
     
     _array[rev0*_maxWidth + x] |= kDotMask | kNextMask;
     _used[rev0] |= mask; 
-    for( unsigned r=rev0+1; r<rev1; r++ ) {
+    for( NSUInteger r=rev0+1; r<rev1; r++ ) {
         _array[r*_maxWidth + x] |= kPrevMask | kNextMask;
         _used[r] |= mask; 
     }
 
 - (BOOL) _layOutFromChild: (HgRevision*)child toParent: (HgRevision*)parent
 {
-    int rev0 = [_revisions indexOfObjectIdenticalTo: parent];
-    int rev1 = [_revisions indexOfObjectIdenticalTo: child];
+    NSInteger rev0 = [_revisions indexOfObjectIdenticalTo: parent];
+    NSInteger rev1 = [_revisions indexOfObjectIdenticalTo: child];
     if( rev0==NSNotFound || rev1==NSNotFound )
         return YES;
     return [self _addLineFrom: rev0 to: rev1];
 
 - (BOOL) _layOut
 {
-    size_t size = _maxWidth*_nRevisions*sizeof(int);
+    size_t size = _maxWidth*_nRevisions*sizeof(NSInteger);
     _array = NSAllocateCollectable(size,0);
     memset(_array, 0, size);
     memset(_used, 0, _nRevisions*sizeof(_used[0]));
     _parent2Queue = [NSMutableArray array];
     //Log(@"layOut: width=%i, nRevisions=%i, size=%u",_maxWidth,_nRevisions,size);
     
-    for( int i=_nRevisions-1; i>=0; i-- )
+    for( NSInteger i=_nRevisions-1; i>=0; i-- )
         if( ! [self _layOutRev: [_revisions objectAtIndex: i]] )
             return NO;
-    for( unsigned i=0; i<_parent2Queue.count; i++ ) {
+    for( NSUInteger i=0; i<_parent2Queue.count; i++ ) {
         HgRevision *rev = [_parent2Queue objectAtIndex: i];
         HgRevision *p2  = rev.parent2;
         if( ! [self _layOutFromChild: rev toParent: p2] )
 @synthesize revisions=_revisions;
 
 
-static void drawCorner( float x0, float y0, float x1, float y1 )
+static void drawCorner( CGFloat x0, CGFloat y0, CGFloat x1, CGFloat y1 )
 {
     NSBezierPath *path = [NSBezierPath bezierPath];
     [path moveToPoint: NSMakePoint(x0,y0+0.5f)];
 }
 
 
-- (void) drawRevisionNumber: (unsigned)revNo inRect: (NSRect)bounds flipped: (BOOL)flipped
+- (void) drawRevisionNumber: (NSUInteger)revNo inRect: (NSRect)bounds flipped: (BOOL)flipped
 {
     if( revNo >= _nRevisions )
         return;
     
     [[NSColor blackColor] set];
     
-    int topMask,bottomMask;
+    NSInteger topMask,bottomMask;
     if( flipped ) {
         topMask = kPrevMask;
         bottomMask = kNextMask;
     r.size.width = r.size.height;
     
     BOOL clipped = NO;
-    NSPoint dot = {-1,floorf(NSMidY(r))};
-    for( int i=0; i<_maxWidth; i++ ) {
-        int n = items[i];
+    NSPoint dot = {-1,floor(NSMidY(r))};
+    for( NSInteger i=0; i<_maxWidth; i++ ) {
+        NSInteger n = items[i];
         if( n ) {
             r.origin.x = bounds.origin.x + i*r.size.width;
             if( ! clipped && NSMaxX(r) >= NSMaxX(bounds) ) {
                 [[NSGraphicsContext currentContext] saveGraphicsState];
                 NSRectClip(bounds);
             }
-            float x = floorf(NSMidX(r));
+            CGFloat x = floor(NSMidX(r));
             if( n & kDotMask ) {
                 if( dot.x<0 ) {
                     // Dot:
 
 - (void) drawRevision: (HgRevision*)rev inRect: (NSRect)bounds flipped: (BOOL)flipped
 {
-    int revNo = [_revisions indexOfObjectIdenticalTo: rev];
+    NSInteger revNo = [_revisions indexOfObjectIdenticalTo: rev];
     if( revNo != NSNotFound )
         [self drawRevisionNumber: revNo inRect: bounds flipped: flipped];
 }
 {
     #define kAsciiGraphic  " o.v.^|+"
     #define kAsciiGraphic2 " o.\\./|+"
-    for( int r=_nRevisions-1; r>=0; r-- ) {
-        printf("%2d: ",r);
+    for( NSInteger r=_nRevisions-1; r>=0; r-- ) {
+        printf("%2d: ", (int)r);
         BOOL first = YES;
-        for( int x=0; x<_maxWidth; x++ ) {
-            int n = _array[r*_maxWidth + x];
+        for( NSInteger x=0; x<_maxWidth; x++ ) {
+            NSInteger n = _array[r*_maxWidth + x];
             Assert(n>=0 && n<8,@"Illegal n=%i",n);
             if( first ) {
                 putchar(kAsciiGraphic[n]);

Source/SourceHighlighting.h

 /** Colorize text in "hg annotate" (aka "hg blame") format,
     where each line is prefixed with a revision number and a ":". */
 void HighlightAnnotatedFile (NSMutableAttributedString* text, 
-                             int curRevNo, int maxRevNo,
+                             NSInteger curRevNo, NSInteger maxRevNo,
                              NSArray *revToolTips);

Source/SourceHighlighting.m

 /** Colorize text in "hg annotate" (aka "hg blame") format,
     where each line is prefixed with a revision number and a ":". */
 void HighlightAnnotatedFile (NSMutableAttributedString* text,
-                             int curRevNo, int maxRevNo,
+                             NSInteger curRevNo, NSInteger maxRevNo,
                              NSArray *revToolTips) {
     CAssert(curRevNo>=0);
     CAssert(curRevNo<=maxRevNo);
         NSRange colon = [string rangeOfString: @":" options: 0 
                                         range: NSMakeRange(start,string.length-start)];
         CAssert(colon.length==1);
-        int revNo = [[string substringWithRange: NSMakeRange(start, colon.location-start)] intValue];
+        NSInteger revNo = [[string substringWithRange: NSMakeRange(start, colon.location-start)] intValue];
         
         // Make the rev number uniform width:
-        int n = 4 - (colon.location-start);
+        NSInteger n = 4 - (colon.location-start);
         if (n > 0) {
             NSString *spaces = [@"    " substringToIndex: n];
             [text.mutableString insertString: spaces atIndex: start];
             end += n;
             nextStart += n;
         }
-        int lineStart = start + 0;
+        NSInteger lineStart = start + 0;
         
         // Colorize:
         NSDictionary *attrs = revisionStyles[revNo];
         if (!attrs && revNo < curRevNo) {
             // Get darker the older this rev is from the current.
-            float white = 1.0f - 0.75f*(curRevNo-revNo)/(float)maxRevNo;
+            CGFloat white = 1.0 - 0.75 *(curRevNo-revNo)/(CGFloat)maxRevNo;
             attrs = $dict({NSBackgroundColorAttributeName,
                             [NSColor colorWithCalibratedWhite: white alpha: 1.0f]},
                           {RevisionNumberAttributeName, $object(revNo)});

Source/URLFormatter.m

     NSOpenPanel *open = [NSOpenPanel openPanel];
     open.canChooseDirectories = YES;
     open.canChooseFiles = NO;
-    open.requiredFileType = (id)kUTTypeDirectory;
-    [open beginSheetForDirectory: nil
-                            file: nil
-                  modalForWindow: field.window
-                   modalDelegate: self
-                  didEndSelector: @selector(_filePickerDidEnd:returnCode:context:)
-                     contextInfo: field];
+    [open setAllowedFileTypes:[NSArray arrayWithObject:(id)kUTTypeDirectory]];
+    [open beginSheetModalForWindow: field.window
+                 completionHandler:^(NSInteger returnCode){
+                     [open orderOut: self];
+                     if( returnCode == NSOKButton && [open.URLs count] > 0 ) {
+                         field.objectValue = [open.URLs objectAtIndex:0];
+                     }
+                 }];
 }
 
 + (void) beginNewFilePickerFor: (NSTextField*)field
 {
     Assert(field);
     NSSavePanel *save = [NSSavePanel savePanel];
-    [save beginSheetForDirectory: nil
-                            file: nil
-                  modalForWindow: field.window
-                   modalDelegate: self
-                  didEndSelector: @selector(_filePickerDidEnd:returnCode:context:)
-                     contextInfo: field];
+    [save beginSheetModalForWindow: field.window
+                 completionHandler:^(NSInteger returnCode){
+                     [save orderOut: self];
+                     if( returnCode == NSOKButton ) {
+                         field.objectValue = save.URL;
+                     }
+                 }];
 }
 
-+ (void) _filePickerDidEnd: (NSSavePanel*)save returnCode: (int)returnCode context: (void*)context
-{
-    [save orderOut: self];
-    if( returnCode == NSOKButton ) {
-        NSTextField *field = context;
-        field.objectValue = [NSURL fileURLWithPath: save.filename];
-    }
-}
-
 
 @end