From 328ef3829c02977172c77cb269130f147f52e933 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 30 Nov 2018 07:05:22 +0000 Subject: [PATCH] fixed minor flaws in subversionmodel.php added empty gitmodel.php for future work on git --- codepot/src/codepot/models/Makefile.am | 1 + codepot/src/codepot/models/Makefile.in | 1 + codepot/src/codepot/models/gitmodel.php | 166 ++++++++++++++++++ .../src/codepot/models/subversionmodel.php | 9 +- 4 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 codepot/src/codepot/models/gitmodel.php diff --git a/codepot/src/codepot/models/Makefile.am b/codepot/src/codepot/models/Makefile.am index 4b6b1658..78b97d06 100644 --- a/codepot/src/codepot/models/Makefile.am +++ b/codepot/src/codepot/models/Makefile.am @@ -3,6 +3,7 @@ www_DATA = \ codemodel.php \ dbloginmodel.php \ filemodel.php \ + gitmodel.php \ index.html \ issuemodel.php \ ldaploginmodel.php \ diff --git a/codepot/src/codepot/models/Makefile.in b/codepot/src/codepot/models/Makefile.in index 0b744f91..54e18050 100644 --- a/codepot/src/codepot/models/Makefile.in +++ b/codepot/src/codepot/models/Makefile.in @@ -148,6 +148,7 @@ www_DATA = \ codemodel.php \ dbloginmodel.php \ filemodel.php \ + gitmodel.php \ index.html \ issuemodel.php \ ldaploginmodel.php \ diff --git a/codepot/src/codepot/models/gitmodel.php b/codepot/src/codepot/models/gitmodel.php new file mode 100644 index 00000000..e74ab389 --- /dev/null +++ b/codepot/src/codepot/models/gitmodel.php @@ -0,0 +1,166 @@ +errmsg = $errmsg; + } + + function getErrorMessage () + { + return $this->errmsg; + } + + function GitModel () + { + parent::Model (); + } + + private function _canonical_path($path) + { + $canonical = preg_replace('|/\.?(?=/)|','',$path); + while (($collapsed = preg_replace('|/[^/]+/\.\./|','/',$canonical,1)) !== $canonical) + { + $canonical = $collapsed; + } + $canonical = preg_replace('|^/\.\./|','/',$canonical); + + if ($canonical != '/' && substr($canonical, -1) == '/') + { + // if the last character is / and it's not the only character, remove it + $canonical = substr ($canonical, 0, -1); + } + return $canonical; + } + + function getFile ($projectid, $path, $rev = SVN_REVISION_HEAD, $type_and_name_only = FALSE) + { + return FALSE; + } + + function getBlame ($projectid, $path, $rev = SVN_REVISION_HEAD) + { + return FALSE; + } + + function getHistory ($projectid, $path, $rev = SVN_REVISION_HEAD) + { + return FALSE; + } + + function storeFile ($projectid, $path, $committer, $commit_message, $text) + { + return FALSE; + } + + function importFiles ($projectid, $path, $committer, $commit_message, $files, $uploader) + { + return FALSE; + } + + function deleteFiles ($projectid, $path, $committer, $commit_message, $files) + { + return FALSE; + } + + function renameFiles ($projectid, $path, $committer, $commit_message, $files) + { + return FALSE; + } + + function getRevHistory ($projectid, $path, $rev) + { + return FALSE; + } + + // + // Given a path name at the HEAD revision, it compares the file + // between two revisions given. The actual path name at a given + // revision can be different from the path name at the HEAD revision. + // + // $file - path name at the HEAD revision + // $rev1 - new revision number + // $rev2 - old revision number + // + function getDiff ($projectid, $path, $rev1, $rev2, $full = FALSE) + { + return FALSE; + } + + function getPrevRev ($projectid, $path, $rev) + { + return FALSE; + } + + function getNextRev ($projectid, $path, $rev) + { + return FALSE; + } + + function getHeadRev ($projectid, $path, $rev) + { + return FALSE; + } + + function getRevProp ($projectid, $rev, $prop) + { + return FALSE; + } + + function setRevProp ($projectid, $rev, $prop, $propval, $user) + { + return FALSE; + } + + function killRevProp ($projectid, $rev, $prop, $user) + { + return FALSE; + } + + function mapRevPropToRev ($projectid, $revprop_name) + { + return FALSE; + } + + function findRevWithRevProp ($projectid, $revprop_name, $revprop_value) + { + return FALSE; + } + + + function listProps ($projectid, $path, $rev) + { + return FALSE; + } + + function getProp ($projectid, $path, $rev, $prop) + { + return FALSE; + } + + function clocRevByLang ($projectid, $path, $rev) + { + return FALSE; + } + + function clocRevByFile ($projectid, $path, $rev) + { + return FALSE; + } + + + function revisionGraph ($projectid, $path, $rev = SVN_REVISION_HEAD) + { + return FALSE; + } + + function zipSubdir ($projectid, $path, $rev, $topdir) + { + return FALSE; + } +} + +?> diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index be57c40c..235ae6f9 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -343,7 +343,7 @@ class SubversionModel extends Model function storeFile ($projectid, $path, $committer, $commit_message, $text) { - $errmsg = ''; + $this->errmsg = ''; //$url = 'file://'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; $canon_path = $this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); @@ -1316,6 +1316,7 @@ class SubversionModel extends Model function getRevProp ($projectid, $rev, $prop) { + $this->errmsg = ''; $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}"); set_error_handler (array ($this, 'capture_error')); @@ -1326,6 +1327,7 @@ class SubversionModel extends Model function setRevProp ($projectid, $rev, $prop, $propval, $user) { + $this->errmsg = ''; $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}"); set_error_handler (array ($this, 'capture_error')); @@ -1342,6 +1344,7 @@ class SubversionModel extends Model function killRevProp ($projectid, $rev, $prop, $user) { + $this->errmsg = ''; $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}"); set_error_handler (array ($this, 'capture_error')); @@ -1359,6 +1362,7 @@ class SubversionModel extends Model function mapRevPropToRev ($projectid, $revprop_name) { + $this->errmsg = ''; $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}"); set_error_handler (array ($this, 'capture_error')); @@ -1384,6 +1388,7 @@ class SubversionModel extends Model function findRevWithRevProp ($projectid, $revprop_name, $revprop_value) { + $this->errmsg = ''; $url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}"); set_error_handler (array ($this, 'capture_error')); @@ -1409,6 +1414,7 @@ class SubversionModel extends Model function listProps ($projectid, $path, $rev) { + $this->errmsg = ''; $orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention @@ -1436,6 +1442,7 @@ class SubversionModel extends Model function getProp ($projectid, $path, $rev, $prop) { + $this->errmsg = ''; $orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $workurl = ($path == '')? $orgurl: "{$orgurl}@"; // trailing @ for collision prevention