I'm resending these two patches because I got no feedback...

Sat Nov 19 19:55:59 PST 2005  Brendan Cully <[EMAIL PROTECTED]>
  * Fix directory renames in hglib target
  
  The last rename patch failed to account for the fact that mercurial only
  understands files, not directories. This fixes the logic in the new
  _getCommitEntries method and also corrects a bug in renamePathname that
  ate too much of the directory prefix, by using os.path.split and join
  instead of guessing at the length of the separator.

Sat Nov 19 21:38:23 PST 2005  Brendan Cully <[EMAIL PROTECTED]>
  * Fix tkt 17 (let svn do mv itself instead of add/remove)
  
  The problem described in ticket 17 arises because upstream has already
  relocated the renamed directory, including the .svn metadir
  inside. This metadata directory causes svn to refuse to add a path
  that it believes is already under version control. But that metadir
  now disagrees with the working directory about where it exists in the
  file system.
  
  We have a couple of choices: either put the directory back if possible
  and let svn do the merge on its own, or remove the .svn entry from the
  new directory and all its subdirectories. I like the first choice, not
  just because it's a little easier, but also because it preserves file
  history. The current implementation notes that svn mv is equal to svn
  cp+rm, but doesn't actually do cp+rm. Instead it does rm+add, which
  isn't equivalent.
  
  I had to add --force to the mv operation to handle the case where the
  renamed entry or content underneath it had been changed in the same commit.
New patches:

[Fix directory renames in hglib target
Brendan Cully <[EMAIL PROTECTED]>**20051120035559
 
 The last rename patch failed to account for the fact that mercurial only
 understands files, not directories. This fixes the logic in the new
 _getCommitEntries method and also corrects a bug in renamePathname that
 ate too much of the directory prefix, by using os.path.split and join
 instead of guessing at the length of the separator.
] {
hunk ./vcpx/hglib.py 185
-        # We need to extract the old name for renames and commit that too
-        from changes import Changeset, ChangesetEntry
-        from datetime import datetime
+        from changes import ChangesetEntry
+        from os.path import join, isdir, normpath
hunk ./vcpx/hglib.py 189
-        entries.extend([e.old_name for e in changeset.entries
-                        if e.action_kind == ChangesetEntry.RENAMED])
+        # We need to extract the old name for renames and commit that too
+        for e in [e for e in changeset.entries
+                  if e.action_kind == ChangesetEntry.RENAMED]:
+            # Have to walk directories by hand looking for files
+            if isdir(join(self.basedir, normpath(e.name))):
+                entries.extend([join(e.old_name, tail) for tail in self._walk(e.name)])
+            else:
+                entries.append(e.old_name)
+
hunk ./vcpx/hglib.py 266
+        repo = self._getRepo()
+
hunk ./vcpx/hglib.py 272
-            for src, oldpath in self._hg.dirstate.walk(oldname):
-                tail = oldpath[len(oldname)+2:]
-                self._hg.copy(oldpath, join(newname, tail))
-                self._hg.remove([oldpath])
+            for f in self._walk(oldname):
+                oldpath = join(oldname, f)
+                repo.copy(oldpath, join(newname, f))
+                repo.remove([oldpath])
hunk ./vcpx/hglib.py 277
-            self._hg.copy(oldname, newname)
-            self._hg.remove([oldname])
+            repo.copy(oldname, newname)
+            repo.remove([oldname])
hunk ./vcpx/hglib.py 331
+    def _walk(self, subdir):
+        """ Returns the files mercurial knows about under subdir, relative to subdir """
+        from os.path import join, split, isdir
+
+        files = []
+        for src, path in self._getRepo().dirstate.walk([subdir]):
+            (hd, tl) = split(path)
+            while hd != subdir:
+                hd, nt = split(hd)
+                tl = join(nt, tl)
+            files.append(tl)
+        return files
+
}

