mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Use scm variables API
This commit is contained in:
@@ -901,15 +901,7 @@ namespace
|
||||
if(doc->path() == NULL_STR)
|
||||
{
|
||||
if(scm::info_ptr info = scm::info(docDirectory))
|
||||
{
|
||||
std::string const& branch = info->branch();
|
||||
if(branch != NULL_STR)
|
||||
map["TM_SCM_BRANCH"] = branch;
|
||||
|
||||
std::string const& name = info->scm_name();
|
||||
if(name != NULL_STR)
|
||||
map["TM_SCM_NAME"] = name;
|
||||
}
|
||||
map = info->variables();
|
||||
}
|
||||
|
||||
if(NSString* projectPath = self.defaultProjectPath ?: self.fileBrowser.path ?: [NSString stringWithCxxString:path::parent(doc->path())])
|
||||
|
||||
@@ -498,13 +498,8 @@ namespace document
|
||||
|
||||
if(scm::info_ptr info = scm::info(path::parent(path())))
|
||||
{
|
||||
std::string const& branch = info->branch();
|
||||
if(branch != NULL_STR)
|
||||
map["TM_SCM_BRANCH"] = branch;
|
||||
|
||||
std::string const& name = info->scm_name();
|
||||
if(name != NULL_STR)
|
||||
map["TM_SCM_NAME"] = name;
|
||||
for(auto pair : info->variables())
|
||||
map.insert(pair);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +97,9 @@ namespace
|
||||
{
|
||||
if(scm::info_ptr info = scm::info(dir))
|
||||
{
|
||||
std::string const branch = info->branch();
|
||||
if(branch != NULL_STR)
|
||||
res.push_back("attr.scm.branch." + branch);
|
||||
auto scmVariables = info->variables();
|
||||
if(scmVariables.find("TM_SCM_BRANCH") != scmVariables.end())
|
||||
res.push_back("attr.scm.branch." + scmVariables["TM_SCM_BRANCH"]);
|
||||
|
||||
if(path != NULL_STR)
|
||||
{
|
||||
@@ -158,25 +158,16 @@ namespace file
|
||||
std::map<std::string, std::string> variables (std::string const& path)
|
||||
{
|
||||
std::map<std::string, std::string> map;
|
||||
// map["TM_DOCUMENT_UUID"] = to_s(identifier());
|
||||
if(path != NULL_STR)
|
||||
{
|
||||
if(scm::info_ptr info = scm::info(path::parent(path)))
|
||||
map = info->variables();
|
||||
|
||||
map["TM_DISPLAYNAME"] = path::display_name(path);
|
||||
map["TM_FILEPATH"] = path;
|
||||
map["TM_FILENAME"] = path::name(path);
|
||||
map["TM_DIRECTORY"] = path::parent(path);
|
||||
map["PWD"] = path::parent(path);
|
||||
|
||||
if(scm::info_ptr info = scm::info(path::parent(path)))
|
||||
{
|
||||
std::string const& branch = info->branch();
|
||||
if(branch != NULL_STR)
|
||||
map["TM_SCM_BRANCH"] = branch;
|
||||
|
||||
std::string const& name = info->scm_name();
|
||||
if(name != NULL_STR)
|
||||
map["TM_SCM_NAME"] = name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user