View | Details | Raw Unified | Return to bug 2906
Collapse All | Expand All

(-)a/bake/ModuleSource.py (-3 / +18 lines)
 Lines 867-875    Link Here 
867
        ModuleSource.__init__(self)
867
        ModuleSource.__init__(self)
868
        self.add_attribute('url', '', 'Url to clone the source tree from.',
868
        self.add_attribute('url', '', 'Url to clone the source tree from.',
869
                           mandatory=True)
869
                           mandatory=True)
870
        self.add_attribute('revision', 'refs/remotes/origin/master',
870
        self.add_attribute('revision', '',
871
                           "Revision to checkout. Defaults to origin/master"
871
                           "Revision to checkout. Defaults to origin/master"
872
                           " reference.")
872
                           " reference.")
873
        self.add_attribute('branch', '', 'Branch to checkout.')
873
        self.add_attribute('fetch_option', '', 'Options to add git fetch command.')
874
        self.add_attribute('fetch_option', '', 'Options to add git fetch command.')
874
    @classmethod
875
    @classmethod
875
    def name(cls):
876
    def name(cls):
 Lines 886-891    Link Here 
886
            raise TaskError('Attribute type error, expected String, Error: %s' % e1)
887
            raise TaskError('Attribute type error, expected String, Error: %s' % e1)
887
        except OSError as e2:
888
        except OSError as e2:
888
            raise TaskError('Could not create temporary file, Error: %s' % e2)
889
            raise TaskError('Could not create temporary file, Error: %s' % e2)
890
891
        checkedOut = False
889
            
892
            
890
        env.run(['git', 'init'], directory=tempdir)
893
        env.run(['git', 'init'], directory=tempdir)
891
        env.run(['git', 'remote', 'add', 'origin', self.attribute('url').value],
894
        env.run(['git', 'remote', 'add', 'origin', self.attribute('url').value],
 Lines 895-902    Link Here 
895
                    directory=tempdir)
898
                    directory=tempdir)
896
        else:
899
        else:
897
            env.run(['git', 'fetch'], directory=tempdir)
900
            env.run(['git', 'fetch'], directory=tempdir)
898
        env.run(['git', 'checkout', self.attribute('revision').value],
901
899
                directory=tempdir)
902
        if self.attribute('branch').value is not '':
903
            env.run(['git', 'checkout', self.attribute('branch').value],
904
                    directory=tempdir)
905
            checkedOut = True
906
        
907
        if self.attribute('revision').value is not '':
908
            env.run(['git', 'checkout', self.attribute('revision').value],
909
                    directory=tempdir)
910
            checkedOut = True
911
912
        if not checkedOut:
913
            env.run(['git', 'pull', 'origin', 'master'], directory=tempdir)
914
900
        os.rename(tempdir, env.srcdir)
915
        os.rename(tempdir, env.srcdir)
901
916
902
    def update(self, env):
917
    def update(self, env):

Return to bug 2906