[Fix tkt 17 (let svn do mv itself instead of add/remove)
Brendan Cully <[EMAIL PROTECTED]>**20051120053823
 
 The problem described in ticket 17 arises because upstream has already
 relocated the renamed directory, including the .svn metadir
 inside. This metadata directory causes svn to refuse to add a path
 that it believes is already under version control. But that metadir
 now disagrees with the working directory about where it exists in the
 file system.
 
 We have a couple of choices: either put the directory back if possible
 and let svn do the merge on its own, or remove the .svn entry from the
 new directory and all its subdirectories. I like the first choice, not
 just because it's a little easier, but also because it preserves file
 history. The current implementation notes that svn mv is equal to svn
 cp+rm, but doesn't actually do cp+rm. Instead it does rm+add, which
 isn't equivalent.
 
 I had to add --force to the mv operation to handle the case where the
 renamed entry or content underneath it had been changed in the same commit.
] {
hunk ./vcpx/svn.py 493
-        cmd = self.repository.command("mv", "--quiet")
+        from os import rename, walk, remove
+        from os.path import join, isdir, exists
+
+        # --force in case the file has been changed and moved in one revision
+        cmd = self.repository.command("mv", "--quiet", "--force")
+        # Subversion does not seem to allow
+        #   $ mv a.txt b.txt
+        #   $ svn mv a.txt b.txt
+        # Here we are in this situation, since upstream VCS already
+        # moved the item.
+        # It may be better to let subversion do the move itself. For one thing,
+        # svn's cp+rm is different from rm+add (cp preserves history).
+        unmoved = False
+        oldpath = join(self.basedir, oldname)
+        newpath = join(self.basedir, newname)
+        if not exists(oldpath):
+            rename(newpath, oldpath)
+            unmoved = True
hunk ./vcpx/svn.py 514
-            # Subversion does not seem to allow
-            #   $ mv a.txt b.txt
-            #   $ svn mv a.txt b.txt
-            # Here we are in this situation, since upstream VCS already
-            # moved the item. OTOH, svn really treats "mv" as "cp+rm",
hunk ./vcpx/svn.py 515
-            self._removePathnames([oldname])
-            self._addPathnames([newname])
+            if unmoved:
+                rename(oldpath, newpath)
+            raise ChangesetApplicationFailure("%s returned status %d"
+                                              % (str(move), move.exit_status,
+                                                 err.read()))
}

Context:

