Commits

Raphael Sebbe  committed db7c78e

Various 64-bit fixes (now OK). Fixed incorrect repository state update after push/pull.

  • Participants
  • Parent commits ba248fb

Comments (0)

Files changed (22)

 syntax: glob
+BWToolkit.xcodeproj
 .DS_Store
 build
 .svn
-e833e9e4ff3f3c3057676adc7de3951b8e59f8a9 ext/MYUtilities
+be44ee9a6a2a2f6be6071e0a0e714bf759064e99 ext/MYUtilities

File Murky.xcodeproj/project.pbxproj

 					"\"$(SRCROOT)\"",
 				);
 				INFOPLIST_FILE = Resources/Info.plist;
-				INSTALL_PATH = "$(HOME)/Applications";
 				PRODUCT_NAME = Murky;
 				WRAPPER_EXTENSION = app;
 			};
 					"\"$(SRCROOT)\"",
 				);
 				INFOPLIST_FILE = Resources/Info.plist;
-				INSTALL_PATH = "$(HOME)/Applications";
 				PRODUCT_NAME = Murky;
 				WRAPPER_EXTENSION = app;
 			};

File Source/FileViewer.m

     [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);
     HgRevision *revision = _file.revision;
     NSString *name = _file.name;
     if (revision.isUncommitted) {
-        _revisionSlider.intValue = (int)_revisionSlider.maxValue;
+        _revisionSlider.integerValue = (int)_revisionSlider.maxValue;
     } else {
-        _revisionSlider.intValue = revision.localNumber;
+        _revisionSlider.integerValue = revision.localNumber;
         name = [name stringByAppendingFormat: @" r%i", revision.localNumber];
     }
     self.window.title = $sprintf(NSLocalizedString(@"%@ in %@",
 
 - (BOOL) skipRevision: (int)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;
 }
 
 - (double)tickMarkValueAtIndex:(NSInteger)index {
-    int revNo = [[_revisions objectAtIndex: index] localNumber];
+    NSInteger revNo = [[_revisions objectAtIndex: index] localNumber];
     if (revNo == NSNotFound)
         revNo = (int) self.maxValue;
     return revNo;

File Source/HgDir.m

 
 - (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;
+    NSUInteger n = components.count;
     for( unsigned i=0; i<n; i++ ) {
         NSString *name = [components objectAtIndex: i];
         if( name.length > 0 ) {

File Source/HgFile.m

 + (NSArray*) keyPathsForValuesAffectingIsUncommitted  {return [NSArray arrayWithObject: @"status"];}
 
 
-- (int) compare: (id)object
+- (NSInteger) compare: (id)object
 {
     return [_name caseInsensitiveCompare: [object name]];
 }

File 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;
         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

File 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;

File 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"];

File Source/HgRepository.m

 
 
 /** Returns the local revision number of the tip, or NSNotFound if there are no revisions */
-- (void) _getTipCompletionHandler:(void(^)(int))handler
+- (void) _getTipCompletionHandler:(void(^)(NSInteger))handler
 {
     handler = [handler copy];
     [self _getRevNumbers:@"tip" completionHandler:^(NSArray *revs, NSError *error) {
 }
 
 
-- (void)_getParentsCompletionHandler:(void(^)(BOOL result, int rev1, int rev2, NSError *error))handler
+- (void)_getParentsCompletionHandler:(void(^)(BOOL result, NSInteger rev1, NSInteger rev2, NSError *error))handler
 {
     handler = [handler copy];
     
 /** 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"];
 {
     handler = [handler copy];
     // Run "hg parents" to get current revision number:
-    [self _getParentsCompletionHandler:^(BOOL result, int curRevNo, int curParent2, NSError *error) {
+    [self _getParentsCompletionHandler:^(BOOL result, NSInteger curRevNo, NSInteger curParent2, NSError *error) {
         if(result == NO) 
         {
             handler(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:
-        [self _getTipCompletionHandler:^(int tip) {
+        [self _getTipCompletionHandler:^(NSInteger tip) {
             if( tip==NSNotFound )
             {
                 handler(NO);
             if(nuRevisions == nil) nuRevisions = [NSMutableArray array];
             
             HgRevision *tipRev = self.tipRevision;
-            int curTip = tipRev ?tipRev.localNumber :-1;
+            NSInteger curTip = tipRev ?tipRev.localNumber :-1;
             
             // RS: this block is invoked from 2 different places, that's why we need it
             void (^endBlock)() = ^{
 {
     // 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;
     
     if(nuRevisions == nil) nuRevisions = [NSMutableArray array];
     
     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];

File 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;

File Source/HgRevision.m

 
 
 - (id) initWithRepository: (HgRepository*)repository
-              localNumber: (int)revision
+              localNumber: (NSInteger)revision
                identifier: (HgRevisionID)myID
 {
     Assert(repository);
 }
 
 
-- (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 )

File 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 @"";

File Source/IconTextCell.m

 	[[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;
 	defineTextAndIconRects(aRect, &imgRect, &strRect, strHeight);

File Source/MercurialApp.m

     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];

File Source/ProjectsController.m

 static NSMutableArray *sDraggingProjects;
 
 
-- (int) _typeOfDrag: (id<NSDraggingInfo>)info
+- (NSInteger) _typeOfDrag: (id<NSDraggingInfo>)info
 {
     NSString *type = [[info draggingPasteboard] availableTypeFromArray: kDropTypes];
     if( type )
 - (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 {
 // the repository object should be the one in the tree (not another instance with same path)
 - (void)_refreshStatesForRepository:(HgRepository*)repo
 {
-    LogTo(ProjectsVerbose, @"refreshing repository %@", repo.name);
-    
     //if(![repo.name isEqual:@"murky"]) continue;
     //if(![repo.name isEqual:@"hgrepo-clone"]) return;
     //if(![repo.name isEqual:@"CeedBase"]) continue;
     
+    LogTo(ProjectsVerbose, @"refreshing repository %@", repo.name);
+    
+    // remove all attributes, as we are getting them now
+    [[self _attributesForRepository:repo] removeAllObjects];
+    
     [repo updateStatusCompletionHandler:^(BOOL result, NSError *error)
      {
          //if(!result) return;
                          {
                              LogTo(ProjectsVerbose, @"outgoing revs: %d (to %@)", [op.revisionNumbers count], defaultURL);
                              
-                             [[self _attributesForRepository:repo] setObject:[NSNumber numberWithInt:[op.revisionNumbers count]] forKey:@"outRevisions"];
+                             [[self _attributesForRepository:repo] setObject:[NSNumber numberWithInteger:[op.revisionNumbers count]] forKey:@"outRevisions"];
                              
                              HgLogOperation *op2 = [[HgLogOperation alloc] initIncomingWithRepository:repo otherRepo:defaultURL];
                              [op2 runWithCompletionHandler:^(BOOL result, NSError *error) {
                                  {
                                      LogTo(ProjectsVerbose, @"incoming revs: %d (from %@)", [op2.revisions count], defaultURL);
                                      
-                                     [[self _attributesForRepository:repo] setObject:[NSNumber numberWithInt:[op2.revisions count]] forKey:@"inRevisions"];
+                                     [[self _attributesForRepository:repo] setObject:[NSNumber numberWithInteger:[op2.revisions count]] forKey:@"inRevisions"];
                                  }
                                  else
                                  {

File Source/RepoController.m

     }
     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];
+        NSUInteger nRows = [_outline numberOfRows];
         for( unsigned row=0; row<nRows; row++ ) {
             NSTreeNode *item = [_outline itemAtRow: row];
             if( [_outline isItemExpanded: item] )
     [self setValue: _expandedPaths forSetting: @"ExpandedPaths"];
 }
 
-static NSString* modifiedString(unsigned n) {
+static NSString* modifiedString(NSUInteger n) {
     if (n == 0)
         return nil;
     NSString *format;
 - (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]];
     

File Source/RepoController_Actions.m

         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
 
 
 static BOOL isFileStatus( id file, void *status ) {
-    return [file status] == (HgStatus)status;
+    return [(HgFile*)file status] == (HgStatus)status;
 }
 
 static BOOL isFileMergeStatus( id file, void *status ) {
         self.showsOnlyUncleanFiles = YES;
         [_outline deselectAll: self];
         for( HgFile *file in unknown ) {
-            int row = [revision.uncleanFiles indexOfObjectIdenticalTo: file];
+            NSInteger row = [revision.uncleanFiles indexOfObjectIdenticalTo: file];
             if( row != NSNotFound )
             {
                 [_outline selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:YES];
     _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 )

File Source/RevisionGraphColumn.h

 @interface RevisionGraphColumn : NSObject
 {
     NSArray *_revisions;
-    unsigned _nRevisions;
+    NSUInteger _nRevisions;
     __strong UInt8 *_array;
     __strong UInt64 *_used;
     int _maxWidth;
 
 @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

File Source/RevisionGraphColumn.m

 
 @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;
     
     _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];
     _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++ ) {
 }
 
 
-- (void) drawRevisionNumber: (unsigned)revNo inRect: (NSRect)bounds flipped: (BOOL)flipped
+- (void) drawRevisionNumber: (NSUInteger)revNo inRect: (NSRect)bounds flipped: (BOOL)flipped
 {
     if( revNo >= _nRevisions )
         return;
 
 - (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("%2ld: ",(long)r);
         BOOL first = YES;
         for( int x=0; x<_maxWidth; x++ ) {
             int n = _array[r*_maxWidth + x];

File 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);

File 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);
         int 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];