Patchwork [2,of,5] convert: rename sink hascommit to hascommitforsplicemap

login
register
mail settings
Submitter Mads Kiilerich
Date May 19, 2014, 8:33 p.m.
Message ID <51fc2a2b012f3b85976c.1400531610@mk-desktop>
Download mbox | patch
Permalink /patch/4816/
State Accepted
Commit 23b24d6a70c80424910e65edc9f6f3aec15f898f
Headers show

Comments

Mads Kiilerich - May 19, 2014, 8:33 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1400530274 -7200
#      Mon May 19 22:11:14 2014 +0200
# Node ID 51fc2a2b012f3b85976c9945cf0e561d77d5df30
# Parent  e72812aa311af3c22607c9100cc5fa9ad1057864
convert: rename sink hascommit to hascommitforsplicemap

The name 'hascommit' sounds like something generic ... but it might also throw
exceptions in specific and it is thus (apparently) only useful for splicemap.
Augie Fackler - May 26, 2014, 4:28 p.m.
On Mon, May 19, 2014 at 10:33:30PM +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1400530274 -7200
> #      Mon May 19 22:11:14 2014 +0200
> # Node ID 51fc2a2b012f3b85976c9945cf0e561d77d5df30
> # Parent  e72812aa311af3c22607c9100cc5fa9ad1057864
> convert: rename sink hascommit to hascommitforsplicemap
>
> The name 'hascommit' sounds like something generic ... but it might also throw
> exceptions in specific and it is thus (apparently) only useful for splicemap.

exceptions in specific what?

>
> diff --git a/hgext/convert/common.py b/hgext/convert/common.py
> --- a/hgext/convert/common.py
> +++ b/hgext/convert/common.py
> @@ -260,8 +260,10 @@ class converter_sink(object):
>          """
>          pass
>
> -    def hascommit(self, rev):
> -        """Return True if the sink contains rev"""
> +    def hascommitforsplicemap(self, rev):
> +        """This method is for the special needs for splicemap handling and not
> +        for general use. Returns True if the sink contains rev, aborts on some
> +        special cases."""
>          raise NotImplementedError
>
>  class commandline(object):
> diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
> --- a/hgext/convert/convcmd.py
> +++ b/hgext/convert/convcmd.py
> @@ -193,7 +193,7 @@ class converter(object):
>          """
>          for c in sorted(splicemap):
>              if c not in parents:
> -                if not self.dest.hascommit(self.map.get(c, c)):
> +                if not self.dest.hascommitforsplicemap(self.map.get(c, c)):
>                      # Could be in source but not converted during this run
>                      self.ui.warn(_('splice map revision %s is not being '
>                                     'converted, ignoring\n') % c)
> @@ -201,7 +201,7 @@ class converter(object):
>              pc = []
>              for p in splicemap[c]:
>                  # We do not have to wait for nodes already in dest.
> -                if self.dest.hascommit(self.map.get(p, p)):
> +                if self.dest.hascommitforsplicemap(self.map.get(p, p)):
>                      continue
>                  # Parent is not in dest and not being converted, not good
>                  if p not in parents:
> diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
> --- a/hgext/convert/hg.py
> +++ b/hgext/convert/hg.py
> @@ -253,7 +253,7 @@ class mercurial_sink(converter_sink):
>              destmarks[bookmark] = bin(updatedbookmark[bookmark])
>          destmarks.write()
>
> -    def hascommit(self, rev):
> +    def hascommitforsplicemap(self, rev):
>          if rev not in self.repo and self.clonebranches:
>              raise util.Abort(_('revision %s not found in destination '
>                                 'repository (lookups with clonebranches=true '
> diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
> --- a/hgext/convert/subversion.py
> +++ b/hgext/convert/subversion.py
> @@ -1300,7 +1300,7 @@ class svn_sink(converter_sink, commandli
>          self.ui.warn(_('writing Subversion tags is not yet implemented\n'))
>          return None, None
>
> -    def hascommit(self, rev):
> +    def hascommitforsplicemap(self, rev):
>          # This is not correct as one can convert to an existing subversion
>          # repository and childmap would not list all revisions. Too bad.
>          if rev in self.childmap:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Mads Kiilerich - May 26, 2014, 4:59 p.m.
On 05/26/2014 06:28 PM, Augie Fackler wrote:
> On Mon, May 19, 2014 at 10:33:30PM +0200, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1400530274 -7200
>> #      Mon May 19 22:11:14 2014 +0200
>> # Node ID 51fc2a2b012f3b85976c9945cf0e561d77d5df30
>> # Parent  e72812aa311af3c22607c9100cc5fa9ad1057864
>> convert: rename sink hascommit to hascommitforsplicemap
>>
>> The name 'hascommit' sounds like something generic ... but it might also throw
>> exceptions in specific and it is thus (apparently) only useful for splicemap.
> exceptions in specific what?

I intended to say "in specific cases" or something like that.

/Mads

Patch

diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -260,8 +260,10 @@  class converter_sink(object):
         """
         pass
 
-    def hascommit(self, rev):
-        """Return True if the sink contains rev"""
+    def hascommitforsplicemap(self, rev):
+        """This method is for the special needs for splicemap handling and not
+        for general use. Returns True if the sink contains rev, aborts on some
+        special cases."""
         raise NotImplementedError
 
 class commandline(object):
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -193,7 +193,7 @@  class converter(object):
         """
         for c in sorted(splicemap):
             if c not in parents:
-                if not self.dest.hascommit(self.map.get(c, c)):
+                if not self.dest.hascommitforsplicemap(self.map.get(c, c)):
                     # Could be in source but not converted during this run
                     self.ui.warn(_('splice map revision %s is not being '
                                    'converted, ignoring\n') % c)
@@ -201,7 +201,7 @@  class converter(object):
             pc = []
             for p in splicemap[c]:
                 # We do not have to wait for nodes already in dest.
-                if self.dest.hascommit(self.map.get(p, p)):
+                if self.dest.hascommitforsplicemap(self.map.get(p, p)):
                     continue
                 # Parent is not in dest and not being converted, not good
                 if p not in parents:
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -253,7 +253,7 @@  class mercurial_sink(converter_sink):
             destmarks[bookmark] = bin(updatedbookmark[bookmark])
         destmarks.write()
 
-    def hascommit(self, rev):
+    def hascommitforsplicemap(self, rev):
         if rev not in self.repo and self.clonebranches:
             raise util.Abort(_('revision %s not found in destination '
                                'repository (lookups with clonebranches=true '
diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1300,7 +1300,7 @@  class svn_sink(converter_sink, commandli
         self.ui.warn(_('writing Subversion tags is not yet implemented\n'))
         return None, None
 
-    def hascommit(self, rev):
+    def hascommitforsplicemap(self, rev):
         # This is not correct as one can convert to an existing subversion
         # repository and childmap would not list all revisions. Too bad.
         if rev in self.childmap: