mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
Besides directorys, single files can now also be versioned (or excluded)
This commit is contained in:
parent
bc2fbabc12
commit
9257f16c85
5 changed files with 53 additions and 10 deletions
|
|
@ -145,7 +145,7 @@ do
|
||||||
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this folder
|
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this folder
|
||||||
echo "Entering $path"
|
echo "Entering $path"
|
||||||
|
|
||||||
if ! test -d "${path}/.svn/"; then #Also add yourself if nessecary
|
if ! test -d "${path}/.svn/"; then #Dir: Also add yourself if nessecary
|
||||||
if [ "$deletesvn" != "1" ]; then
|
if [ "$deletesvn" != "1" ]; then
|
||||||
$debug svn -N add $path
|
$debug svn -N add $path
|
||||||
fi
|
fi
|
||||||
|
|
@ -157,6 +157,19 @@ do
|
||||||
cd - &> /dev/null;
|
cd - &> /dev/null;
|
||||||
let "i+=1"
|
let "i+=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -f $path; then #if its a file, see if it needs to be added
|
||||||
|
|
||||||
|
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this file
|
||||||
|
|
||||||
|
alreadyversioned=$(svn -N stat $path )
|
||||||
|
if [ "$alreadyversioned" != "" ]; then
|
||||||
|
echo "Subversioning $path"
|
||||||
|
$debug svn add $path
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cd $statepath #now that everything is added we go back to the 'root' path and commit
|
cd $statepath #now that everything is added we go back to the 'root' path and commit
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ do
|
||||||
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this folder
|
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this folder
|
||||||
echo "Entering $path"
|
echo "Entering $path"
|
||||||
|
|
||||||
if ! test -d "${path}/.svn/"; then #Also add yourself if nessecary
|
if ! test -d "${path}/.svn/"; then #Dir: Also add yourself if nessecary
|
||||||
if [ "$deletesvn" != "1" ]; then
|
if [ "$deletesvn" != "1" ]; then
|
||||||
$debug svn -N add $path
|
$debug svn -N add $path
|
||||||
fi
|
fi
|
||||||
|
|
@ -157,6 +157,19 @@ do
|
||||||
cd - &> /dev/null;
|
cd - &> /dev/null;
|
||||||
let "i+=1"
|
let "i+=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -f $path; then #if its a file, see if it needs to be added
|
||||||
|
|
||||||
|
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this file
|
||||||
|
|
||||||
|
alreadyversioned=$(svn -N stat $path )
|
||||||
|
if [ "$alreadyversioned" != "" ]; then
|
||||||
|
echo "Subversioning $path"
|
||||||
|
$debug svn add $path
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
cd $statepath #now that everything is added we go back to the 'root' path and commit
|
cd $statepath #now that everything is added we go back to the 'root' path and commit
|
||||||
|
|
|
||||||
|
|
@ -513,7 +513,7 @@ void Database::setStateReferences(const Transaction & txn, TableId table,
|
||||||
setStrings(txn, table, key, references);
|
setStrings(txn, table, key, references);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::lookupHighestRevivison(const Strings & keys, const Path & statePath, string & key)
|
bool Database::lookupHighestRevivison(const Strings & keys, const Path & statePath, string & key, int lowerthan)
|
||||||
{
|
{
|
||||||
int highestRev = -1;
|
int highestRev = -1;
|
||||||
|
|
||||||
|
|
@ -527,9 +527,16 @@ bool Database::lookupHighestRevivison(const Strings & keys, const Path & statePa
|
||||||
Path getStatePath;
|
Path getStatePath;
|
||||||
int getRevision;
|
int getRevision;
|
||||||
splitStatePathRevision(*i, getStatePath, getRevision);
|
splitStatePathRevision(*i, getStatePath, getRevision);
|
||||||
if(getRevision > highestRev)
|
if(getRevision > highestRev){
|
||||||
|
|
||||||
|
if(lowerthan != -1){
|
||||||
|
if(getRevision <= lowerthan) //if we have an uppper limit, see to it that we downt go over it
|
||||||
highestRev = getRevision;
|
highestRev = getRevision;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
highestRev = getRevision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(highestRev == -1) //no records found (TODO throw error?)
|
if(highestRev == -1) //no records found (TODO throw error?)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -546,7 +553,7 @@ bool Database::queryStateReferences(const Transaction & txn, TableId table,
|
||||||
Strings keys;
|
Strings keys;
|
||||||
enumTable(txn, table, keys); //get all revisions
|
enumTable(txn, table, keys); //get all revisions
|
||||||
|
|
||||||
//Check if this revision exists key in the table
|
//Check if this revision exists key in the table, if it doesnt well find the highest key lower than it
|
||||||
string key = makeStatePathRevision(statePath, revision);
|
string key = makeStatePathRevision(statePath, revision);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (Strings::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
for (Strings::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
||||||
|
|
@ -554,12 +561,17 @@ bool Database::queryStateReferences(const Transaction & txn, TableId table,
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = ""; //reset
|
key = "";
|
||||||
if(revision == -1 || (!found)){
|
if(revision == -1){
|
||||||
bool foundsomething = lookupHighestRevivison(keys, statePath, key);
|
bool foundsomething = lookupHighestRevivison(keys, statePath, key);
|
||||||
if(!foundsomething)
|
if(!foundsomething)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if(!found){
|
||||||
|
bool foundsomething = lookupHighestRevivison(keys, statePath, key, -1);
|
||||||
|
if(!foundsomething)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
key = makeStatePathRevision(statePath, revision);
|
key = makeStatePathRevision(statePath, revision);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ private:
|
||||||
void open2(const string & path, bool removeOldEnv);
|
void open2(const string & path, bool removeOldEnv);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
bool lookupHighestRevivison(const Strings & keys, const Path & statePath, string & key);
|
bool lookupHighestRevivison(const Strings & keys, const Path & statePath, string & key, int lowerthan = -1);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
int getNewRevisionNumber(const Transaction & txn, TableId table, const Path & statePath);
|
int getNewRevisionNumber(const Transaction & txn, TableId table, const Path & statePath);
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,11 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
|
||||||
DerivationStateOutputDir d = i->second;
|
DerivationStateOutputDir d = i->second;
|
||||||
|
|
||||||
string thisdir = d.path;
|
string thisdir = d.path;
|
||||||
|
|
||||||
|
//Check if it is a file
|
||||||
|
if(thisdir.substr(thisdir.length() -1 , thisdir.length()) != "/")
|
||||||
|
continue;
|
||||||
|
|
||||||
Path fullstatedir = stateDir + "/" + thisdir;
|
Path fullstatedir = stateDir + "/" + thisdir;
|
||||||
|
|
||||||
Strings p_args;
|
Strings p_args;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue