Sun Jun 25 23:25:08 CEST 2006  [EMAIL PROTECTED]
  * [git] make it more obvious what the parts common to source and target are

Thu Jun 29 01:25:02 CEST 2006  [EMAIL PROTECTED]
  * [git] add support for "repository" parameter
New patches:

[[git] make it more obvious what the parts common to source and target are
[EMAIL PROTECTED] {
hunk ./vcpx/repository/git.py 22
+    ## generic stuff
+
hunk ./vcpx/repository/git.py 35
+
+    def _tryCommand(self, cmd, exception=Exception, pipe=True):
+        c = ExternalCommand(command = self.repository.command(*cmd), cwd = self.basedir)
+        if pipe:
+            output = c.execute(stdout=PIPE)[0]
+        else:
+            c.execute()
+        if c.exit_status:
+            raise exception(str(c) + ' failed')
+        if pipe:
+            return output.read().split('\n')
+
hunk ./vcpx/repository/git.py 48
+
hunk ./vcpx/repository/git.py 180
-    def _tryCommand(self, cmd, exception=Exception, pipe=True):
-        c = ExternalCommand(command = self.repository.command(*cmd), cwd = self.basedir)
-        if pipe:
-            output = c.execute(stdout=PIPE)[0]
-        else:
-            c.execute()
-        if c.exit_status:
-            raise exception(str(c) + ' failed')
-        if pipe:
-            return output.read().split('\n')
-
}

[[git] add support for "repository" parameter
[EMAIL PROTECTED] {
hunk ./README 667
-git
-%%%
+git target
+%%%%%%%%%%
hunk ./README 671
-  Relative path to a git directory to use as a parent.  This is useful
-  to import repository branches.  If this parameter is empty, the
-  branch has no parent (default behaviour).
+  Relative path to a git directory to use as a parent.  This is one
+  way to import branches into a git repository, which creates a new
+  git repository borrowing ancestry from the parent-repo.  It is quite
+  a simple way, and thus believed to be quite robust, but spreads
+  branches across several git repositories. If this parameter is
+  not set, and ``repository`` is not set either, the branch has no
+  parent.
+
+  The alternative is to specify a ``repository`` parameter, to contain
+  all git branches.  The .git directory in the working copy for each
+  branch will then only contain the ``.git/index`` file.
hunk ./README 683
+branch : string
+  The name of the branch to which to commit.  It is only used in
+  single-repository mode (using ``repository``, see above).  The
+  default is to use the "master" branch.
+
hunk ./vcpx/repository/git.py 6
+#            Yann Dirson <[EMAIL PROTECTED]>
hunk ./vcpx/repository/git.py 18
+from vcpx.config import ConfigurationError
hunk ./vcpx/repository/git.py 34
+        self.BRANCHNAME = project.config.get(self.name, 'branch')
+        if self.BRANCHNAME:
+            self.BRANCHNAME = 'refs/heads/' + self.BRANCHNAME
hunk ./vcpx/repository/git.py 38
+        if self.repository and self.PARENT_REPO:
+            self.log.critical('Cannot make sense of both "repository" and "parent-repo" parameters')
+            raise ConfigurationError ('Must specify only one of "repository" and "parent-repo"')
+
+        if self.BRANCHNAME and not self.repository:
+            self.log.critical('Cannot make sense of "branch" if "repository" is not set')
+            raise ConfigurationError ('Missing "repository" to make use o "branch"')
+
+        self.env = {}
+
+        if self.repository:
+            self.storagedir = self.repository
+            self.env['GIT_DIR'] = self.storagedir
+            self.env['GIT_INDEX_FILE'] = self.METADIR + '/index'
+        else:
+            self.storagedir = self.METADIR
+
+class GitExternalCommand(ExternalCommand):
+    def __init__(self, repo, command=None, cwd=None):
+        """
+        Initialize an ExternalCommand instance tied to a GitRepository
+        from which it inherits a set of environment variables to use
+        fo each execute().
+        """
+
+        self.repo = repo
+        return ExternalCommand.__init__(self, command, cwd)
+
+    def execute(self, *args, **kwargs):
+        """Execute the command, with controlled environment."""
+
+        if not kwargs.has_key('env'):
+            kwargs['env'] = {}
+
+        kwargs['env'].update(self.repo.env)
+
+        return ExternalCommand.execute(self, *args, **kwargs)
hunk ./vcpx/repository/git.py 79
-        c = ExternalCommand(command = self.repository.command(*cmd), cwd = self.basedir)
+        c = GitExternalCommand(self.repository,
+                               command = self.repository.command(*cmd), cwd = self.basedir)
hunk ./vcpx/repository/git.py 286
-        # find the parent commit if any
-        c = ExternalCommand(cwd=self.basedir,
-                         command=self.repository.command('rev-parse', 'HEAD'))
+        # in single-repository mode, only update the relevant branch
+        if self.repository.BRANCHNAME:
+            refname = self.repository.BRANCHNAME
+        else:
+            refname = 'HEAD'
+
+        # find the previous commit on the branch if any
+        c = GitExternalCommand(self.repository, cwd=self.basedir,
+                               command=self.repository.command('rev-parse', refname))
hunk ./vcpx/repository/git.py 318
-        c = ExternalCommand(cwd=self.basedir, command=cmd)
+        c = GitExternalCommand(self.repository, cwd=self.basedir, command=cmd)
hunk ./vcpx/repository/git.py 337
+
hunk ./vcpx/repository/git.py 339
-                self._tryCommand(['update-ref', 'HEAD', commitid, parent])
+                self._tryCommand(['update-ref', refname, commitid, parent])
hunk ./vcpx/repository/git.py 341
-                self._tryCommand(['update-ref', 'HEAD', commitid])
+                self._tryCommand(['update-ref', refname, commitid])
hunk ./vcpx/repository/git.py 346
-        c = ExternalCommand(cwd=self.basedir, command=cmd)
+        c = GitExternalCommand(self.repository, cwd=self.basedir, command=cmd)
hunk ./vcpx/repository/git.py 402
-        from os import renames
+        from os import renames, mkdir
hunk ./vcpx/repository/git.py 406
-            if not self.repository.PARENT_REPO:
-                cmd = self.repository.command("init-db")
-                init = ExternalCommand(cwd=self.basedir, command=cmd)
-                init.execute()
-                if init.exit_status:
-                    raise TargetInitializationFailure(
-                        "%s returned status %s" % (str(init), init.exit_status))
-            else:
+            if self.repository.PARENT_REPO:
hunk ./vcpx/repository/git.py 409
-                clone = ExternalCommand(cwd=self.basedir, command=cmd)
+                clone = GitExternalCommand(self.repository, cwd=self.basedir, command=cmd)
hunk ./vcpx/repository/git.py 419
-                reset = ExternalCommand(cwd=self.basedir, command=cmd)
+                reset = GitExternalCommand(self.repository, cwd=self.basedir, command=cmd)
hunk ./vcpx/repository/git.py 425
+            elif self.repository.repository and self.repository.BRANCHNAME:
+                # ...and exists(self.repository.storagedir) ?
+
+                # initialization of a new branch in single-repository mode
+                mkdir(join(self.basedir, self.repository.METADIR))
+
+                bp = self._tryCommand(['rev-parse', self.repository.BRANCHPOINT])[0]
+                self._tryCommand(['read-tree', bp])
+                self._tryCommand(['update-ref', self.repository.BRANCHNAME, bp])
+                #self._tryCommand(['checkout-index'])
+
+            else:
+                self._tryCommand(['init-db'])
+                if self.repository.repository:
+                    # in this mode, the db is not stored in working dir, so we
+                    # have to create .git ourselves
+                    mkdir(join(self.basedir, self.repository.METADIR))
hunk ./vcpx/repository/git.py 452
-        infodir = join(self.basedir, self.repository.METADIR, 'info')
+        # create info/excludes in storagedir
+        infodir = join(self.basedir, self.repository.storagedir, 'info')
}

Context:

[Use "_editXXX" instead of "_recordUpdatedXXX" for consistency
[EMAIL PROTECTED] 
[Initialize logger in repository before loading the project
[EMAIL PROTECTED]
 
 This makes the loader available to backend-specific _load() methods.
] 
[Misc parent-repo fixes and cleanups
[EMAIL PROTECTED]
 
 Do not use a default value of '' for parent-repo.  Also fix a bug introduced
 while moving parent-repo support out of tailor.py.
] 
[Revert change to Tailorizer.bootstrap()
[EMAIL PROTECTED]
 Only git knows about PARENT_REPO at this point, so the test must
 performed by the specific workingdir.
] 
[Fix repository instantiation
[EMAIL PROTECTED]
 Don't use the logger, since we don't have one yet. The caller
 will log something for us. Moved (and tested) the bzr specific
 code into the pertaining unit.
] 
[Revert last change on cvs logger name
[EMAIL PROTECTED]
 The name of the logger is still "tailor.vcpx.REP-KIND.xxx"
] 
[Add missing InvocationError import
[EMAIL PROTECTED] 
[Initial support for branches in git target
[EMAIL PROTECTED] 
[Fix remaining references to path predating the repository.py split
[EMAIL PROTECTED] 
[Untabified
[EMAIL PROTECTED] 
[Whitespace, two blank lines to separate classes
[EMAIL PROTECTED] 
[Split the monolithic repository.py into smaller units
[EMAIL PROTECTED]
 The repository subclass of each backend is now in the same unit that
 implements its working dir, under the vcpx.repository subpackage.
 This has several advantages: the obvious of keeping related code closer
 and the ability of lazy load only the needed unit, as it was already done
 for the working dir subclasses.
] 
[Use a common ancestor to recognize tailor exceptions
[EMAIL PROTECTED] 
[Fix comment
[EMAIL PROTECTED] 
[[git] commit at plumbing level
[EMAIL PROTECTED]
 
 This avoids to call the git-commit shell script, and uses low-level git tools
 to do the same job.
] 
[[git] do not rely on "git-commit -a", use git-update-index
[EMAIL PROTECTED]
 
 This is the first part of getting rid of git-commit.  We explicitely
 update the index for each type of file modification.
] 
[Fix _tryCommand call in _getRev
[EMAIL PROTECTED]
 
 I have not experienced the problem, but it seems clear _tryCommand is not
 correctly called here.
] 
[Add a hook to record updated entries in target repo
[EMAIL PROTECTED] 
[Correctly display "default encoding" warning
[EMAIL PROTECTED] 
[[hg] call add with no arguments on init
Brendan Cully <[EMAIL PROTECTED]>**20060621204559] 
[[hg] canonify repository root directory
Brendan Cully <[EMAIL PROTECTED]>**20060621191453
 
 The dirstate walker uses simple string comparison between repo.root
 and os.getcwd(), which may fail unexpectedly if repo.root is not
 the same as realpath(repo.root)
] 
[[hg] chdir to self.basedir before executing commands
Brendan Cully <[EMAIL PROTECTED]>**20060621184724
 
 Some hg tree walk operations expect to be started from the repository
 root (the command-line tool always does this). Without this patch
 the dirstate walk may occasionally inappropriately mangle paths,
 depending on where tailor is run from.
] 
[[hg] Remove files under subdirectories
Brendan Cully <[EMAIL PROTECTED]>**20060620210828
 
 removePathnames was just ignoring directories instead of
 removing the files under them. Tailor should walk mercurial's
 dirstate and remove all files under a removed directory.
] 
[[hg] Use high level commit command
Brendan Cully <[EMAIL PROTECTED]>**20060620203136
 
 commands.commit takes care of expanding directories to their component
 files so we don't have to (we weren't doing it correctly either). If
 mercurial ever decides to track directories, this will already be
 correct.
] 
[[hg] wrapper for commands.*
Brendan Cully <[EMAIL PROTECTED]>**20060620190739
 
 _hgCommand makes it easier to call commands.* functions, and
 ensures they will always have their options dictionary set
 correctly.
] 
[[hg] always use repository-specific UI when repository is available
Brendan Cully <[EMAIL PROTECTED]>**20060620190521] 
[Possible fix for #56: detect branch name at bootstrap
[EMAIL PROTECTED] 
[Use normalized path for comparing with paths from bzrlib
[EMAIL PROTECTED]
 This is the patch attached to ticket #59, thank you luks.
] 
[M-x whitespace-cleanup
[EMAIL PROTECTED] 
[Remove useless imports noticed by pyflakes
[EMAIL PROTECTED] 
[Catch ConfigParser exceptions
[EMAIL PROTECTED] 
[Use the new SF.NET nomenclature to reach the CVS repositories
[EMAIL PROTECTED] 
[Make changeset-threshold a cvs parameter
Yann Dirson <[EMAIL PROTECTED]>**20060606072820] 
[Compare the revision with branch only when following a branch
[EMAIL PROTECTED] 
[Revisited generation of commit entries
[EMAIL PROTECTED]
 Consider added names first, and add the old name in the abstract method.
 This should fix #39 where parent dirs are committed after child, either
 in very large svn commit or coming from CVS.
] 
[Add fake events at the end of the loop
[EMAIL PROTECTED] 
[TAG Version 0.9.23
[EMAIL PROTECTED] 
Patch bundle hash:
eb07073897cbd22785a8d61bb1b0645fbd3bd6cb
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to