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
|
||||
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
|
||||
$debug svn -N add $path
|
||||
fi
|
||||
|
|
@ -157,6 +157,19 @@ do
|
|||
cd - &> /dev/null;
|
||||
let "i+=1"
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
$debug svn -N add $path
|
||||
fi
|
||||
|
|
@ -157,6 +157,19 @@ do
|
|||
cd - &> /dev/null;
|
||||
let "i+=1"
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -527,8 +527,15 @@ bool Database::lookupHighestRevivison(const Strings & keys, const Path & statePa
|
|||
Path getStatePath;
|
||||
int getRevision;
|
||||
splitStatePathRevision(*i, getStatePath, getRevision);
|
||||
if(getRevision > highestRev)
|
||||
highestRev = getRevision;
|
||||
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;
|
||||
}
|
||||
else
|
||||
highestRev = getRevision;
|
||||
}
|
||||
}
|
||||
|
||||
if(highestRev == -1) //no records found (TODO throw error?)
|
||||
|
|
@ -546,7 +553,7 @@ bool Database::queryStateReferences(const Transaction & txn, TableId table,
|
|||
Strings keys;
|
||||
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);
|
||||
bool found = false;
|
||||
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;
|
||||
}
|
||||
|
||||
key = ""; //reset
|
||||
if(revision == -1 || (!found)){
|
||||
key = "";
|
||||
if(revision == -1){
|
||||
bool foundsomething = lookupHighestRevivison(keys, statePath, key);
|
||||
if(!foundsomething)
|
||||
return false;
|
||||
}
|
||||
else if(!found){
|
||||
bool foundsomething = lookupHighestRevivison(keys, statePath, key, -1);
|
||||
if(!foundsomething)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
key = makeStatePathRevision(statePath, revision);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ private:
|
|||
void open2(const string & path, bool removeOldEnv);
|
||||
|
||||
/* 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 */
|
||||
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;
|
||||
|
||||
string thisdir = d.path;
|
||||
|
||||
//Check if it is a file
|
||||
if(thisdir.substr(thisdir.length() -1 , thisdir.length()) != "/")
|
||||
continue;
|
||||
|
||||
Path fullstatedir = stateDir + "/" + thisdir;
|
||||
|
||||
Strings p_args;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue