Edgewall Software

Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#12737 closed enhancement (fixed)

Issue warning when running sync for non-cached repository

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.2
Component: version control Version:
Severity: normal Keywords:
Cc: pocek@… Branch:
Release Notes:

Message is printed to console when synchronizing a non-cached repository using trac-admin.

API Changes:
Internal Changes:


Running sync on a direct-svn type repository:

Resyncing repository history for proj2... 
0 revisions cached.

We should issue a warning or error that the repository cannot be synced because it's not a cached repository.

Attachments (0)

Change History (11)

comment:1 by Jun Omae, 6 years ago

Okay about showing a notice to me, however not okay about a warning or error.

repository sync * with non-cached repository would say an error and exits with non-zero? I'm using repository sync <name> command in same hook script for all Trac environments on production and mercurial repository is included. If the exit code would be non-zero, I would have to check whether a repository is cache/non-cache.

comment:2 by Ryan J Ollos, 6 years ago

Milestone: next-stable-1.2.x1.2.3
Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned

Two possible fixes:

  1. [67e65e119/rjollos.git]: could be refactored in #12406 when Repository object might have a cached property.
  2. [bd03d2e12/rjollos.git]: change API to have sync return the number of revisions cached.

At this point, I prefer (2).

comment:3 by Ryan J Ollos, 6 years ago

Resolution: fixed
Status: assignedclosed

I committed the simpler change that didn't modify the API, to 1.2-stable in r16039, merged to trunk in r16040.

comment:4 by Ryan J Ollos, 5 years ago

Resolution: fixed
Status: closedreopened

r16039 does not print the message when a single revision is sync'ed.

comment:5 by Ryan J Ollos, 5 years ago

Proposed changes: [a45b4f38/rjollos.git].

comment:6 by Ryan J Ollos, 5 years ago

Resolution: fixed
Status: reopenedclosed

Committed to 1.2-stable in r16446, merged to trunk in r16447.

comment:7 by pocek@…, 4 years ago

I think this change introduced a regression. Before Trac 1.2.3 it was possible to sync a GitRepository (not GitCachedRepository). This was actually useful with the following config:

cached_repository = false
persistent_cache = true

and sync_per_request=False.

One can still call changeset added <repos> DUMMY and it will sync the repo, but repository sync was nicer.

comment:8 by pocek@…, 4 years ago

Cc: pocek@… added

in reply to:  7 comment:9 by Ryan J Ollos, 4 years ago

Replying to pocek@…:

I think this change introduced a regression. Before Trac 1.2.3 it was possible to sync a GitRepository (not GitCachedRepository).

Syncing a non-cached repository will invalidate and refresh the persistent cache.

The old behavior could be restored with the following change:

  • trac/versioncontrol/admin.py

    diff --git a/trac/versioncontrol/admin.py b/trac/versioncontrol/admin.py
    index 12dd8b434..7603970f7 100644
    a b class VersionControlAdmin(Component):  
    139139            if not isinstance(repos, CachedRepository):
    140140                printout(_("%(reponame)s is not a cached repository.",
    141141                           reponame=pretty_name))
    142             elif rev is not None:
     142            if rev is not None:
    143143                repos.sync_changeset(rev)
    144144                printout(_('%(rev)s resynced on %(reponame)s.', rev=rev,
    145145                           reponame=pretty_name))
Last edited 4 years ago by Ryan J Ollos (previous) (diff)

comment:10 by Ryan J Ollos, 4 years ago

This is more complex than I understood, with the sync operation valid for non-cached repositories. I'm going to remove the printed message added in r16039.

The information I was seeking to help users debug is available at debug level logging:

$ trac-admin tracenvs/proj-1.2 repository sync "trac" 9118e08
12:13:19 Trac[env] INFO: -------------------------------- environment startup [Trac 1.2.4.dev0] --------------------------------
12:13:23 Trac[git_fs] DEBUG: disabled CachedRepository for '/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git'
9118e08 resynced on trac.

comment:11 by Ryan J Ollos, 4 years ago

Changes committed in r16957, merged in r16958.

The net effect of the changes in this ticket was a refactoring of VersionControlAdmin._sync.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.