dirstate and file mode

Matt Mackall mpm at selenic.com
Sun Apr 8 15:56:45 UTC 2012


On Sun, 2012-04-08 at 17:46 +0200, Wujek Srujek wrote:
> Hi. I am playing around with python and the mercurial files to learn a
> little bit about how things work in mercurial. One thing that I notice is
> that I get modes of a files in .hg/dirstate in the notation '0100664' -
> what does the initial 010 stand for (I am assuming the final 0664 are just
> the usual unix permissions, with the first octet being
> setid/setgid/sticky)? Is this some numeric definition of a type (normal,
> link, pipe, ...)? I can't find an answer in google easily, maybe this is
> something related to mercurial?

>From the stat(2) manpage:

       The following flags are defined for the st_mode field:

           S_IFMT     0170000   bit mask for the file type bit fields
           S_IFSOCK   0140000   socket
           S_IFLNK    0120000   symbolic link
           S_IFREG    0100000   regular file
           S_IFBLK    0060000   block device
           S_IFDIR    0040000   directory
           S_IFCHR    0020000   character device
           S_IFIFO    0010000   FIFO
           S_ISUID    0004000   set UID bit
...

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list