#8861 closed enhancement (fixed)
[PATCH] RFC: Allow trac-admin to replace recent version of wiki pages on import
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | low | Milestone: | 0.12 |
Component: | admin/console | Version: | 0.11.6 |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When using wiki import
or wiki load
in trac-admin to import content from files into existing wiki pages, a new version of these pages will be generated if something has changed. If one imports a large amount of wiki pages this way, the timeline will be flooded with events for the wiki page "edits".
The attached patch adds an optional switch which changes the behaviour of wiki import
and wiki load
such that the current version of an existing wiki page is modified in place, to prevent the timeline flood. It has been tested while preparing the migration of trac-hacks.org to Trac 0.11.
Not sure if this is interesting enough to be included in Trac. Comments welcome.
Attachments (3)
Change History (13)
by , 15 years ago
Attachment: | t8861-trac_admin_wiki_replace-r8865.diff added |
---|
follow-up: 2 comment:1 by , 15 years ago
Milestone: | → 0.12 |
---|---|
Owner: | set to |
follow-up: 3 comment:2 by , 15 years ago
Replying to cboos:
- use of a different sub-command (
wiki replace
)
Yes, please use a different command. --option
style options are not really supported on trunk either, where the trac-admin
infrastructure has been revamped.
comment:3 by , 15 years ago
Component: | general → admin/console |
---|
Replying to rblank:
Yes, please use a different command.
--option
style options are not really supported on trunk either, where thetrac-admin
infrastructure has been revamped.
No problem, will adjust it accordingly. Any suggestions for the actual command name? We'd need two, one for "import+replace" and one for "load+replace".
comment:4 by , 15 years ago
Ah, yes, we have two commands for doing essentially the same thing…
wiki replace <path>
would be enough, and it would do either an import or a load according to the type of <path>
(file or directory).
Note that we could also deprecate wiki import
and have wiki load [path]
to support directory, file or nothing (stdin).
by , 15 years ago
Attachment: | 8861-wiki-replace-r8952.patch added |
---|
Add trac-admin $ENV wiki replace
and enhance wiki load
on trunk.
comment:5 by , 15 years ago
The patch above enhances trac-admin $ENV load
as suggested in comment:4, and adds trac-admin $ENV replace
. It also (finally) adds the advertised import from stdin
, which was never actually implemented.
The patch is against trunk, so I'm afraid it won't help much for the migration of trac-hacks.org.
In its current state, the patch deprecates wiki import
, as wiki load
replaces it completely. However, this could be confusing, as it requires being able to specify the name of the page to be imported (in the case of a single page). Maybe it would be better to keep wiki import
for importing single pages, and to have wiki_load
always load from files and pick up the page name from the file name.
Thoughts?
by , 15 years ago
Attachment: | 8861-wiki-replace-r8952.2.patch added |
---|
Don't deprecate wiki import
, and only import from files with wiki load
.
follow-up: 7 comment:6 by , 15 years ago
Owner: | changed from | to
---|
I have changed my mind. The patch above doesn't deprecate wiki import
, and allows multiple paths (files and directories) in wiki load
. Both commands have different purposes: import/export allow importing and exporting single pages from/to files with arbitrary names or stdin/stdout. load/dump allow importing and exporting multiple pages from/to files, and the page names are taken from the file names. So I think it's better to keep both variants.
The only open question is what to do if a page to be replaced doesn't exist already. The current patch prints a message, but doesn't create the page. The alternative would be to create the page if it doesn't exist, and to replace the latest version if it does.
Thoughts?
follow-up: 8 comment:7 by , 15 years ago
Replying to rblank:
… So I think it's better to keep both variants.
OK
The only open question is what to do if a page to be replaced doesn't exist already. The current patch prints a message, but doesn't create the page. The alternative would be to create the page if it doesn't exist, and to replace the latest version if it does.
I find the latter behavior to be more useful: if you have a bunch of pages that have to replace an existing set of pages and among them you have pages that don't exist yet, I think you certainly want to add them nevertheless.
Btw, wiki replace
, that's risky business - maybe adding a caveat + advice to do a backup first with wiki dump
would be useful.
comment:8 by , 15 years ago
Replying to cboos:
I find the latter behavior to be more useful: if you have a bunch of pages that have to replace an existing set of pages and among them you have pages that don't exist yet, I think you certainly want to add them nevertheless.
Ok, I'll do that.
Btw,
wiki replace
, that's risky business - maybe adding a caveat + advice to do a backup first withwiki dump
would be useful.
Good idea.
comment:9 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The patch looks good, however:
--replace
, which can be specified before or after the directorywiki replace
)