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;

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


/** A single revision of a single file in a repository. */
@interface HgFile : NSObject
{
    HgDir *_dir;
    NSString *_name;
    HgStatus _status;
    HgMergeStatus _mergeStatus;
    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) HgMergeStatus mergeStatus;
@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


#ifdef HGFILE_PRIVATE
// Used by HgDir
@interface HgFile ()
- (NSMutableString*) _getPath: (BOOL)absolute;
@property (readwrite,nonatomic) HgStatus status;
@property (readwrite,nonatomic) HgMergeStatus mergeStatus;
@end
#endif
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.