Edgewall Software

Opened 9 years ago

Last modified 4 years ago

#3236 reopened enhancement

Support for a merge change type in version control API

Reported by: lewisbaker@… Owned by: cboos
Priority: normal Milestone: next-major-releases
Component: version control Version: devel
Severity: normal Keywords: merge
Release Notes:
API Changes:


Trac currently supports add, edit, delete, copy and move change types for files in a changeset. However, it would also be nice if Trac supported some of the merge change type for changes that involve merging changes from other files.

I realise that Subversion doesn't currently implement merge tracking natively (yet), but I have been working on a Perforce plugin for Trac (similar to the one described in #257 but based on PyPerforce) and would like to be able to get Perforce's merge/integration information displayed through Trac.

Perforce supports a number of different merge/integration types:

  • branch from - An exact copy of a file to a new location. Equivalent to Trac's copy or move depending on whether the source file was also deleted in the same changeset.
  • add from - A copy of a file to a new location that has been modified before checkin (related to #3172).
  • copy from - A merge operation that ignores any changes in the target file, effectively replacing the target with the source.
  • ignore from - A merge operation that ignores any changes in the source file, keeping the target file's changes.
  • merge from - A merge operation that merges the changes from both source and target files.
  • edit from - A merge operation that merges the changes from both source and target files and contains original user edits.
  • delete from - A merge of a deleted source file into the target file, deleting the target file. Basically a delete operation with an associated source file.

See the p4 integrated documentation for more info on the Perforce integration model.

Attachments (0)

Change History (8)

comment:1 Changed 9 years ago by lewisbaker@…

This could be implemented by adding a new merge type to the Changeset class at source:trunk/trac/versioncontrol/api.py@3294#L306 and modifying the Changeset.get_changes() method to yield (path, kind, change, integrations) tuples where integrations is a list of (base_path, base_rev, merge_type) tuples and merge_type is one of copy, ignore, merge, edit or delete.

comment:2 Changed 9 years ago by cboos

  • Milestone set to 0.11
  • Owner changed from cmlenz to cboos

While the Changeset.MERGE type is probably a good idea, the rest seems too specific to Perforce to be worth adding in the generic interface as such.

Probably a better way would be a possibility to extend the file information (that would be also interesting for systems supporting file specific comment).

Btw, perhaps you could already do that by using the properties API, and generate a special integrated property?

comment:3 Changed 9 years ago by lewisbaker@…

I think that in order to support a Changeset.MERGE type you need to be able to specify a list of node revision ranges that were merged as part of the change. Whether this is part of the Changeset.get_changes() or Node.get_history() APIs or as a Changeset or Node property is an implementation detail, I guess.

However, it would be best if there was a well-known place to retrieve this info so that the web_ui module is able to display this information in similar way to the copied from <path> information in the changeset and log views.

comment:4 Changed 8 years ago by cboos

  • Milestone changed from 0.11 to 0.12

Not for 0.11, but a hot topic for 0.12 and the many vc improvements that will happen there ;-)

comment:5 Changed 5 years ago by cboos

  • Keywords merge added
  • Milestone changed from next-major-0.1X to 0.13

Goes together with #1492.

comment:6 Changed 4 years ago by cboos

  • Milestone changed from 0.13 to next-major-0.1X
  • Resolution set to worksforme
  • Status changed from new to closed

comment:7 Changed 4 years ago by rblank

  • Resolution worksforme deleted
  • Status changed from closed to reopened

I assume closing wasn't intentional?

comment:8 Changed 4 years ago by cboos

Right, this ticket should be used for extending the changeset rendering to display 3-way diffs.

Modify Ticket

Change Properties
Set your email in Preferences
as reopened The owner will remain cboos.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from cboos to anonymous. Next status will be 'assigned'.

Add Comment

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

Note: See TracTickets for help on using tickets.