Esempio n. 1
0
    def _handleChangeSet(self, trovesChanged, cs):
        class NonPristineDatabaseWrapper(object):
            def __getattr__(self, n):
                return getattr(self.db, n)

            def getTroves(self, *args, **kwargs):
                kwargs['pristine'] = False
                return self.db.getTroves(*args, **kwargs)

            def __init__(self, db):
                self.db = db

        if self.display == DISPLAY_DIFF:
            for x in cs.gitDiff(self.diffTroveSource,
                                diffBinaries=self.diffBinaries):
                sys.stdout.write(x)
        elif self.display == DISPLAY_CS:
            troveSpecs = ['%s=%s[%s]' % x for x in trovesChanged]
            showchangeset.displayChangeSet(NonPristineDatabaseWrapper(self.db),
                                           cs,
                                           troveSpecs,
                                           self.cfg,
                                           ls=True,
                                           showChanges=True,
                                           asJob=True)

        if trovesChanged and self.finalCs:
            self.finalCs.merge(cs)
Esempio n. 2
0
def rdiffCommand(cfg, client, db, diffSpec, **kw):
    troveSpec = cmdline.parseChangeList(diffSpec)[0]

    if troveSpec[1][0] is None:
        # Most likely, syntax did not specify <old>--<new>
        return -1

    kw.setdefault('recurse', None)
    kw.setdefault('asDiff', False)

    if kw['recurse'] is None:
        kw['recurse'] = (trove.troveIsCollection(troveSpec[0][0])
                         and not trove.troveIsGroup(troveSpec[0][0]))

    primaryCsList = cscmd.computeTroveList(client, [troveSpec])
    if (primaryCsList[0][1] == primaryCsList[0][2]):
        # Diffing against ourselves
        print "Identical troves"
        return 1

    cs = client.createChangeSet(primaryCsList,
                                withFiles=True,
                                withFileContents=kw['asDiff'],
                                recurse=kw['recurse'])
    showchangeset.displayChangeSet(db, cs, None, cfg, **kw)
Esempio n. 3
0
    def _handleChangeSet(self, trovesChanged, cs):
        class NonPristineDatabaseWrapper(object):
            def __getattr__(self, n):
                return getattr(self.db, n)

            def getTroves(self, *args, **kwargs):
                kwargs['pristine'] = False
                return self.db.getTroves(*args, **kwargs)

            def __init__(self, db):
                self.db = db

        if self.display == DISPLAY_DIFF:
            for x in cs.gitDiff(self.diffTroveSource,
                                diffBinaries = self.diffBinaries):
                sys.stdout.write(x)
        elif self.display == DISPLAY_CS:
            troveSpecs = [ '%s=%s[%s]' % x for x in trovesChanged ]
            showchangeset.displayChangeSet(NonPristineDatabaseWrapper(self.db), cs, troveSpecs,
                                           self.cfg, ls=True,
                                           showChanges=True, asJob=True)

        if trovesChanged and self.finalCs:
            self.finalCs.merge(cs)
Esempio n. 4
0
def rdiffCommand(cfg, client, db, diffSpec, **kw):
    troveSpec = cmdline.parseChangeList(diffSpec)[0]

    if troveSpec[1][0] is None:
        # Most likely, syntax did not specify <old>--<new>
        return -1

    kw.setdefault('recurse', None)
    kw.setdefault('asDiff', False)

    if kw['recurse'] is None:
        kw['recurse'] = (trove.troveIsCollection(troveSpec[0][0]) and
                         not trove.troveIsGroup(troveSpec[0][0]))

    primaryCsList = cscmd.computeTroveList(client, [ troveSpec ])
    if (primaryCsList[0][1] == primaryCsList[0][2]):
        # Diffing against ourselves
        print "Identical troves"
        return 1

    cs = client.createChangeSet(primaryCsList, withFiles=True,
                                withFileContents=kw['asDiff'],
                                recurse=kw['recurse'])
    showchangeset.displayChangeSet(db, cs, None, cfg, **kw)