Murky with Sparkle / Source / HgRevision.h

//  HgRevision.h
//  Murky
//  Copyright 2008-2009 Jens Alfke. All rights reserved.

#import <Cocoa/Cocoa.h>
@class HgRepository, HgFile, HgDir, HgTempDir;

// This struct contains the SHA1 hash that Mercurial uses as a revision ID.
typedef struct {
    UInt8 bytes[20];
} HgRevisionID;

extern const HgRevisionID kZeroRevisionID, kUncommittedRevisionID;

static inline BOOL HgEqualRevisionIDs( HgRevisionID id1, HgRevisionID id2)
    return memcmp(&id1,&id2,sizeof(id1))==0;

/** A specific revision in a repository. */
@interface HgRevision : NSObject <NSCopying>
    HgRepository *_repository;
    int _localNumber;
    NSString *_comment, *_shortComment, *_author, *_email;
    NSDate *_date;
    HgRevisionID _identifier;
    HgRevision *_parent, *_parent2;
    HgDir *_root;
    NSArray *_uncleanFiles;

- (id) initWithRepository: (HgRepository*)repository
              localNumber: (int)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)  int localNumber;
@property (readonly,nonatomic)  HgRevisionID identifier;
@property (readonly,nonatomic)  NSString *identifierString, *localString;
@property (copy,nonatomic)      NSString *comment, *author, *email;
@property (readonly,copy,nonatomic)  NSString *shortComment, *formattedDescription;
@property (copy,nonatomic)      NSDate *date;
@property (retain,nonatomic)    HgRevision* parent, *parent2;
@property (readonly)            NSArray *parents;

@property (readonly)            HgDir *root;
@property (readonly)            NSString *absolutePath;
@property (readonly)            NSArray *uncleanFiles;

- (BOOL) descendsFrom: (HgRevision*)ancestor;

- (HgFile*) fileAtPath: (NSString*)path;

- (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 withRevision: (HgRevision*)other error: (NSError**)outError;

- (NSString*) compareFile: (HgFile*)file withRevisionNumber: (int)otherRev error: (NSError**)outError;

- (NSArray*) outgoingRevisionsForRepository: (NSURL*)otherRepo;

- (void) dumpTo: (NSMutableString*)dump;

- (BOOL) updateStatus: (HgDir*)dir error: (NSError**)outError;