Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-9119

properly set work of VcsManager::findVersionControlForDirectory

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P5: Not important
    • None
    • Qt Creator 2.7.0

    Description

      Hi,

      currently method VcsManager::findVersionControlForDirectory works in a really bad way IMO.

      this is crutial function, and it returns IVersionControl* object that manages directory. HOwever, check for a directory is done IMO in a really bad way.

      If you look into this, check is done inside two loops - currently first loop is going through all versionControl systems defined in a QtCreator - this loop checks the directory for a VC system it has.

      Under that loop is a directoryStructure loop - so to test weather folder is under VC, (in two VC I know of) - you first check for current directory if it contains .git or .svn. If not, go up one level and check there.

      Now - IMO this is really bad, and IMO to make this work properly this two loops need to be reverted, but in a little different way - there should be only loop through folders, and within each folder all IVersionControl objects should only check if a current folder is top level one. This can be easily checked, at least in git (.git) and SVN (.svn). These are the benefits:

      1 - this info is cached. This means that every folder that was checked once there will be no more checks, but cache will be used. However, right now if current directory was not checked - it needs to be checked for everything from scratch - in the way I describe however, current dir would be checked, and in case it is not declared as top level one - then go up one one level and check cache again (and re-cache for currentDirectory).

      2 - if you only need VC info (topLevel = 0), some VC systems like svn have .svn folder in every folder, so locking onto correct one is even faster.

      The reason because I can not implement this, and I am reporting it, is because I do not know a lot about other VC systems - I only know git and very little SVN. But still I think this should be changed.

      Regards,
      Petar

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hunger Tobias Hunger
            pperisin Petar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes