#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 |
||
API Changes: | |||
Internal Changes: |
Description
Running sync on a direct-svn
type repository:
Resyncing repository history for proj2... 0 revisions cached. Done.
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 , 8 years ago
comment:2 by , 8 years ago
Milestone: | next-stable-1.2.x → 1.2.3 |
---|---|
Owner: | set to |
Release Notes: | modified (diff) |
Status: | new → assigned |
Two possible fixes:
- [67e65e119/rjollos.git]: could be refactored in #12406 when
Repository
object might have acached
property. - [bd03d2e12/rjollos.git]: change API to have
sync
return the number of revisions cached.
At this point, I prefer (2).
comment:3 by , 8 years ago
Milestone: | 1.2.3 → 1.2.2 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:4 by , 7 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
r16039 does not print the message when a single revision is sync'ed.
comment:6 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
follow-up: 9 comment:7 by , 6 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:
[git] 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 , 6 years ago
Cc: | added |
---|
comment:9 by , 5 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): 139 139 if not isinstance(repos, CachedRepository): 140 140 printout(_("%(reponame)s is not a cached repository.", 141 141 reponame=pretty_name)) 142 elif rev is not None:142 if rev is not None: 143 143 repos.sync_changeset(rev) 144 144 printout(_('%(rev)s resynced on %(reponame)s.', rev=rev, 145 145 reponame=pretty_name))
comment:10 by , 5 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. Done.
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 usingrepository 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.