Source

Murky / Source / HgFile.h

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

#import <Cocoa/Cocoa.h>
#import "Predicate.h"
@class HgDir, HgRepository, HgRevision, HgUncommittedRevision;


typedef enum {              // these are the characters output by 'hg status'
    kClean = 'C',
    kModified = 'M',
    kNeedsUpdate = 'U',
    kAdded = 'A',
    kRemoved = 'R',
    kDeleted = '!',
    kIgnored = 'I',
    kNotTracked = '?'
} HgStatus;


/** A single revision of a single file in a repository. */
@interface HgFile : NSObject
{
    HgDir *_dir;
    NSString *_name;
    HgStatus _status;
    NSImage *_icon;
}

- (id) initWithName: (NSString*)name directory: (HgDir*)parentDir;

@property (readonly,nonatomic) BOOL isRoot, isDirectory, isFile;
@property (readonly,nonatomic,retain) HgDir *directory, *root;
@property (readonly,nonatomic,retain) HgRevision *revision;
@property (readonly,nonatomic) HgRepository *repository;
@property (readonly,nonatomic) NSString *name, *path, *absolutePath;
@property (readonly,nonatomic) NSURL *URL;
@property (readonly,nonatomic) NSIndexPath* indexPath;
@property (readonly,nonatomic) HgStatus status;
@property (readonly,nonatomic) NSString *statusString;
@property (readonly,nonatomic) NSImage *statusImage;
@property (readonly,nonatomic) BOOL isUncommitted;
@property (readonly,nonatomic) NSImage* icon;
@property (readonly,nonatomic) NSDictionary* fileAttributes;
@property (readonly,nonatomic) CFAbsoluteTime modTime;
@property (readonly,nonatomic) NSArray* revisions;    // array of HgRevision

- (void) addFilesMatching: (Predicate)predicate toArray: (NSMutableArray*)array;

- (void) remove;

@end


// Used by HgDir
@interface HgFile ()
- (NSMutableString*) _getPath: (BOOL)absolute;
@property (readwrite,nonatomic) HgStatus status;
@end