Differences between revisions 1 and 7 (spanning 6 versions)
Revision 1 as of 2009-04-24 15:35:07
Size: 1212
Editor: BradOlson
Comment: sketching out sections
Revision 7 as of 2009-05-15 18:17:16
Size: 3493
Editor: BradOlson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Extension Name == ## page was renamed from FoldPlugin
== Fold: Case Folding Rescue ==
Line 3: Line 4:
'''This extension is in proposal stage and therefore not distributed with Mercurial.''' '''This extension is in proposal stage.'''
Line 5: Line 6:
''Author: Brad Olson'' ''Author: BradOlson''
Line 7: Line 8:
Download site: Under Discussion Download site: [http://files.movedbylight.com/cgi-bin/hg/hgfold/]
Line 11: Line 12:
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.
 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.
Line 18: Line 19:
This extension seeks to comprehensively deal with the problem of Mercurial filename case collisions. 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.)
Line 20: Line 21:
It's developed with these core principles (which are open for community discussion): It's developed with these core principles (open for community discussion, cf. CaseFolding):
Line 22: Line 23:
 1. It takes a person to decide whether a project's filenames are CI or CS. (Current FS is not an adequate decider.)
 1.
 1. It takes a person to decide whether a project's filenames are CI or CS. Current FS is not an adequate decider.
 1. In a CS project, a collision is just another file; in a CI project, a collision is a conflict.
 1. 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:

 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 34: Line 42:
... fold = /full/path/to/fold.py
Line 37: Line 45:
=== 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
}}}
Line 38: Line 59:

A couple big questions:

 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."

Fold: Case Folding Rescue

This extension is in proposal stage.

Author: BradOlson

Download site: [http://files.movedbylight.com/cgi-bin/hg/hgfold/]

Jargon

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.)

It's developed with these core principles (open for community discussion, cf. CaseFolding):

  1. It takes a person to decide whether a project's filenames are CI or CS. Current FS is not an adequate decider.
  2. In a CS project, a collision is just another file; in a CI project, a collision is a conflict.
  3. 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:

  1. (Done) Add options to merge and update that will treat collisions as conflicts that need merging.

  2. Adding options to other commands (add, addrem, commit, clone, and rename) to handle/prevent folds.

  3. 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

A couple big questions:

  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?
  2. 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."

Other Solutions


CategoryExtension

CaseFoldExtension (last edited 2011-04-02 00:19:54 by GregWard)