4025
Comment: This title is betterr for Moinmoin searching.
|
3709
converted to 1.6 markup
|
Deletions are marked like this. | Additions are marked like this. |
Line 4: | Line 4: |
'''This extension is in proposal stage.''' | '''This extension is not distributed with Mercurial.''' |
Line 8: | Line 9: |
Download site: Under Discussion | Download site: [[http://files.movedbylight.com/cgi-bin/hg/hgfold/]] |
Line 10: | Line 11: |
=== Jargon === | Works with: Mercurial 1.2.1 (and probably beyond, but not tested with later versions yet). === Definitions === |
Line 21: | Line 24: |
It's developed with these core principles (open for community discussion, cf. CaseFolding): | Basic understandings about filename collisions. |
Line 26: | Line 29: |
1. This is an easy thing to get wrong, so it needs community input. | |
Line 28: | Line 30: |
It proposes the following phases (also open to discussion): | It proposes the following phases: |
Line 30: | Line 32: |
1. (Current) Add commands that will: A. Optionally, use FixcaseExtension to coerce the case of filenames in the working copy to match that of the manifest. (This is not front burner for me, since my team's app manages filename case and my boss wants me to get on with the next two: ) A. List the collisions that would happen on a merge. A. Offer a way to merge, treating collisions as conflicts or, if that isn't possible, splitting the collisions off into separate files. 1. Adding options to merge, add, and commit providing the above functionality. 1. Making a '''versioned''' means of telling merge, add, and commit to make the above functionality default. The burning issue for phase 1 is I have 2000 potential users, most on Windows systems, some with 20 commits/day, and even in my small beta test group, we have jammed repos (can't be merged) because somebody's code (surely not mine!) every once in awhile will create filename with the wrong case. We need a sane way out. |
1. (Done) Add options to ''merge'' and ''update'' that will treat collisions as conflicts that need merging. 1. Adding options to other commands (''add'', ''addrem'', ''commit'', ''clone'', and ''rename'') to handle/prevent folds. 1. Add .hgfold to define cannonical forms of filenames and flag that a repository needs to behave as if file names case-insensitive |
Line 53: | Line 50: |
''hg help update'' and ''hg help merge'' have been augmented to describe this extension. |
|
Line 54: | Line 53: |
hg fold [-r REV] [--list|--split] - merge in a CI-aware manner --list - no action, just list the files that would collide in the merge --split - give the collisions names that will be unique on a CIFS (default behavior is to treat as conflicts and merge |
hg update --fold [-C] [-d DATE] [[-r] REV] -n --dry-run do not perform actions, just print output --fold treat filename collisions as the same file, merging as needed hg merge --fold [-f] [[-r] REV] -n --dry-run do not perform actions, just print output --fold treat filename collisions as the same file, merging as needed |
Line 61: | Line 63: |
A couple big questions: | === Mercurial Command Extension === |
Line 63: | Line 65: |
1. Is coercing case to manifest ever the right thing? What if your software is trying to rename a file to some cannonical case as a correction to application or user sloppiness? 1. CI merging two heads could result in more than a three-way merge this extension hasn't been used consistently on all copies. For instance, You even on a Windows machine you could end up with two heads that each have files "Apple" and "apple". That's a five-way merge. And finding a common ancestor gets really strange. What if Apple-1, Apple-2, and apple-1 share an ancestor, but apple-2 was added independently. The best thing would be some core declaration upon ''hg init'' declaring a repo to be CI for all adds, commits, and merges. But until then, we're effectively telling Mercurial, "You know that thing you didn't think was a conflict? Well, it is. So merge it." |
This extension demonstrates a way of extending existing mercurial commands (as opposed to simply adding a new command). There are risks and advantages to this. It tries to do it as safely as possible: 1. The original command entry if found and retained. 1. New options are audited so they will not overlap with existing command options (even future ones). 1. Command help and syntax is augmented. 1. A wrapper function is called instead of the original command function. Best practice is for that wrapper, if it learns that its extra services are not needed, to execute the original command function with the arguments pertinent to it. === Other Types of Filename Collisions === This extension acknowledges that there are other ways for filenames to collid besides case. By changing the definition of collisionFinder.cannonize(), it can be taught to find other types of filename collisions. I welcome any suggestions. |
Line 68: | Line 80: |
Other approaches are outlined at CaseFolding. |
Fold: Case Folding Rescue
This extension is not distributed with Mercurial.
Author: BradOlson
Download site: http://files.movedbylight.com/cgi-bin/hg/hgfold/
Works with: Mercurial 1.2.1 (and probably beyond, but not tested with later versions yet).
Definitions
- FS
- Filesystem (file system).
- CS
- Case-sensitive (case-preserving), a context where "THEGREENTREE" and "thegreentree" refer to two different files.
- CI
- Case-insensitive (case-folding), a context where "THEGREENTREE" and "thegreentree" refer to the same file or entity.
- Collision
- Case collision, two names that differ only by case.
Overview
This extension seeks to comprehensively deal with the problem of Mercurial filename case collisions in merges and updates. (It does not address Mercurial's internal storage, which is and needs to be CI no matter the file system, cf. CaseFoldingPlan.)
Basic understandings about filename collisions.
- It takes a person to decide whether a project's filenames are CI or CS. Current FS is not an adequate decider.
- In a CS project, a collision is just another file; in a CI project, a collision is a conflict.
Mercurial users need sane ways to remedy collisions on a CIFS. (It's easy to fix them on a CSFS, but on a CIFS you have to modify parentage, which can get dangerous. See FixingCaseCollisions.)
It proposes the following phases:
(Done) Add options to merge and update that will treat collisions as conflicts that need merging.
Adding options to other commands (add, addrem, commit, clone, and rename) to handle/prevent folds.
- Add .hgfold to define cannonical forms of filenames and flag that a repository needs to behave as if file names case-insensitive
Limitations
This extension has not been tested on filenames containing characters outside the basic Roman set.
Configuration
Configure your .hgrc to enable the extension by adding following lines:
[extensions] fold = /full/path/to/fold.py
Usage
hg help update and hg help merge have been augmented to describe this extension.
hg update --fold [-C] [-d DATE] [[-r] REV] -n --dry-run do not perform actions, just print output --fold treat filename collisions as the same file, merging as needed hg merge --fold [-f] [[-r] REV] -n --dry-run do not perform actions, just print output --fold treat filename collisions as the same file, merging as needed
Development Discussion
Mercurial Command Extension
This extension demonstrates a way of extending existing mercurial commands (as opposed to simply adding a new command). There are risks and advantages to this. It tries to do it as safely as possible:
- The original command entry if found and retained.
- New options are audited so they will not overlap with existing command options (even future ones).
- Command help and syntax is augmented.
- A wrapper function is called instead of the original command function. Best practice is for that wrapper, if it learns that its extra services are not needed, to execute the original command function with the arguments pertinent to it.
=== Other Types of Filename Collisions ===
This extension acknowledges that there are other ways for filenames to collid besides case. By changing the definition of collisionFinder.cannonize(), it can be taught to find other types of filename collisions.
I welcome any suggestions.
Other Solutions
Other approaches are outlined at CaseFolding.