Modify

Opened 7 years ago

Last modified 6 years ago

#2284 assigned defect

trac-admin resync fails after installing PerforcePlugin

Reported by: anonymous Owned by: ttressieres
Priority: normal Component: PerforcePlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

After installing the Perforce plugin and all its dependencies, and adding p4trac to the components section of the ini file of a newly initialized environment, I cannot resync with the Perforce repository:

C:\Python24\Scripts>..\python.exe trac-admin c:\tracenv resync
Resyncing repository history...
Command failed: The 'repository_dir' has changed a 'trac-admin resync' operation
 is needed

The ini file contains this:

repository_dir = p4://user:password@10.0.0.123:1666/?unicode=0
repository_type = perforce

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by anonymous

I do not get this bug with Trac 0.10.3.1 or previous versions, only with Trac 0.10.4.

This seems to be due to a change in trac/scripts/admin.py, line 675:

Trac 0.10.3.1

    def do_resync(self, line):
        print 'Resyncing repository history...'
        cnx = self.db_open()
        cursor = cnx.cursor()
        cursor.execute("DELETE FROM revision")
        cursor.execute("DELETE FROM node_change")
        cursor.execute("DELETE FROM system WHERE name='repository_dir'")
        repos = self.__env.get_repository() # this will do the sync()
        print 'Done.'

Trac 0.10.4

    def do_resync(self, line):
        env = self.env_open()
        argv = self.arg_tokenize(line)
        if argv:
            rev = argv[0]
            if rev:
                env.get_repository().sync_changeset(rev)
                print '%s resynced.' % rev
                return
        from trac.versioncontrol.cache import CACHE_METADATA_KEYS
        print 'Resyncing repository history... '
        cnx = self.db_open()
        cursor = cnx.cursor()
        cursor.execute("DELETE FROM revision")
        cursor.execute("DELETE FROM node_change")
        cursor.executemany("DELETE FROM system WHERE name=%s",
                           [(k,) for k in CACHE_METADATA_KEYS])
        cursor.executemany("INSERT INTO system (name, value) VALUES (%s, %s)",
                           [(k, '') for k in CACHE_METADATA_KEYS])
        cnx.commit()
        repos = self._resync(env.get_repository())
        cursor.execute("SELECT count(rev) FROM revision")
        for cnt, in cursor:
            print cnt, 'revisions cached.',
        print 'Done.'

I think p4trac is expecting the "DELETE FROM system WHERE name='repository_dir'" part but not getting it in 0.10.4.

comment:2 Changed 7 years ago by anonymous

This may be related to: http://trac.edgewall.org/ticket/4204

comment:3 Changed 7 years ago by ttressieres

  • Owner changed from lewisbaker to ttressieres
  • Status changed from new to assigned

comment:4 Changed 7 years ago by ttressieres

could you re-try it with the changeset [2973]

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.