D3901: histedit: add nobackup config option

2018-07-18 Thread yuja (Yuya Nishihara)
yuja added a subscriber: pulkit.
yuja added a comment.


  > +coreconfigitem('ui', 'historyediting_backup',
  >  +default=True,
  >  +)
  > 
  >   coreconfigitem('ui', 'interactive',
  >   default=None,
  >   )
  > 
  > diff --git a/hgext/histedit.py b/hgext/histedit.py
  > 
  >   - a/hgext/histedit.py +++ b/hgext/histedit.py @@ -,7 +,8 @@ 
fm.startitem() goal = _getgoal(opts) revs = opts.get('rev', [])
  > - nobackup = opts.get('no_backup') +nobackup = (opts.get('no_backup') 
or +not ui.configbool('ui', 'historyediting_backup'))
  
  `history-editing-backup` per new rule.
  
  https://www.mercurial-scm.org/wiki/UIGuideline#config
  
  Can you add `# experimental config: ui.history-editing-backup` to silence
  check-config? It's probably too late to add full support for this option
  and make it documented.
  
  And, should we drop the --no-backup option? @pulkit what do you think?

REPOSITORY
  rHG Mercurial

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

To: khanchi97, durin42, #hg-reviewers
Cc: pulkit, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3901: histedit: add nobackup config option

2018-07-18 Thread Yuya Nishihara
> +coreconfigitem('ui', 'historyediting_backup',
> +default=True,
> +)
>  coreconfigitem('ui', 'interactive',
>  default=None,
>  )
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -,7 +,8 @@
>  fm.startitem()
>  goal = _getgoal(opts)
>  revs = opts.get('rev', [])
> -nobackup = opts.get('no_backup')
> +nobackup = (opts.get('no_backup') or
> +not ui.configbool('ui', 'historyediting_backup'))

`history-editing-backup` per new rule.

https://www.mercurial-scm.org/wiki/UIGuideline#config

Can you add `# experimental config: ui.history-editing-backup` to silence
check-config? It's probably too late to add full support for this option
and make it documented.

And, should we drop the --no-backup option? @pulkit what do you think?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3901: histedit: add nobackup config option

2018-07-11 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9531.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3901?vs=9493=9531

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

AFFECTED FILES
  hgext/histedit.py
  mercurial/configitems.py
  tests/test-histedit-no-backup.t

CHANGE DETAILS

diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -93,3 +93,41 @@
   o  0   36b4bdd91f5b   1970-01-01 00:00 +   test
one
   
+==
+Test histediting_backup config option|
+==
+Test when `histediting_backup` config option is not enabled:
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
+  saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
+
+Test when `histediting_backup` config option is enabled
+Enable config option:
+  $ cat >>$HGRCPATH < [ui]
+  > historyediting_backup=False
+  > EOF
+
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1081,6 +1081,9 @@
 coreconfigitem('ui', 'graphnodetemplate',
 default=None,
 )
+coreconfigitem('ui', 'historyediting_backup',
+default=True,
+)
 coreconfigitem('ui', 'interactive',
 default=None,
 )
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -,7 +,8 @@
 fm.startitem()
 goal = _getgoal(opts)
 revs = opts.get('rev', [])
-nobackup = opts.get('no_backup')
+nobackup = (opts.get('no_backup') or
+not ui.configbool('ui', 'historyediting_backup'))
 rules = opts.get('commands', '')
 state.keep = opts.get('keep', False)
 



To: khanchi97, durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3901: histedit: add nobackup config option

2018-07-11 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > What is the right place to register this config option?
  
  mercurial/configitems.py
  
  FWIW, adding the `[edithistory]` section doesn't sound nice unless we have
  more options to be added. I don't have any better idea, but we generally
  add random stuff to the `[ui]` section.

REPOSITORY
  rHG Mercurial

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

To: khanchi97, durin42, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3901: histedit: add nobackup config option

2018-07-11 Thread Yuya Nishihara
> What is the right place to register this config option?

mercurial/configitems.py

FWIW, adding the `[edithistory]` section doesn't sound nice unless we have
more options to be added. I don't have any better idea, but we generally
add random stuff to the `[ui]` section.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3901: histedit: add nobackup config option

2018-07-10 Thread khanchi97 (Sushil khanchi)
khanchi97 added inline comments.

INLINE COMMENTS

> histedit.py:240
> +default=False,
> +)
>  

What is the right place to register this config option? Because if I register 
this in histedit extension then someone who doesn't have enabled histedit 
extension won't be able to use this config option. But this option aims to work 
with every history editing command.

REPOSITORY
  rHG Mercurial

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

To: khanchi97, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3901: histedit: add nobackup config option

2018-07-10 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Instead of passing --no-backup option every time you don't
  want to store backup, now you can set config option:
  
  [edithistory]
  nobackup = True
  
  This option aims to operate on every history editing command.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-no-backup.t

CHANGE DETAILS

diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -93,3 +93,41 @@
   o  0   36b4bdd91f5b   1970-01-01 00:00 +   test
one
   
+===
+Test nobackup config option|
+===
+Test when `nobackup` config option is not enabled:
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
+  saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
+
+Test when `nobackup` config option is enabled
+Enable config option:
+  $ cat >>$HGRCPATH < [edithistory]
+  > nobackup=True
+  > EOF
+
+  $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
+  > pick 36b4bdd91f5b 0 one
+  > pick 6153eb23e623 1 two
+  > roll 80d23dfa866d 2 three
+  > edit 7d5187087c79 3 four
+  > EOF
+  merging file
+  Editing (7d5187087c79), you may commit or record as needed now.
+  (hg histedit --continue to resume)
+  [1]
+  $ hg histedit --abort
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -235,6 +235,9 @@
 configitem('histedit', 'singletransaction',
 default=False,
 )
+configitem('edithistory', 'nobackup',
+default=False,
+)
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -,7 +1114,7 @@
 fm.startitem()
 goal = _getgoal(opts)
 revs = opts.get('rev', [])
-nobackup = opts.get('no_backup')
+nobackup = opts.get('no_backup') or ui.configbool('edithistory', 
'nobackup')
 rules = opts.get('commands', '')
 state.keep = opts.get('keep', False)
 



To: khanchi97, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel