subrepos: print short git changeset ids
This changes the prompts on git subrepos to show only the first seven
digits of git changeset IDs (as git's command line does):
$ hg update
subrepository sources for s differ (in checked out version)
use (l)ocal source (32a3438) or (r)emote source (da5f5b1)?
--- a/mercurial/subrepo.py Wed Feb 16 14:13:22 2011 -0600
+++ b/mercurial/subrepo.py Wed Feb 16 11:53:48 2011 -0600
@@ -886,7 +886,7 @@
if self.dirty():
if self._gitstate() != revision:
dirty = self._gitstate() == self._state[1] or code != 0
- if _updateprompt(self._ui, self, dirty, self._state[1], revision):
+ if _updateprompt(self._ui, self, dirty, self._state[1][:7], revision[:7]):
mergefunc()
else:
mergefunc()
--- a/tests/test-subrepo-git.t Wed Feb 16 14:13:22 2011 -0600
+++ b/tests/test-subrepo-git.t Wed Feb 16 11:53:48 2011 -0600
@@ -359,7 +359,7 @@
$ cd ..
$ hg update 4
subrepository sources for s differ
- use (l)ocal source (da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7) or (r)emote source (aa84837ccfbdfedcdcdeeedc309d73e6eb069edc)?
+ use (l)ocal source (da5f5b1) or (r)emote source (aa84837)?
l
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg id -n
@@ -384,7 +384,7 @@
$ cd ..
$ hg update 1
subrepository sources for s differ (in checked out version)
- use (l)ocal source (32a343883b74769118bb1d3b4b1fbf9156f4dddc) or (r)emote source (da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7)?
+ use (l)ocal source (32a3438) or (r)emote source (da5f5b1)?
l
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg id -n
@@ -405,7 +405,7 @@
1+
$ hg update 7
subrepository sources for s differ
- use (l)ocal source (32a343883b74769118bb1d3b4b1fbf9156f4dddc) or (r)emote source (32a343883b74769118bb1d3b4b1fbf9156f4dddc)?
+ use (l)ocal source (32a3438) or (r)emote source (32a3438)?
l
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg id -n