monotone

monotone Mtn Source Tree

Root/inodeprint.hh

1#ifndef __INODEPRINT_HH__
2#define __INODEPRINT_HH__
3
4// Copyright (C) 2005 Nathaniel Smith <njs@pobox.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13#include <map>
14#include "vocab.hh"
15#include "quick_alloc.hh"
16#include "paths.hh"
17#include "platform.hh"
18
19typedef std::pair<file_path const, hexenc<inodeprint> > inodeprint_entry;
20
21typedef std::map<file_path, hexenc<inodeprint>,
22 std::less<file_path>,
23 QA(inodeprint_entry) > inodeprint_map;
24
25std::ostream & operator<<(std::ostream & out, inodeprint_entry const & e);
26
27void read_inodeprint_map(data const & dat,
28 inodeprint_map & ipm);
29
30void write_inodeprint_map(inodeprint_map const & ipm,
31 data & dat);
32
33bool inodeprint_file(file_path const & file, hexenc<inodeprint> & ip);
34
35inline bool
36inodeprint_unchanged(inodeprint_map const & ipm, file_path const & path)
37{
38 inodeprint_map::const_iterator old_ip = ipm.find(path);
39 if (old_ip != ipm.end())
40 {
41 hexenc<inodeprint> ip;
42 if (inodeprint_file(path, ip) && ip == old_ip->second)
43 return true; // unchanged
44 else
45 return false; // changed or unavailable
46 }
47 else
48 return false; // unavailable
49}
50
51
52// Local Variables:
53// mode: C++
54// fill-column: 76
55// c-file-style: "gnu"
56// indent-tabs-mode: nil
57// End:
58// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
59
60#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status