Mercurial > hg > easyhg
diff src/mainwindow.cpp @ 419:69b2338c06e1 ignore
Add "Ignore this directory"; some fixes to ignore logic (though not yet enough)
author | Chris Cannam |
---|---|
date | Thu, 16 Jun 2011 20:35:05 +0100 |
parents | 93cb9005bb6f |
children | 653e9694a694 |
line wrap: on
line diff
--- a/src/mainwindow.cpp Thu Jun 16 16:46:35 2011 +0100 +++ b/src/mainwindow.cpp Thu Jun 16 20:35:05 2011 +0100 @@ -617,9 +617,20 @@ if (s != "") suffixes.insert(s); } + QString directory; + bool dirCount = 0; + foreach (QString file, files) { + QString d = QFileInfo(file).path(); + if (d != directory) { + ++dirCount; + directory = d; + } + } + if (dirCount != 1) directory = ""; + HgIgnoreDialog::IgnoreType itype = HgIgnoreDialog::confirmIgnore - (this, files, QStringList::fromSet(suffixes)); + (this, files, QStringList::fromSet(suffixes), directory); DEBUG << "hgIgnoreFiles: Ignore type is " << itype << endl; @@ -674,17 +685,28 @@ // anywhere -- anchor the path to / to make it specific to // this file only //!!! check this! + //!!! ... no, it doesn't work. does this mean we need regex syntax? foreach (QString f, files) { out << "/" + f << endl; } - } else { + } else if (itype == HgIgnoreDialog::IgnoreAllFilesOfGivenNames) { foreach (QString f, files) { - out << f << endl; + out << QFileInfo(f).fileName() << endl; } + } else if (itype == HgIgnoreDialog::IgnoreWholeDirectory) { + out << directory + "/" << endl; } + f.close(); + + //!!! report, and offer to edit .hgignore now + + // (tell the user at least what lines have been added to the + // hgignore file and how to edit it) + // (also, if the hgignore is not tracked, suggest that they add + // it) hgRefresh(); }