@@ -18,17 +18,16 @@ import (
1818)
1919
2020// AddDatabase is handles database upload processing
21- func AddDatabase (r * http.Request , loggedInUser string , dbOwner string , dbFolder string , dbName string ,
22- createBranch bool , branchName string , commitID string , public bool , licenceName string , commitMsg string ,
23- sourceURL string , newDB io.Reader , serverSw string , lastModified time.Time , commitTime time.Time ,
24- authorName string , authorEmail string , committerName string , committerEmail string , otherParents []string ,
25- dbSha string ) (numBytes int64 , newCommitID string , err error ) {
21+ func AddDatabase (r * http.Request , loggedInUser , dbOwner , dbFolder , dbName string , createBranch bool , branchName ,
22+ commitID string , public bool , licenceName , commitMsg , sourceURL string , newDB io.Reader , serverSw string ,
23+ lastModified , commitTime time.Time , authorName , authorEmail , committerName , committerEmail string ,
24+ otherParents []string , dbSha string ) (numBytes int64 , newCommitID string , err error ) {
2625
2726 // Create a temporary file to store the database in
2827 tempDB , err := ioutil .TempFile (Conf .DiskCache .Directory , "dbhub-upload-" )
2928 if err != nil {
30- log .Printf ("Error creating temporary file. User: '%s', Database: '%s%s%s', Filename: '%s', Error: %v\n " ,
31- loggedInUser , dbOwner , dbFolder , dbName , tempDB . Name () , err )
29+ log .Printf ("Error creating temporary file. User: '%s', Database: '%s%s%s', Error: %v\n " , loggedInUser ,
30+ dbOwner , dbFolder , dbName , err )
3231 return 0 , "" , err
3332 }
3433 tempDBName := tempDB .Name ()
@@ -401,7 +400,7 @@ func AddDatabase(r *http.Request, loggedInUser string, dbOwner string, dbFolder
401400}
402401
403402// CommitLicenceSHA returns the licence used by the database in a given commit
404- func CommitLicenceSHA (dbOwner string , dbFolder string , dbName string , commitID string ) (licenceSHA string , err error ) {
403+ func CommitLicenceSHA (dbOwner , dbFolder , dbName , commitID string ) (licenceSHA string , err error ) {
405404 commits , err := GetCommitList (dbOwner , dbFolder , dbName )
406405 if err != nil {
407406 return "" , err
@@ -443,7 +442,7 @@ func CreateDBTreeID(entries []DBTreeEntry) string {
443442 for _ , j := range entries {
444443 b .WriteString (string (j .EntryType ))
445444 b .WriteByte (0 )
446- b .WriteString (string ( j .LicenceSHA ) )
445+ b .WriteString (j .LicenceSHA )
447446 b .WriteByte (0 )
448447 b .WriteString (j .Sha256 )
449448 b .WriteByte (0 )
@@ -459,7 +458,7 @@ func CreateDBTreeID(entries []DBTreeEntry) string {
459458
460459// DeleteBranchHistory safely removes the commit history for a branch, from the head of the branch back to (but not
461460// including) the specified commit. The new branch head will be at the commit ID specified
462- func DeleteBranchHistory (dbOwner string , dbFolder string , dbName string , branchName string , commitID string ) (isolatedTags [] string , isolatedRels []string , err error ) {
461+ func DeleteBranchHistory (dbOwner , dbFolder , dbName , branchName , commitID string ) (isolatedTags , isolatedRels []string , err error ) {
463462 // Make sure the requested commit is in the history for the specified branch
464463 ok , err := IsCommitInBranchHistory (dbOwner , dbFolder , dbName , branchName , commitID )
465464 if err != nil {
@@ -732,7 +731,7 @@ func DeleteBranchHistory(dbOwner string, dbFolder string, dbName string, branchN
732731 }
733732
734733 // Remove any no-longer-needed commits
735- // TODO: We may want to consider clearing any memcache entries for the deleted commits too
734+ // TODO: We may want to consider clearing any Memcache entries for the deleted commits too
736735 for cid , del := range checkList {
737736 if del == true {
738737 delete (commitList , cid )
@@ -745,8 +744,8 @@ func DeleteBranchHistory(dbOwner string, dbFolder string, dbName string, branchN
745744// GetCommonAncestorCommits determines the common ancestor commit (if any) between a source and destination branch.
746745// Returns the commit ID of the ancestor and a slice of the commits between them. If no common ancestor exists, the
747746// returned ancestorID will be an empty string. Created for use by our Merge Request functions.
748- func GetCommonAncestorCommits (srcOwner string , srcFolder string , srcDBName string , srcBranch string , destOwner string ,
749- destFolder string , destName string , destBranch string ) (ancestorID string , commitList []CommitEntry , err error , errType int ) {
747+ func GetCommonAncestorCommits (srcOwner , srcFolder , srcDBName , srcBranch , destOwner , destFolder , destName ,
748+ destBranch string ) (ancestorID string , commitList []CommitEntry , errType int , err error ) {
750749
751750 // To determine the common ancestor, we retrieve the source and destination commit lists, then starting from the
752751 // end of the source list, step backwards looking for a matching ID in the destination list.
@@ -825,7 +824,7 @@ func GetCurrentFunctionName() (FuncName string) {
825824}
826825
827826// IsCommitInBranchHistory checks if a given commit ID is in the history of the given branch
828- func IsCommitInBranchHistory (dbOwner string , dbFolder string , dbName string , branchName string , commitID string ) (bool , error ) {
827+ func IsCommitInBranchHistory (dbOwner , dbFolder , dbName , branchName , commitID string ) (bool , error ) {
829828 // Get the commit list for the database
830829 commitList , err := GetCommitList (dbOwner , dbFolder , dbName )
831830 if err != nil {
@@ -934,12 +933,11 @@ func RandomString(length int) string {
934933 for i := range randomString {
935934 randomString [i ] = alphaNum [rand .Intn (len (alphaNum ))]
936935 }
937-
938936 return string (randomString )
939937}
940938
941939// StatusUpdateCheck checks if a status update for the user exists for a given discussion or MR, and if so then removes it
942- func StatusUpdateCheck (dbOwner string , dbFolder string , dbName string , thisID int , userName string ) (numStatusUpdates int , err error ) {
940+ func StatusUpdateCheck (dbOwner , dbFolder , dbName string , thisID int , userName string ) (numStatusUpdates int , err error ) {
943941 var lst map [string ][]StatusUpdateEntry
944942 lst , err = StatusUpdates (userName )
945943 if err != nil {
0 commit comments