D8033: copy: move argument validation a little earlier

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Argument validation is usually done early and I will want it done
  before some code that I'm about to add.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1421,6 +1421,13 @@
     ctx = repo[None]
     pctx = ctx.p1()
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
 
     def walkpat(pat):
@@ -1658,12 +1665,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 19696.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=19666&id=19696

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1421,6 +1421,13 @@
     ctx = repo[None]
     pctx = ctx.p1()
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
 
     def walkpat(pat):
@@ -1658,12 +1665,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
marmoute added a comment.
marmoute accepted this revision.


  This looks like a cleanup we can take anyway.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

To: martinvonz, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 20072.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=19696&id=20072

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1470,6 +1470,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'rev'):
         raise error.Abort(_("--rev is only supported with --forget"))
 
@@ -1708,12 +1715,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 20085.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20072&id=20085

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1470,6 +1470,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'rev'):
         raise error.Abort(_("--rev is only supported with --forget"))
 
@@ -1708,12 +1715,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 20152.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20085&id=20152

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1477,6 +1477,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'rev'):
         raise error.Abort(_("--rev is only supported with --forget"))
 
@@ -1715,12 +1722,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
This revision is now accepted and ready to land.
durin42 added a comment.
durin42 accepted this revision.


  Oddly, this had some rejects (I didn't look why) but i"d be happy to see this earlier in the series.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz added a comment.


  In D8033#120581 <https://phab.mercurial-scm.org/D8033#120581>, @durin42 wrote:
 
  > Oddly, this had some rejects (I didn't look why) but i"d be happy to see this earlier in the series.
 
  I moved some revisions around, but it wasn't trivial to move this one. I don't mind waiting until the parents are accepted anyway.

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 20193.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20152&id=20193

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1477,6 +1477,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'rev'):
         raise error.Abort(_("--rev is only supported with --forget"))
 
@@ -1715,12 +1722,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 20201.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20193&id=20201

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1477,6 +1477,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'rev'):
         raise error.Abort(_("--rev is only supported with --forget"))
 
@@ -1715,12 +1722,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz updated this revision to Diff 20228.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20201&id=20228

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1477,6 +1477,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'rev'):
         raise error.Abort(_("--at-rev is only supported with --forget"))
 
@@ -1715,12 +1722,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
martinvonz added a comment.
martinvonz updated this revision to Diff 20232.


  fixed stale uses of -r in commit message and transient code

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20228&id=20232

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1477,6 +1477,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'at_rev'):
         raise error.Abort(_("--at-rev is only supported with --forget"))
 
@@ -1715,12 +1722,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8033: copy: move argument validation a little earlier

mharbison72 (Matt Harbison)
In reply to this post by mharbison72 (Matt Harbison)
Closed by commit rHGd8b49bf6cfec: copy: move argument validation a little earlier (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8033?vs=20232&id=20243

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8033/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8033

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1477,6 +1477,13 @@
 
         return
 
+    pats = scmutil.expandpats(pats)
+    if not pats:
+        raise error.Abort(_(b'no source or destination specified'))
+    if len(pats) == 1:
+        raise error.Abort(_(b'no destination specified'))
+    dest = pats.pop()
+
     if opts.get(b'at_rev'):
         raise error.Abort(_("--at-rev is only supported with --forget"))
 
@@ -1715,12 +1722,6 @@
                     res = lambda p: dest
         return res
 
-    pats = scmutil.expandpats(pats)
-    if not pats:
-        raise error.Abort(_(b'no source or destination specified'))
-    if len(pats) == 1:
-        raise error.Abort(_(b'no destination specified'))
-    dest = pats.pop()
     destdirexists = os.path.isdir(dest) and not os.path.islink(dest)
     if not destdirexists:
         if len(pats) > 1 or matchmod.patkind(pats[0]):



To: martinvonz, #hg-reviewers, marmoute, durin42
Cc: durin42, marmoute, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel