all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Toshio Kuratomi <a.badger@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: bazaar@lists.canonical.com, emacs-devel@gnu.org
Subject: Re: Emacs Bazaar repository
Date: Sun, 16 Mar 2008 16:47:37 -0500	[thread overview]
Message-ID: <47DD9579.2050008@gmail.com> (raw)
In-Reply-To: <jwvzlsyfqk1.fsf-monnier+emacs@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 716 bytes --]

Stefan Monnier wrote:
>> After a few false starts I have been successful (at least as far as I
>> can tell) in importing the Emacs CVS repository into Bazaar.  If anyone
>> is interested in playing with the results you can check out the HEAD of
>> the CVS repository with:
> 
> Another piece of information that I find missing is all the tags.
> It seems they are present in the form of
> http://bzr.notengoamigos.org/emacs/tags pseudo branches, but they're not
> present in the form of actual Bzr tags.  

I wrote a patch about six months to a year ago to deal with this.
https://bugs.launchpad.net/bzr-cvsps-import/+bug/128326

I'm attaching the patch -- but it might need to be updated.

-Toshio

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: bzr-cvsps-tags.patch --]
[-- Type: text/x-patch; name="bzr-cvsps-tags.patch", Size: 8580 bytes --]

=== modified file '__init__.py'
--- __init__.py	2007-01-19 17:03:04 +0000
+++ __init__.py	2007-07-25 16:36:34 +0000
@@ -64,10 +64,14 @@
                                    help='Use cvs to extract texts.'),
                      option.Option('use-rcs',
                                    help='Use rcs to extract texts. (default)'),
+                     option.Option('use-dirstate-tags',
+                                   help='Use bzr metadata tags rather than'
+                                   ' a branch per tag'),
                     ]
 
     def run(self, cvsroot=None, module=None, output=None, cvsps_dump=None,
-            encoding=None, verify=True, use_cvs=False, use_rcs=False):
+            encoding=None, verify=True, use_cvs=False, use_rcs=False,
+            use_dirstate_tags=False):
         from cvsps import importer
 
         if cvsroot.startswith(':pserver:') or cvsroot.startswith(':ext:'):
@@ -78,11 +82,18 @@
         if not use_cvs and not use_rcs:
             # Default is to use rcs, since it is slightly faster.
             use_cvs = False
+
+        if use_dirstate_tags:
+            tag_style = 'dirstate'
+        else:
+            tag_style = 'branch'
+
         importer = importer.Importer(cvsroot, module, output,
                                      cvsps_dump=cvsps_dump,
                                      encoding=encoding,
                                      verify=verify,
-                                     use_cvs_for_text=use_cvs)
+                                     use_cvs_for_text=use_cvs,
+                                     tag_style=tag_style)
         importer.process()
 
 

=== modified file 'cvsps/importer.py'
--- cvsps/importer.py	2007-02-12 18:03:03 +0000
+++ cvsps/importer.py	2007-07-25 18:14:22 +0000
@@ -597,11 +597,12 @@
     """
 
     def __init__(self, bzr_repo, cvs_root, cvs_module, map_file,
-                 verify=True, use_cvs_for_text=True):
+                 verify=True, use_cvs_for_text=True, tag_style=None):
         self._bzr_repo = bzr_repo
         self._map_file = map_file
         self._cvs_root = cvs_root
         self._cvs_module = cvs_module
+        self._tag_style = tag_style or 'branch'
 
         self._working_path = osutils.pathjoin(
             self._bzr_repo.bzrdir.root_transport.local_abspath('.'),
@@ -623,7 +624,7 @@
         self._n_existing_patches = 0
         self._n_tags = 0
 
-    def handle_patchset(self, patchset):
+    def handle_patchset(self, patchset, pb):
         """Handle one of the patchsets from cvs to bzr"""
 
         revision_id = self._map_file.get(patchset.num)
@@ -653,7 +654,11 @@
             self._n_patches += 1
 
         if patchset.tag is not None:
-            self._handle_tag(patchset, revision_id)
+            if self._tag_style == 'dirstate':
+                self._handle_tag_dirstate(patchset, revision_id, pb)
+            else:
+                self._handle_tag_branch(patchset, revision_id)
+
             action += '+tag'
 
         return revision_id, action
@@ -830,8 +835,13 @@
         os.makedirs(branch_path)
 
         # Create a new one
+        format = bzrdir.BzrDirFormat.get_default_format()
+        if self._tag_style == 'dirstate' and not format.get_branch_format().supports_tags():
+            format = bzrdir.format_registry.get('dirstate-tags')()
+
         target_branch = bzrdir.BzrDir.create_branch_convenience(branch_path,
-                                                         force_new_tree=False)
+                                                         force_new_tree=False,
+                                                         format=format)
         self._set_repo(target_branch)
         target_branch.lock_write()
         self._cache_branch(patchset.branch, target_branch)
@@ -875,7 +885,23 @@
 
         return revision_id
 
-    def _handle_tag(self, patchset, revision_id):
+    def _handle_tag_dirstate(self, patchset, revision_id, pb):
+        """Create a tag with the given revision id."""
+        # TODO: toshio 20070725 We probably want to check that the branch
+        # format supports tags and convert it if it doesn't.  However, the
+        # repository is locked at this point so it's not as simple as the
+        # below code.
+        #
+        # Currently, I'm making sure that the branches support tags when
+        # we create them.
+        #if not self._cur_bzr_branch.supports_tags():
+        #    newFormat = bzrdir.format_registry.get('dirstate-tags')()
+        #    converter = self._cur_bzr_branch.bzrdir._format.get_converter(newFormat)
+        #    self._cur_bzr_branch = converter.convert(self._cur_bzr_branch.bzrdir, pb)
+        self._cur_bzr_branch.tags.set_tag(patchset.tag, revision_id)
+        self._n_tags += 1
+
+    def _handle_tag_branch(self, patchset, revision_id):
         """Create a tag with the given revision id."""
         tag_branch_path = self._get_tag_branch_path(patchset.tag)
         try:
@@ -969,10 +995,12 @@
     """Import a CVS project into bzr."""
 
     def __init__(self, cvsroot, cvs_module, output_base, cvsps_dump=None,
-                 encoding=None, verify=True, use_cvs_for_text=True):
+                 encoding=None, verify=True, use_cvs_for_text=True,
+                 tag_style=None):
         self._cvs_root = osutils.abspath(cvsroot)
         self._cvs_module = cvs_module
         self._use_cvs_for_text = use_cvs_for_text
+        self._tag_style = tag_style or 'branch'
         self._verify = verify
 
         self.output_base = output_base
@@ -1016,7 +1044,7 @@
                 os.makedirs(path)
         self._paths_created = True
 
-    def open_or_create_bzr_repo(self):
+    def open_or_create_bzr_repo(self, pb):
         """Open the bzr repository, creating it if needed."""
         self.setup_directories()
         bzr_repo_transport = transport.get_transport(self._repo_path)
@@ -1024,6 +1052,11 @@
             a_bzrdir = bzrdir.BzrDir.open_from_transport(bzr_repo_transport)
         except errors.NotBranchError:
             return self._create_bzr_repo(bzr_repo_transport)
+        if self._tag_style == 'dirstate' and (
+                not a_bzrdir.find_branch_format().supports_tags()):
+            newFormat = bzrdir.format_registry.get('dirstate-tags')()
+            converter = a_bzrdir._format.get_converter(newFormat)
+            a_bzrdir = converter.convert(a_bzrdir, pb)
         return a_bzrdir.open_repository()
 
     def _create_bzr_repo(self, a_transport):
@@ -1033,6 +1066,10 @@
         except errors.FileExists:
             pass
         fmt = bzrdir.BzrDirFormat.get_default_format()
+        if self._tag_style == 'dirstate' and not (
+                fmt.get_branch_format().supports_tags()):
+            fmt = bzrdir.format_registry.get('dirstate-tags')()
+
         control = fmt.initialize_on_transport(a_transport)
         repo = control.create_repository(shared=True)
         repo.set_make_working_trees(False)
@@ -1065,7 +1102,7 @@
         n_patchsets = len(patchsets)
         for i, patchset in enumerate(patchsets):
             try:
-                rev_id, action = cvs_to_bzr.handle_patchset(patchset)
+                rev_id, action = cvs_to_bzr.handle_patchset(patchset, pb)
             except KeyboardInterrupt:
                 if pb is not None:
                     pb.clear()
@@ -1101,7 +1138,11 @@
 
     def process(self):
         """Start converting the repository."""
-        repo = self.open_or_create_bzr_repo()
+        pb = ui.ui_factory.nested_progress_bar()
+        try:
+            repo = self.open_or_create_bzr_repo(pb=pb)
+        finally:
+            pb.finished()
         # Maintain a repository wide lock for the whole transaction
         # that should help cache stuff.
         # TODO: jam 20061121 This may actually cache *too* much. Consider
@@ -1115,7 +1156,8 @@
             try:
                 cvs_to_bzr = CVSToBzr(repo, self._cvs_root, self._cvs_module,
                                       map_file, verify=self._verify,
-                                      use_cvs_for_text=self._use_cvs_for_text)
+                                      use_cvs_for_text=self._use_cvs_for_text,
+                                      tag_style=self._tag_style)
                 start_time = time.time()
                 pb = ui.ui_factory.nested_progress_bar()
                 try:


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2008-03-16 21:47 UTC|newest]

Thread overview: 236+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 23:41 Emacs Bazaar repository Jason Earl
2008-03-13  1:48 ` Stefan Monnier
2008-03-13  1:52 ` dhruva
2008-03-13  2:26   ` Bastien
2008-03-13  2:28   ` Stefan Monnier
2008-03-13  3:12     ` dhruva
2008-03-13  4:06 ` Karl Fogel
2008-03-13  4:11   ` Jonathan Lange
2008-03-29  1:00     ` Xavier Maillard
2008-03-13 15:30   ` Karl Fogel
2008-03-13 15:58     ` dhruva
2008-03-13 16:50     ` Jason Earl
2008-03-13 20:18     ` How to spell "commit" [was: bikeshedding bzr (or similar) :] Stephen J. Turnbull
2008-03-13  4:09 ` Emacs Bazaar repository Karl Fogel
2008-03-13  4:15   ` Jonathan Lange
2008-03-13  4:30     ` Jonathan Lange
2008-03-14  1:11       ` Dan Nicolaescu
2008-03-14  1:51         ` Jason Earl
2008-03-14  5:10           ` Jonathan Lange
2008-03-13  9:58     ` Andreas Schwab
2008-03-13 22:13       ` Jonathan Lange
2008-03-14 10:27         ` Andreas Schwab
2008-03-14 10:36           ` David Kastrup
2008-03-13  5:08   ` Jason Earl
2008-03-13 10:39   ` Juanma Barranquero
2008-03-13 14:45     ` Stefan Monnier
2008-03-13  4:19 ` Eric Hanchrow
2008-03-13  5:20   ` Jason Earl
2008-03-13  8:04     ` dhruva
2008-03-13  9:04       ` Thien-Thi Nguyen
2008-03-13  9:41         ` David Kastrup
2008-03-13 12:08           ` Thien-Thi Nguyen
2008-03-13 23:46       ` Jonathan Lange
2008-03-14  2:52         ` dhruva
2008-03-14  3:00           ` Jason Earl
2008-03-14  3:03           ` Martin Pool
2008-03-14  5:36             ` Stephen J. Turnbull
2008-03-14  7:03               ` Martin Pool
2008-03-15  4:44                 ` Stephen J. Turnbull
2008-03-14 10:30         ` Andreas Schwab
2008-03-14 15:02         ` Giorgos Keramidas
2008-03-13 11:20     ` James Westby
2008-03-13 16:37       ` Jason Earl
2008-03-13  7:43 ` Thien-Thi Nguyen
2008-03-13  8:49   ` Jason Earl
2008-03-13  9:07     ` Thien-Thi Nguyen
2008-03-13 13:11     ` Aaron Bentley
2008-03-13 11:43 ` Andreas Schwab
2008-03-13 11:55   ` David Kastrup
2008-03-14  9:58     ` Matthieu Moy
2008-03-14 10:42       ` Andreas Schwab
2008-03-14 12:24         ` Matthieu Moy
     [not found]         ` <8562053f49b38b1584b86e1e4d1ec6e6, vpqbq5htrwx.fsf@bauges.imag.fr>
2008-03-14 12:42           ` David Ingamells
2008-03-14 13:05             ` Andreas Schwab
2008-03-14 12:40       ` Eli Zaretskii
2008-03-14  8:23         ` John Arbash Meinel
2008-03-14 13:32           ` Andreas Schwab
2008-03-14 13:39             ` James Westby
2008-03-14 14:13             ` Matthieu Moy
2008-03-14 14:30               ` Andreas Schwab
2008-03-14 14:37                 ` Nicholas Allen
2008-03-14 16:17                   ` David Kastrup
2008-03-14 16:32                     ` Daniel Mark Watkins
2008-03-14 15:15                 ` David Allouche
2008-03-14 15:21                   ` James Westby
2008-03-14 15:43                 ` Matthieu Moy
2008-03-14 13:35           ` David Kastrup
2008-03-14 13:44             ` James Westby
2008-03-14 13:59               ` David Kastrup
2008-03-14 14:09                 ` James Westby
2008-03-14 14:29                   ` Nicholas Allen
2008-03-15  0:39                   ` Stephen J. Turnbull
2008-03-15 10:30                     ` James Westby
2008-03-15 12:30                       ` James Westby
2008-03-14 23:34           ` Stephen J. Turnbull
2008-03-17 10:41             ` Matthieu Moy
2008-03-17 12:39             ` Sergei Organov
2008-03-18  1:48               ` Dan Nicolaescu
2008-03-18  2:13                 ` dhruva
2008-03-18  4:03                   ` Karl Fogel
2008-03-18  5:00                     ` dhruva
2008-03-18  5:40                       ` Jonathan Lange
2008-03-18  9:17                     ` Andreas Schwab
2008-03-18 10:00                       ` dhruva
2008-03-19  5:44                         ` Bastien
2008-03-19  9:42                           ` Juanma Barranquero
2008-03-19 14:04                             ` Bastien
2008-03-19 14:49                               ` Juanma Barranquero
2008-03-19 15:30                                 ` Bastien
2008-03-29  1:00                         ` Xavier Maillard
2008-03-18 16:50                       ` Stefan Monnier
2008-03-18 18:15                         ` Juanma Barranquero
2008-03-20 14:00                           ` Stefan Monnier
2008-03-20 14:10                             ` Jason Rumney
2008-03-20 15:33                               ` Stefan Monnier
2008-03-20 20:34                                 ` Eli Zaretskii
2008-03-21 12:51                             ` dhruva
2008-03-29  1:00                       ` Xavier Maillard
2008-03-18 19:31                     ` Mike Mattie
2008-03-18 19:27                   ` Richard Stallman
2008-03-18 20:05                     ` Andreas Schwab
2008-03-18 20:26                       ` Thien-Thi Nguyen
2008-03-22  4:23                         ` Michael Olson
2008-03-22 11:18                           ` Thien-Thi Nguyen
2008-03-24  6:19                             ` Michael Olson
2008-03-25  9:36                               ` Thien-Thi Nguyen
2008-03-20  1:04                       ` Jonathan Lange
2008-03-18 20:58                     ` Brian Cully
2008-03-18 21:13                       ` Mike Mattie
2008-03-18 21:45                     ` Stefan Monnier
2008-03-18 22:02                       ` Jonathan Lange
2008-03-19  1:21                         ` Stefan Monnier
2008-03-18 23:18                       ` Chong Yidong
2008-03-18 23:46                         ` Nick Roberts
2008-03-19  0:13                         ` Thomas Lord
2008-03-19  0:17                           ` Mike Mattie
2008-03-19  1:14                             ` Thomas Lord
2008-03-19  0:12                     ` Johannes Weiner
2008-03-26  7:56                       ` David Kastrup
2008-03-27 22:22                         ` Johannes Weiner
2008-03-29  1:00                         ` Xavier Maillard
2008-03-14 12:56         ` dhruva
2008-03-14 13:10           ` Lennart Borgman (gmail)
2008-03-14 13:23             ` dhruva
2008-03-14 13:26               ` Andreas Schwab
2008-03-14 14:19             ` Matthieu Moy
2008-03-14 14:29               ` Lennart Borgman (gmail)
2008-03-15  0:43             ` Jonathan Rockway
2008-03-15 14:37               ` Eli Zaretskii
2008-03-15 15:06                 ` dhruva
2008-03-15  0:44             ` Stephen J. Turnbull
2008-03-17 10:43               ` Matthieu Moy
2008-03-14 22:26           ` Martin Geisler
2008-03-15 12:09             ` dhruva
2008-03-15 21:32               ` Martin Geisler
2008-03-25 21:46               ` Giorgos Keramidas
2008-03-19 10:50           ` Sascha Wilde
2008-03-14 13:03         ` Andreas Schwab
2008-03-14 14:24           ` Matthieu Moy
2008-03-14 14:41             ` Andreas Schwab
2008-03-14 14:46               ` Jelmer Vernooij
2008-03-14 15:15                 ` Andreas Schwab
2008-03-15  0:49               ` Harald Meland
2008-03-14 18:04         ` Dan Nicolaescu
2008-03-14 19:42           ` Stefan Monnier
2008-03-14 19:47             ` Andreas Schwab
2008-03-14 20:01               ` Mathias Dahl
2008-03-14 20:06                 ` Andreas Schwab
2008-03-14 21:43         ` Karl Fogel
2008-03-15  0:00         ` Stephen J. Turnbull
2008-03-13 20:27   ` Eli Zaretskii
2008-03-14 10:23     ` Andreas Schwab
2008-03-14  3:56   ` Forest Bond
2008-03-14 10:32     ` Andreas Schwab
2008-03-14 11:28       ` Thomas Lord
2008-03-14 22:23         ` Stephen J. Turnbull
2008-03-14 23:49           ` Thomas Lord
2008-03-14  4:52   ` Jonathan Lange
2008-03-14  6:21     ` Dan Nicolaescu
2008-03-14  6:33       ` Alexander Belchenko
2008-03-14  7:16         ` Dan Nicolaescu
2008-03-14  9:18           ` Juanma Barranquero
2008-03-14 10:08             ` Matthew D. Fuller
2008-03-14 10:14               ` Juanma Barranquero
2008-03-19 16:31             ` Nicholas Allen
2008-03-14 10:35     ` Andreas Schwab
2008-03-14 10:37     ` Andreas Schwab
2008-03-14 11:30   ` Matt Nordhoff
2008-03-29  1:00   ` Xavier Maillard
2008-03-13 13:07 ` Andrea Russo
2008-03-14  9:16   ` Nicholas Allen
2008-03-13 14:18 ` Andreas Schwab
2008-03-14 18:08 ` Stefan Monnier
2008-03-14 18:35   ` Jason Earl
2008-03-14 18:51   ` Andreas Schwab
2008-03-14 19:15     ` Stefan Monnier
2008-03-14 19:32       ` Andreas Schwab
2008-03-14 20:12       ` Thomas Lord
2008-03-14 18:31 ` Goffredo Baroncelli
2008-03-16 18:57 ` Stefan Monnier
2008-03-16 19:53   ` Andreas Schwab
2008-03-17 15:00     ` Michael Haggerty
2008-03-17 16:37       ` Andreas Schwab
2008-03-16 21:47   ` Toshio Kuratomi [this message]
2008-03-18 15:43 ` Emacs repository benchmark: bzr and git Teemu Likonen
2008-03-18 15:51   ` Lennart Borgman (gmail)
2008-03-18 16:05     ` dhruva
2008-03-19  2:53       ` Richard Stallman
2008-03-27  1:32         ` Jonathan Lange
2008-03-27  2:24           ` Stephen J. Turnbull
2008-03-27  2:55           ` Stefan Monnier
2008-03-27 11:58             ` dhruva
2008-03-27 13:59             ` Vincent Ladeuil
2008-03-29  1:17               ` Stefan Monnier
2008-03-29  1:30                 ` James Westby
2008-03-29  3:09                   ` Stefan Monnier
2008-03-29  4:06                     ` James Westby
2008-03-29  4:50                       ` Stefan Monnier
2008-03-29  1:00             ` Xavier Maillard
2008-03-29  4:34               ` David Cournapeau
2008-03-31  0:00                 ` Xavier Maillard
2008-03-29  1:00       ` Xavier Maillard
2008-03-29  9:19         ` Andreas Schwab
2008-03-29  9:58           ` David Kastrup
2008-03-29 10:13             ` dhruva
2008-03-29 10:26               ` David Kastrup
2008-03-31  0:00               ` Xavier Maillard
2008-03-29 14:55             ` Randal L. Schwartz
2008-03-29 16:35               ` Óscar Fuentes
2008-03-29 18:13                 ` tomas
2008-03-29 21:05                 ` Stephen J. Turnbull
2008-03-30  5:49               ` Richard Stallman
2008-03-30  5:49           ` Richard Stallman
2008-03-30  6:25             ` Jonathan Rockway
2008-03-30 19:56               ` Richard Stallman
2008-03-31  0:00           ` Xavier Maillard
2008-03-18 16:19     ` Matthieu Moy
2008-03-19  9:43       ` Teemu Likonen
2008-03-18 16:02   ` Matthieu Moy
2008-03-18 16:33     ` dhruva
2008-03-18 18:41       ` Jonathan Corbet
2008-03-19  1:40         ` dhruva
2008-03-18 21:04       ` Eli Zaretskii
2008-03-18 17:11     ` Teemu Likonen
2008-03-18 17:43     ` Stefan Monnier
2008-03-18 18:20       ` Juanma Barranquero
2008-03-18 16:43   ` Andreas Schwab
2008-03-18 19:19     ` Teemu Likonen
2008-03-18 20:22   ` James Westby
2008-03-19 11:37   ` Emacs repository benchmark: bzr and git (rerun) Teemu Likonen
2008-03-19 12:17     ` James Westby
2008-03-19 22:39       ` Robert Collins
2008-03-19 16:41     ` Teemu Likonen
2008-03-22 17:59 ` Emacs Bazaar repository Stefan Monnier
2008-03-22 19:59   ` Andreas Schwab
2008-03-24  7:53 ` Christian Faulhammer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47DD9579.2050008@gmail.com \
    --to=a.badger@gmail.com \
    --cc=bazaar@lists.canonical.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.