+ /**
+ * Real code for obtaining file revision info. Fills all file-related caches
+ * and returns true if successfull.
+ * "?" is stored in rev_file_cache_ as a signal if request for obtaining info
+ * was already unsuccessful.
+ */
+ bool getFileRevisionInfo();
+ /// cache for file revision number, "?" if already unsuccessful, isNumber==true
+ std::string rev_file_cache_;
+ /// cache for author of last commit
+ std::string rev_author_cache_;
+ /// cache for date of last commit
+ std::string rev_date_cache_;
+ /// cache for time of last commit
+ std::string rev_time_cache_;
+ /// fills rev_tree_cache_, returns true if successfull.
+ bool getTreeRevisionInfo();
+ /// cache for tree revision number, "?" if already unsuccessful
+ std::string rev_tree_cache_;
+};
+
+
+/**
+ * Very basic git support:
+ * Remote repos are completely ignored, only the local tree is considered.
+ * How push and pull could be integrated with the LyX VCS interface needs
+ * to be discussed.
+ */
+class GIT : public VCS {
+public:
+ ///
+ explicit
+ GIT(Buffer * b);
+
+ /// Determine whether the file is under GIT control
+ /// \return the file itself if so, else empty
+ static bool findFile(support::FileName const & file);
+
+ /// get file from repo, the caller must ensure that it does not exist locally
+ static bool retrieve(support::FileName const & file);
+
+ std::string vcname() const override { return "GIT"; };
+
+ void registrer(std::string const & msg) override;
+
+ bool renameEnabled() override;
+
+ std::string rename(support::FileName const &, std::string const &) override;
+
+ bool copyEnabled() override;
+
+ std::string copy(support::FileName const &, std::string const &) override;
+
+ LyXVC::CommandResult
+ checkIn(std::string const & msg, std::string & log) override;
+
+ bool checkInEnabled() override;
+
+ bool isCheckInWithConfirmation() override;
+
+ std::string checkOut() override;
+
+ bool checkOutEnabled() override;
+
+ std::string repoUpdate() override;
+
+ bool repoUpdateEnabled() override;
+
+ std::string lockingToggle() override;
+
+ bool lockingToggleEnabled() override;
+
+ bool revert() override;
+
+ bool isRevertWithConfirmation() override;
+
+ void undoLast() override;
+
+ bool undoLastEnabled() override;
+
+ void getLog(support::FileName const &) override;
+
+ std::string const versionString() const override {
+ return "GIT: ?";
+ }
+
+ bool toggleReadOnlyEnabled() override;
+
+ std::string revisionInfo(LyXVC::RevisionInfo const info) override;
+
+ bool prepareFileRevision(std::string const & rev, std::string & f) override;
+
+ bool prepareFileRevisionEnabled() override;
+
+protected:
+ void scanMaster() override;
+ /// Check for messages in svn output. Returns error.
+ std::string scanLogFile(support::FileName const & f, std::string & status);
+ /// Check in files \p f with log \p msg
+ LyXVC::CommandResult checkIn(std::vector<support::FileName> const & f,
+ std::string const & msg, std::string & log);
+
+private:
+ /**
+ * Real code for obtaining file revision info. Fills all file-related caches
+ * and returns true if successfull.
+ * "?" is stored in rev_file_cache_ as a signal if request for obtaining info
+ * was already unsuccessful.
+ */
+ bool getFileRevisionInfo();
+ /// cache for file revision number, "?" if already unsuccessful, isNumber==true