コード例 #1
0
ファイル: svnmeta.py プロジェクト: seewindcn/tortoisehg
    def layout_from_commit(self, subdir, revpath, branch):
        """ Guess what the layout is based existing commit info

        Specifically, this compares the subdir for the repository and the
        revpath as extracted from the convinfo in the commit.  If they
        match, the layout is assumed to be single.  Otherwise, it tries
        the available layouts and selects the first one that would
        translate the given branch to the given revpath.

        """

        subdir = subdir or '/'
        if subdir == revpath:
            return 'single'

        candidates = set()
        for layout in layouts.NAME_TO_CLASS:
            layoutobj = layouts.layout_from_name(layout, self)
            try:
                remotepath = layoutobj.remotepath(branch, subdir)
            except KeyError:
                continue
            if remotepath == revpath:
                candidates.add(layout)

        if len(candidates) == 1:
            return candidates.pop()
        elif candidates:
            config_layout = self.layout
            if config_layout in candidates:
                return config_layout

        return 'standard'
コード例 #2
0
    def layout_from_commit(self, subdir, revpath, branch):
        """ Guess what the layout is based existing commit info

        Specifically, this compares the subdir for the repository and the
        revpath as extracted from the convinfo in the commit.  If they
        match, the layout is assumed to be single.  Otherwise, it tries
        the available layouts and selects the first one that would
        translate the given branch to the given revpath.

        """

        subdir = subdir or '/'
        if subdir == revpath:
            return 'single'

        candidates = set()
        for layout in layouts.NAME_TO_CLASS:
            layoutobj = layouts.layout_from_name(layout, self)
            try:
                remotepath = layoutobj.remotepath(branch, subdir)
            except KeyError:
                continue
            if remotepath == revpath:
                candidates.add(layout)

        if len(candidates) == 1:
            return candidates.pop()
        elif candidates:
            config_layout = self.layout
            if config_layout in candidates:
                return config_layout

        return 'standard'
コード例 #3
0
ファイル: svnmeta.py プロジェクト: seewindcn/tortoisehg
 def layoutobj(self):
     # if self.layout has changed, we need to create a new layoutobj
     if not self._layoutobj or self._layoutobj.name != self.layout:
         self._layoutobj = layouts.layout_from_name(self.layout, self)
     return self._layoutobj
コード例 #4
0
 def layoutobj(self):
     if not self._layoutobj:
         self._layoutobj = layouts.layout_from_name(self.layout, self)
     return self._layoutobj
コード例 #5
0
 def layoutobj(self):
     # if self.layout has changed, we need to create a new layoutobj
     if not self._layoutobj or self._layoutobj.name != self.layout:
         self._layoutobj = layouts.layout_from_name(self.layout, self)
     return self._layoutobj
コード例 #6
0
        # use tmp variable for testing
        subdir = meta.subdir
        if subdir and subdir[0] != '/':
            subdir = '/' + subdir
        if subdir and subdir[-1] == '/':
            subdir = subdir[:-1]
        assert revpath.startswith(subdir), ('That does not look like the '
                                            'right location in the repo.')

        if layout is None:
            layout = layouts.detect.layout_from_commit(subdir, revpath,
                                                       ctx.branch(), meta)
            existing_layout = layouts.detect.layout_from_file(meta)
            if layout != existing_layout:
                util.dump(layout, meta.layout_file)
            layoutobj = layouts.layout_from_name(layout, meta)
        elif layout == 'single':
            assert (subdir or '/') == revpath, ('Possible layout detection'
                                                ' defect in replay')

        # write repository uuid if required
        if meta.uuid is None or validateuuid:
            validateuuid = False
            uuid = convinfo[4:40]
            if not skipuuid:
                if svn is None:
                    svn = svnrepo.svnremoterepo(ui, url).svn
                if uuid != svn.uuid:
                    raise hgutil.Abort('remote svn repository identifier '
                                       'does not match')
            meta.uuid = uuid