1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 04:30:59 +01:00

Replaced SVN by Ext3COW as a backend for state (still some things need to happen: reverting doesn't go right in all cases yet)

This commit is contained in:
Wouter den Breejen 2007-07-25 21:52:33 +00:00
parent dc4395b737
commit 0fc5accd86
16 changed files with 269 additions and 268 deletions

View file

@ -59,8 +59,9 @@ typedef list<Path> Paths;
typedef set<Path> PathSet;
//state types
typedef list<int> RevisionNumbers; //the Strings (list) of StateReferences and this list are connected by position
typedef map<Path, map<Path, unsigned int> > RevisionNumbersSet; //We include to the paths to sort on
typedef list<int> RevisionNumbers; //the Strings (list) of StateReferences and this list are connected by position
typedef map<Path, unsigned int> Snapshots; //Automatically sorted on Path :)
typedef map<Path, Snapshots > RevisionClosure;
typedef map<int, Strings> StateReferences;

View file

@ -1039,6 +1039,20 @@ bool string2Int(const string & s, int & n)
return str && str.get() == EOF;
}
string unsignedInt2String(unsigned int n)
{
std::ostringstream str;
str << n;
return str.str();
}
bool string2UnsignedInt(const string & s, unsigned int & n)
{
std::istringstream str(s);
str >> n;
return str && str.get() == EOF;
}
string bool2string(const bool b)
{
if(b == true)
@ -1126,11 +1140,11 @@ void executeShellCommand(const string & command)
}
}
string time_t2string(const time_t & t)
int getTimeStamp()
{
int i = t;
string s = int2String(i);
return s;
const time_t now = time(0);
int i = now;
return i;
}
//TODO Does this work on windows?
@ -1218,5 +1232,12 @@ void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, Pat
}
}
void ensureDirExists(const Path & path)
{
Strings p_args;
p_args.push_back("-p");
p_args.push_back(path);
runProgram_AndPrintOutput("mkdir", true, p_args, "mkdir"); //TODO ensurePath
}
}

View file

@ -280,6 +280,10 @@ bool statusOk(int status);
string int2String(int n);
bool string2Int(const string & s, int & n);
/* */
bool string2UnsignedInt(const string & s, unsigned int & n);
string unsignedInt2String(unsigned int n);
/* Parse a bool to a string and back */
string bool2string(const bool b);
bool string2bool(const string & s);
@ -297,8 +301,7 @@ void executeShellCommand(const string & command);
//
void runProgram_AndPrintOutput(Path program, bool searchPath, const Strings & args, const string outputPrefix);
//Convert time_t to a string
string time_t2string(const time_t & t);
int getTimeStamp();
bool FileExist(const string FileName);
@ -312,9 +315,8 @@ PathSet pathSets_union(const PathSet & paths1, const PathSet & paths2);
/* TODO */
void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, PathSet & addedpaths, PathSet & removedpaths);
string packRevisionNumbers(const RevisionNumbers & revs);
RevisionNumbers unpackRevisionNumbers(const string & packed);
void ensureDirExists(const Path & path);
}