]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
Refactor InsetQuotes.h enums
[lyx.git] / src / VCBackend.cpp
index 3a4ecb4f0538436563fad01d34a5665ad5929d1d..a1e0ec273867022e57ed40fd993d3314d6c9db6b 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "VCBackend.h"
 #include "Buffer.h"
-#include "DispatchResult.h"
 #include "LyX.h"
 #include "FuncRequest.h"
 
 #include "support/lstrings.h"
 #include "support/PathChanger.h"
 #include "support/Systemcall.h"
-#include "support/regex.h"
 #include "support/TempFile.h"
 
 #include <fstream>
 #include <iomanip>
+#include <regex>
 #include <sstream>
 
 using namespace std;
@@ -971,7 +970,7 @@ string CVS::repoUpdate()
                        dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName()));
                        ret = frontend::Alert::prompt(_("Changes detected"),
                                text, 0, 1, _("&Continue"), _("&Abort"));
-                       hideDialogs("file", 0);
+                       hideDialogs("file", nullptr);
                }
                if (ret == 1)
                        return string();
@@ -1156,7 +1155,7 @@ SVN::SVN(FileName const & m, Buffer * b) : VCS(b)
        // Here we know that the buffer file is either already in SVN or
        // about to be registered
        master_ = m;
-       locked_mode_ = 0;
+       locked_mode_ = false;
        scanMaster();
 }
 
@@ -1532,7 +1531,7 @@ string SVN::repoUpdate()
                        dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName()));
                        ret = frontend::Alert::prompt(_("Changes detected"),
                                text, 0, 1, _("&Yes"), _("&No"));
-                       hideDialogs("file", 0);
+                       hideDialogs("file", nullptr);
                }
                if (ret == 1)
                        return string();
@@ -2125,14 +2124,20 @@ string GIT::revisionInfo(LyXVC::RevisionInfo const info)
 
        // fill the rest of the attributes for a single file
        if (rev_file_cache_.empty())
-               if (!getFileRevisionInfo())
+               if (!getFileRevisionInfo()) {
                        rev_file_cache_ = "?";
+                       rev_file_abbrev_cache_ = "?";
+    }
 
        switch (info) {
                case LyXVC::File:
                        if (rev_file_cache_ == "?")
                                return string();
                        return rev_file_cache_;
+               case LyXVC::FileAbbrev:
+                       if (rev_file_abbrev_cache_ == "?")
+                               return string();
+                       return rev_file_abbrev_cache_;
                case LyXVC::Author:
                        return rev_author_cache_;
                case LyXVC::Date:
@@ -2156,7 +2161,7 @@ bool GIT::getFileRevisionInfo()
                return false;
        }
 
-       doVCCommand("git log -n 1 --pretty=format:%H%n%an%n%ai " + quoteName(onlyFileName(owner_->absFileName()))
+       doVCCommand("git log -n 1 --pretty=format:%H%n%h%n%an%n%ai " + quoteName(onlyFileName(owner_->absFileName()))
                    + " > " + quoteName(tmpf.toFilesystemEncoding()),
                    FileName(owner_->filePath()));
 
@@ -2167,6 +2172,8 @@ bool GIT::getFileRevisionInfo()
 
        if (ifs)
                getline(ifs, rev_file_cache_);
+       if (ifs)
+               getline(ifs, rev_file_abbrev_cache_);
        if (ifs)
                getline(ifs, rev_author_cache_);
        if (ifs) {
@@ -2190,7 +2197,8 @@ bool GIT::getTreeRevisionInfo()
        }
 
        doVCCommand("git describe --abbrev --dirty --long > " + quoteName(tmpf.toFilesystemEncoding()),
-                   FileName(owner_->filePath()));
+                   FileName(owner_->filePath()),
+                   false); //git describe returns $?=128 when no tag found (but git repo still exists)
 
        if (tmpf.empty())
                return false;