[Intercept and emit warning when using the BazaarNG backend with Python <2.4.
[EMAIL PROTECTED] 
[use lelit method to distinguish between 2.3 Set and 2.4 set
R.Ghetta <[EMAIL PROTECTED]>**20051203100429] 
[set() built-in is available only on python-2.4 Use the sets module instead.
R.Ghetta <[EMAIL PROTECTED]>**20051203065932] 
[Use bzr.dev new smart_add_tree() in place of smart_add_branch()
[EMAIL PROTECTED] 
[apparently svn backend missed the 'Replacing' case on commit
R.Ghetta <[EMAIL PROTECTED]>**20051204090751] 
[add target dir of a file rename to implicit_dirs
R.Ghetta <[EMAIL PROTECTED]>**20051204090719] 
[Use the configured CVS repository instead the default one
TK Soh <[EMAIL PROTECTED]>**20051206084923] 
[Handle '.' as module under svn, replacing it with '/'
[EMAIL PROTECTED] 
[bzr WorkingTree fixes
Bart Teeuwisse <[EMAIL PROTECTED]>**20051128210737] 
[Strip ending new line and prepend the basedir to the boring file name
[EMAIL PROTECTED] 
[Possibly use the preferred boring file
[EMAIL PROTECTED] 
[monotone passphrase must now be specified. Also added an optional custom_lua parameter
R.Ghetta <[EMAIL PROTECTED]>**20051123064020] 
[Use the encoding error policy specified on the repository
[EMAIL PROTECTED] 
[commit both old and new names of renamed files in hglib
Brendan Cully <[EMAIL PROTECTED]>**20051120021905] 
[Use the new encode facility of the Repository
[EMAIL PROTECTED] 
[New option `encoding-errors-policy` and centralization of encode() on Repository
[EMAIL PROTECTED] 
[Mention the lookup mechanism for the configuration options
[EMAIL PROTECTED] 
[M-x whitespace-cleanup
[EMAIL PROTECTED] 
[git source support
Brendan Cully <[EMAIL PROTECTED]>**20051117184454
 
 This adds support for git sources. It does not provide tags or detect
 conflicts in the working directory.
] 
[Test for old-style darcs date format
[EMAIL PROTECTED] 
[Don't crash on empty darcs changesets
Brendan Cully <[EMAIL PROTECTED]>**20051117035753
 
 The old guard code "if changeset" would never fail because the
 expression being tested is a generator, which always exists even if it
 never yields anything. Guard on the StopIteration exception instead.
] 
[Handle old-style darcs date format
Brendan Cully <[EMAIL PROTECTED]>**20051117035425
 
 Older darcs patches appear to keep the date in the form
 Sun Oct 20 20:10:04 EDT 2002 rather than the current
 20021020201004. This patch tries to parse the date as the old format
 if it fails to read it as the new. NOTE: This older patch format also
 calculates the hash from the date in the recorder's time zone, but
 darcs pull uses the puller's time zone, so it may not calculate the
 correct hash of the patch. Perhaps it's safer to just throw an
 exception if the date isn't in the current format?
] 
[Don't version .hgtags when pulling from mercurial
Brendan Cully <[EMAIL PROTECTED]>**20051115100427
 
 It's only useful to mercurial repositories, but if by chance we happen to be
 making a round trip back to mercurial, the file will be wrong anyway because
 the changesets are all new.
] 
[Use UTC0 not UTC to force a neutral timezone
[EMAIL PROTECTED] 
[Add tailor-created files to Monotone's list of ignored files
"Neil Conway <[EMAIL PROTECTED]>"**20051116194227
 
 This could be done by installing a new ignore_file Lua hook, or adding
 entries to the .mt-ignore file (which is read by the default ignore_file
 hook). I chose the latter, as it is simpler. It breaks if you install
 a custom ignore_file hook that doesn't read .mt-ignore, but if you do
 that then presumably you know what you're doing...
 
] 
[Don't apply duplicate tags to mercurial targets
Brendan Cully <[EMAIL PROTECTED]>**20051116052626
 
 I just noticed that a CVS source will replay all of the tags that apply
 to HEAD on every run. This teaches mercurial to filter out equivalent tags
 (by checking whether they already exist in the commit history up to the last
 non-tag commit).
] 
[Add tag support to mercurial target
Brendan Cully <[EMAIL PROTECTED]>**20051115100534] 
[Add tag support to git target
Brendan Cully <[EMAIL PROTECTED]>**20051115075709] 
[Sanitize CVS tag names
Brendan Cully <[EMAIL PROTECTED]>**20051115073722
 
 CVS tag names are more restrictive than those of other repositories. This patch
 downcodes them where necessary.
] 
[Fix mercurial source deletion detection
Brendan Cully <[EMAIL PROTECTED]>**20051115070747
 
 The original mercurial delete logic would find any unchanged file in a
 changeset to be deleted. This horrible bug was mitigated by the fact that
 I had forgotten to actually add DELETED changeset entries to the changeset.
] 
[Pick up tags from mercurial sources
Brendan Cully <[EMAIL PROTECTED]>**20051115054848
 
 Tailor appears to only be able to tag the current revision, so this patch
 silently drops any retroactive tags. It might be worth expanding the tag
 object with the notion of author, tag date and files tagged (the first two
 are readily available but not passed on in _tag()).
] 
[give -b flag for cvs trunk
[EMAIL PROTECTED] 
[Create the info dir that contains the ignore file if it does not exist
[EMAIL PROTECTED] 
[Fix a last-second BPB converting revision names.
Brendan Cully <[EMAIL PROTECTED]>**20051114030337] 
[Mercurial source support via hglib
Brendan Cully <[EMAIL PROTECTED]>**20051114022602] 
[git commit fixes (date, # at end of commit message)
Brendan Cully <[EMAIL PROTECTED]>**20051114022122
 
 As of at least git 0.99.9e, git refuses to parse timestamps with
 microseconds such as str(datetime) may emit. This patch uses strftime
 to force the format to something simpler.
 
 It also manually duplicates GIT_AUTHOR_* to GIT_COMMITTER_* so that
 cg-log produces output most similar to the source log.
 
 git-commit expects the commit message to end with a newline, so this
 patch adds one if it isn't already there.
] 
[Ensure str() doesn't get handed a unicode changeset
Brendan Cully <[EMAIL PROTECTED]>**20051114021851
 
 I don't do a lot of python, so I may be misdiagnosing this bug, but I
 get a UnicodeEncodeError at Tailorizer.applyable on the debug line
 when tailorizing a source with non-ascii log messages on a UTF-8
 terminal. It appears that str() expects a __str__ function it calls to
 return a plain (not unicode) string. Could possibly be an OS X issue.
 
 The particular test was tailorizing the bzr repository from bzr to git
 or hglib, with changeset messages apparently in macroman, on a UTF-8
 terminal. This problem is made more annoying by the fact that bzr no
 longer seems to be able to resume (_b undefined in the upgrade path).
] 
[Fix bzr incremental update
Brendan Cully <[EMAIL PROTECTED]>**20051114060007
 
 Incremental update in bzr isn't working: when tailor restarts it has no
 handle on the bzr branch object, and when it does a merge it doesn't
 make sure that it already has the changesets it needs. This patch
 introduces a getRepo method that gets a branch handle if there isn't one,
 and calls bzrlib.fetch.greedy_fetch to pull in all changesets before
 attempting to merge them.
] 
[Ignore the backup copy of the state file
[EMAIL PROTECTED] 
[Fix cut&paste error
[EMAIL PROTECTED] 
[TAG Version 0.9.19 (retag)
[EMAIL PROTECTED] 
Patch bundle hash:
d133b649c89bb2a9c7dbe164cc7b1a58af8ce329
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to